Skip to content

Commit eb107ce

Browse files
committed
Start extended programming example Nim
1 parent f36fdb6 commit eb107ce

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

10.8-nim.hs

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
next :: Int -> Int
2+
next 1 = 2
3+
next 2 = 1
4+
5+
type Board = [Int]
6+
7+
initial :: Board
8+
initial = [5,4,3,2,1]
9+
10+
finished :: Board -> Bool
11+
finished = all (== 0)
12+
13+
valid :: Board -> Int -> Int -> Bool
14+
valid board row num = board !! (row-1) >= num
15+

0 commit comments

Comments
 (0)