Published at https://neuroning.com/boardgames-exercise/
This repo is a solution to exercise 2.13 of book "Software Design for Flexibility" by by Chris Hanson and Gerald Jay Sussman. In Clojure.
Assignment: Model the rules of Chess. Design the code with the flexibility to easily add new types of pieces with unique movements. The goal is to create a shared core model that can also be used for other board games, such as Checkers, Tic-Tac-Toe, and similar.
The code includes Clerk notebooks with a code walkthrough of the implementation with visualizatons and code-stepper/debugger.
Install clj and babashka. Then run:
bb clerk-watchThis will start the Clerk server at http://localhost:7778 with a file
watcher that updates the page each time any file in the src directory changes.
Alternatively, you may want to start a Clojure REPL activating the :dev alias
(clj -M:dev), connect with your editor and then call (user/start!) to start
the Clerk server.
bb test
# or:
bb test --skip-meta :failing-on-purpose
Stockfish parity tests are included and tagged with :stockfish metadata. They
auto-skip when the stockfish binary is not available.
You can provide an explicit binary path with:
export STOCKFISH_BIN=/path/to/stockfish
bb test --skip-meta :failing-on-purposeOn PowerShell:
$env:STOCKFISH_BIN = "C:\\path\\to\\stockfish.exe"
bb test --skip-meta :failing-on-purposeFor debugging purposes, you can enable verbose output from the Stockfish tests by adding STOCKFISH_DEBUG env var:
export STOCKFISH_DEBUG=true
bb test --only-meta :stockfishbb build-static
Generates the static site with all code and notebooks. The output goes under public/
Copyright © 2024 Fernando Dobladez
Distributed under GNU GENERAL PUBLIC LICENSE version 3