-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.go
51 lines (42 loc) · 981 Bytes
/
main.go
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
package main
import (
"flag"
"github.com/srowles/go-game-of-life/gol"
"github.com/srowles/go-game-of-life/ui/terminal"
)
func main() {
var width, height int
flag.IntVar(&width, "width", 60, "width of the board")
flag.IntVar(&height, "height", 20, "height of the board")
flag.Parse()
gol := gol.NewLife(width, height)
// a glider
gol.Set(10, 10, true)
gol.Set(11, 10, true)
gol.Set(12, 10, true)
gol.Set(10, 11, true)
gol.Set(11, 12, true)
// static square
gol.Set(2, 2, true)
gol.Set(2, 3, true)
gol.Set(3, 2, true)
gol.Set(3, 3, true)
// becomes a "circle"
gol.Set(30, 10, true)
gol.Set(31, 10, true)
gol.Set(32, 10, true)
gol.Set(30, 11, true)
// shape that morphs then becomes stable
gol.Set(51, 7, true)
gol.Set(49, 8, true)
gol.Set(50, 8, true)
gol.Set(52, 8, true)
gol.Set(53, 8, true)
gol.Set(50, 9, true)
gol.Set(52, 9, true)
gol.Set(50, 10, true)
gol.Set(52, 10, true)
gol.Set(51, 11, true)
ui := terminal.New(gol)
ui.Run()
}