with import {}.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!")) ]