Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chapter 5: valid-moves #173

Open
andres-moreno opened this issue Jul 19, 2017 · 0 comments
Open

Chapter 5: valid-moves #173

andres-moreno opened this issue Jul 19, 2017 · 0 comments

Comments

@andres-moreno
Copy link

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant