No description
Find a file
dependabot[bot] 9d45f2784d
⬆️ Bump TimonVS/pr-labeler-action from 4.1.1 to 5.0.0 (#16)
Bumps [TimonVS/pr-labeler-action](https://github.com/timonvs/pr-labeler-action) from 4.1.1 to 5.0.0.
- [Release notes](https://github.com/timonvs/pr-labeler-action/releases)
- [Commits](https://github.com/timonvs/pr-labeler-action/compare/v4.1.1...v5.0.0)

---
updated-dependencies:
- dependency-name: TimonVS/pr-labeler-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-20 13:59:29 +09:00
.github ⬆️ Bump TimonVS/pr-labeler-action from 4.1.1 to 5.0.0 (#16) 2024-03-20 13:59:29 +09:00
docs chore: add maze example 2022-04-02 00:46:58 +09:00
examples chore: runnable game of life from a text file #5 (#8) 2022-03-16 20:27:26 +09:00
js ♻️ src配下に複数のモジュールを配置しないようにソース構成を変更した 2019-07-03 22:26:49 +09:00
src feat: stop program when cell states were same in 2 consecutive steps (#12) 2022-07-22 22:58:14 +09:00
tests 🔥 Change package name, from lifegame to gameoflife. 2019-04-13 20:34:02 +09:00
.gitignore 💡 change directory structure 2019-04-23 12:33:39 +09:00
gameoflife.nimble chore: bump minor 2022-07-22 22:59:17 +09:00
README.adoc chore: add maze example 2022-04-02 00:46:58 +09:00

:toc: left
:sectnums:

= gameoflife

gameoflife is
https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life[Game_of_Life] library in
pure Nim.

image:https://travis-ci.org/jiro4989/gameoflife.svg?branch=master["Build Status", link="https://travis-ci.org/jiro4989/gameoflife"]

== Development

- `nim >= 1.0.0`

== Install

[source,bash]
nimble install gameoflife

== Usage

=== CLI

[source,bash]
----
gameoflife examples/read_file/in/glider.txt
----

`glider.txt` is:

[source,txt]
----
00000000000000000000000000000000000000
00000000000000000000000001000000000000
00000000000000000000000101000000000000
00000000000001100000011000000000000110
00000000000010001000011000000000000110
01100000000100000100011000000000000000
01100000000100010110000101000000000000
00000000000100000100000001000000000000
00000000000010001000000000000000000000
00000000000001100000000000000000000000
00000000000000000000000000000000000000
00000000000000000000000000000000000000
00000000000000000000000000000000000000
00000000000000000000000000000000000000
00000000000000000000000000000000000000
00000000000000000000000000000000000000
00000000000000000000000000000000000000
00000000000000000000000000000000000000
----

==== Play gameoflife with `maze`

Generate random data with https://github.com/jiro4989/maze[maze].

Setup:

[source,bash]
----
nimble install -Y maze
----

And run:

[source,bash]
----
maze -r:1 -w:0 -W:20 -H:20 | gameoflife
----

image:docs/maze.gif["Maze"]

=== Library

==== Blinker example

[source,nim]
----
import gameoflife
from os import sleep

var board: Board = @[
  @[dead, dead, dead, dead, dead],
  @[dead, dead, dead, dead, dead],
  @[dead, live, live, live, dead],
  @[dead, dead, dead, dead, dead],
  @[dead, dead, dead, dead, dead],
]

while true:
  board.nextStep()
  board.print
  echo "-----------------------------------"
  sleep(100)
----

==== Glider example

[source,bash]
cd examples/read_file
nim c -r main.nim in/glider.txt

image:docs/glider.gif["Glider animation"]

== Documents

* https://jiro4989.github.io/gameoflife/gameoflife.html

== Web application of Game of Life

I created simple Game of Life on web application.

https://jiro4989.github.io/gameoflife

Javascript library of Game of Life of the application is generated by this
module (`nimble js`).