Skip to content

dobladez/boardgames-exercise

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

51 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Boardgames Exercise

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.

To start Clerk notebooks locally

Install clj and babashka. Then run:

bb clerk-watch

This 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.

To run all tests

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-purpose

On PowerShell:

$env:STOCKFISH_BIN = "C:\\path\\to\\stockfish.exe"
bb test --skip-meta :failing-on-purpose

For 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 :stockfish

To build the static site

bb build-static

Generates the static site with all code and notebooks. The output goes under public/

License

Copyright © 2024 Fernando Dobladez

Distributed under GNU GENERAL PUBLIC LICENSE version 3

About

An implementation and code walkthrough of the rules of Chess

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors