-
Notifications
You must be signed in to change notification settings - Fork 2
/
conway.nim
36 lines (31 loc) · 831 Bytes
/
conway.nim
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
import conwaymap
import os, threadpool
const pauseMillis = 20
const defaultCount = 300
const initialMap = [
" 1 ",
" 1 1 ",
" 11 11 11",
" 1 1 11 11",
"11 1 1 11 ",
"11 1 1 11 1 1 ",
" 1 1 1 ",
" 1 1 ",
" 11 ",
]
proc enterToQuit() =
discard readLine(stdin)
quit()
proc main() =
var map: ConwayMap
map.init(initialMap)
# Press ENTER to exit"
spawn enterToQuit()
# Start the game
for i in 1..defaultCount:
map.print()
echo "n = ", i, "\t Press ENTER to exit"
os.sleep(pauseMillis)
map.next()
when isMainModule:
main()