blob: 9692629c63d1b432241b43faa1f779b1791b7fce (
plain)
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
|
with import <nixpkgs> {}.lib;
let
# all possible winning rows
winning = [
["tl" "tm" "tr"]
["ml" "mm" "mr"]
["bl" "bm" "br"]
["tl" "ml" "bl"]
["tm" "mm" "bm"]
["tr" "mr" "br"]
["tl" "mm" "br"]
["bl" "mm" "tr"]
];
showGrid = grid: with grid; ''
===========GRID===========
${tl} | ${tm} | ${tr}
---------
${ml} | ${mm} | ${mr}
---------
${bl} | ${bm} | ${br}
'';
# the inital empty grid
emptyGrid = listToAttrs
(map (name: {inherit name; value = " ";})
["tl" "tm" "tr" "ml" "mm" "mr" "bl" "bm" "br"]);
in {seed}:
with import ./io.nix {s = seed;};
do initialWorld [
(v: read_input "hello!")
(log)
(v: read_input "lalala second round!")
(log)
(ifThenElse (v: v == "condition\n")
(v: log "condition was met!")
(v: log "condition did not hold!"))
]
|