programdemos/tttml-play.xtl
ᵘa̲sk : Num a => a -> Int
ᵘa̲sk ← { s → shown ← p̲rint! "your move (1 to 9):" t ← ⎕R̲EAD @ k ← "123456789" i̲ndexOf f̲irst t c̲at " " (k ≤ 9) ∧ 0 = k s̲elect s c̲at 1 ? k◆ ᵘa̲sk s }
ᵘy̲ou : Int -> Int
ᵘy̲ou ← { s → s ← s ᵗa̲fter ᵘa̲sk s shown ← p̲rint! ᵗs̲how s gap ← p̲rint! "" 0 = ᵗo̲utcome s ? ᵘm̲e s◆ s }
Used in: ᵘm̲e, tttml-play.xtl:37
ᵘm̲e : Int -> Int
ᵘm̲e ← { s → s ← s ᵗa̲fter m ᵗc̲hoose s shown ← p̲rint! ᵗs̲how s gap ← p̲rint! "" 0 = ᵗo̲utcome s ? ᵘy̲ou s◆ s }
Used in: ᵘy̲ou
ᵘv̲erdict : Num a => a -> Char
ᵘv̲erdict ← { w → w = 1 ? "you win"◆ w = -1 ? "it wins"◆ "a draw" }
Used in: tttml-play.xtl:37