Open
Description
Hi, Daniel!
Great book! A small correction. You write (p. 118 of the printed version)
Given this board, positions 1, 6, and 11 have valid moves, but all others don't.
This is not the case: when position 4 is open at the start of the game, position 13 has a valid move to position 4 by jumping over position 8. Your code is right as we can see by typing in the REPL.
pegthing.core> (def my-board (assoc-in (new-board 5) [4 :pegged] false))
#'pegthing.core/my-board
pegthing.core> (valid-moves my-board 13)
{4 8}
I am really enjoying the book and learning a lot! Thanks!
Metadata
Metadata
Assignees
Labels
No labels