Skip to content

Repository files navigation

#+caption: chess
[[https://raw.githubusercontent.com/sunflowerseastar/chess/master/chess-readme.png]]

* Chess

- clutter-free chess app, 1 or 2 player (desktop)
- full rule set, with the exception of promoting a pawn to a not-queen
- traditional piece design
- computer player (via spacebar/enter), although not a good one
- openings table (partial)
- supports FEN import/export
- responsive

** Todo

- afford computer player on mobile
- permit a player to promote a cross-board pawn to any piece
- improve computer player middlegame (minmax, other?)
- add computer player endgame
- split out components

* Quick Start

Pre-reqs:

- [[https://clojure.org/guides/getting_started][Clojure/ClojureScript​]]
- [[https://github.com/technomancy/leiningen/wiki/Packaging][Leiningen]]

Use [[https://figwheel.org/][figwheel-main]], with config in ~project.clj~.

#+begin_src sh
lein fig:build # dev - localhost:9500
# http://localhost:9500/figwheel-extra-main/auto-testing
# or
lein fig -- -b dev -r

lein fig:min   # build
lein fig:test  # test

# cypress tests
yarn
yarn cy:open
yarn cy:run
#+end_src

For emacs dev, [[https://docs.cider.mx/cider/cljs/figwheel.html#using-figwheel-main][cider-jack-in-cljs]] from [[https://docs.cider.mx/cider/cljs/figwheel.html#using-figwheel-main][CIDER]].

* Overview

The codes lives in ~src/~:

- ~components.cljs~ - [[https://reagent-project.github.io/][Reagent]] UI components
- ~core.cljs~ - the app state and actions to update the state; UI root (~main~)
- ~fen.cljs~ - translations to/from app state & [[https://en.wikipedia.org/wiki/Forsyth%E2%80%93Edwards_Notation][FEN]]
- ~helpers.cljs~ - utility functions
- ~legal.cljs~ - pure functions that decide what moves are and aren't with a given board & game state
- ~openings_table.cljs~ - some common openings, pulled from Eduard Gufeld and Nikolai Kalinichenko's [[https://everymanchess.com/products/opening-repertoire-for-the-attacking-player][Opening Repertoire for the Attacking Player]]
- ~svgs.cljs~ - SVGs created to look like the pieces from said book

Tests are in ~test/chess/~ and ~cypress/e2e/~.

About

chess engine & UI

Topics

Resources

Stars

1 star

Watchers

2 watching

Forks

Used by

Contributors

Languages