brave-clojure-web icon indicating copy to clipboard operation
brave-clojure-web copied to clipboard

Chapter 5: valid-moves

Open andres-moreno opened this issue 8 years ago • 0 comments

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!

andres-moreno avatar Jul 19 '17 18:07 andres-moreno