blob: f4ddab75355382dfb6a2ec3e36366eb7bf0e5317 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
# GameOfLife
The implementation of the [Conway's Game of Life](https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life) ruby CLI gem
## Installation
```bash
$ gem install terminal_game_of_life
```
## Usage
```bash
$game-of-life -i https://gitlab.com/a14m.keys --live-cell +
$game-of-life -i /path/to/file.txt --height 35 --width 35
$game-of-life -s 1337 --delay 250
```
Check `game-of-life --help` for usage info.
```
Commands:
game-of-life --version, -v # Prints the Game of Life version information
game-of-life help [COMMAND] # Describe available commands or one specific command
game-of-life start [OPTIONS] # Start the Game of Life simulations
Options:
-s, [--seed=SEED] # Specify the seed number to use as an initial state (default to random).
-i, [--input=VALUE] # Specify the path/URL for the file to use as an initial state. (used instead of seed)
[--width=WIDTH] # Specify the width of generated universe. (default to terminal width)
[--height=HEIGHT] # Specify the hight of generated universe. (default to terminal height)
[--dead-cell=CHAR] # Specify the dead-cell representation
# Default:
[--live-cell=CHAR] # Specify the live-cell representation
# Default: █
-d, [--delay=Milli-Seconds] # Specify the introduced delay between each generation
# Default: 50
```
## Demo
[](https://asciinema.org/a/PsKzaWaNwUq3ZEfrFATqMw0yF)
## Development
- Clone the repo.
- Navigate to the ruby CLI implementation `cd game-of-life/CLI/ruby`.
- run `bundle install` to install dependencies.
- you can run `bundle rake build` to build the gem/CLI into the `pkg` directory.
- you can run `bundle rake install` to build and install gem/CLI into system gems.
- you can run `bundle exec ./bin/game-of-life` to run the code for development/testing purposes
## Linting
Run `bundle exec rubocop`
## Testing
Run `bundle exec rspec`
## Documentation
Run `bundle exec yard`
## Release
- Update the [version](./lib/game_of_live/version.rb) number
- Run `bundle install` and commit changes
- Update the [CHANGELOG](./CHANGELOG.md)
- Create a git(lab) tag `ruby/v#{version_number}` ex: `ruby/v0.1.1-pre`
The tag will automatically trigger the release workflow after successful build/test
and release the changes to [rubygems.org](https://rubygems.org/gems/terminal_game_of_life)
## Extra information
### [Contributing](https://gitlab.com/a14m/game-of-life/-/blob/master/CONTRIBUTING.md)
### [License](https://gitlab.com/a14m/game-of-life/-/blob/master/LICENSE.md)
### [Code of Conduct](https://gitlab.com/a14m/game-of-life/-/blob/master/CODE_OF_CONDUCT.md)
|