Skip to content

Commit

Permalink
Chess example
Browse files Browse the repository at this point in the history
  • Loading branch information
edemaine committed Jul 28, 2022
1 parent b30b368 commit 0ee0923
Show file tree
Hide file tree
Showing 23 changed files with 870 additions and 3 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ and optionally converts it to PDF, PNG, and/or LaTeX for LaTeX text.
Here are a few examples of generated figures;
see [more examples below](#examples).

| [Super Mario Bros.](examples/mario) | [The Witness](examples/witness) |
| --- | --- |
| [![Super Mario Bros. custom level](examples/mario/door_overworld.png)](examples/mario) | [![The Witness custom level](examples/witness/solved-grid.svg)](examples/witness) |
| [Super Mario Bros.](examples/mario) | [The Witness](examples/witness) | [Chess](examples/chess) |
| --- | --- | --- |
| [![Super Mario Bros. custom level](examples/mario/door_overworld.png)](examples/mario) | [![The Witness custom level](examples/witness/solved-grid.svg)](examples/witness) | [![Immortal Game chessboard](examples/chess/board-immortal.svg)](examples/chess)

## Main Concepts

Expand Down Expand Up @@ -546,6 +546,7 @@ while others are more demonstrations of particular SVG Tiler features.
### Video/board games:
* [Super Mario Bros.](examples/mario)
* [Tetris](examples/tetris)
* [Chess](examples/chess)
* [The Witness](examples/witness)
* [Tilt](examples/tilt)

Expand Down
12 changes: 12 additions & 0 deletions examples/chess/Chess_bdt45.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions examples/chess/Chess_blt45.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions examples/chess/Chess_kdt45.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions examples/chess/Chess_klt45.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions examples/chess/Chess_ndt45.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions examples/chess/Chess_nlt45.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions examples/chess/Chess_pdt45.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions examples/chess/Chess_plt45.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 27 additions & 0 deletions examples/chess/Chess_qdt45.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions examples/chess/Chess_qlt45.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
39 changes: 39 additions & 0 deletions examples/chess/Chess_rdt45.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions examples/chess/Chess_rlt45.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions examples/chess/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
all: coffee js
coffee:
svgtiler map.coffee *.asc
js:
svgtiler map.js *.asc
41 changes: 41 additions & 0 deletions examples/chess/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Chess Boards

## Drawings

| Rendering | Repo Files | Source |
|-----------|------------|--------|
| ![Initial chessboard](board-init.svg) | [ASCII input](board-init.asc)<br>[SVG output](board-init.svg) | [Wikipedia: Chess](https://en.wikipedia.org/wiki/Chess) |
| ![Immortal Game chessboard](board-immortal.svg) | [ASCII input](board-immortal.asc)<br>[SVG output](board-immortal.svg) | [Wikipedia: Immortal Game](https://en.wikipedia.org/wiki/Immortal_Game) (last position) |

## Mapping

* [CoffeeScript mapping file](map.coffee) and equivalent
[JavaScript mapping file](map.js), illustrating:
* Computing the square parity to automatically shade dark squares
* Using `require` to load and modify external SVG files
(strip off unnecessary `<svg>` wrapper)
* JSX notation for creating and composing symbols

## Piece Shapes

Piece shapes are defined by unmodified SVGs from
[Wikimedia's Standard chess diagrams](https://commons.wikimedia.org/wiki/Standard_chess_diagram),
authored by [Cburnett](https://commons.wikimedia.org/wiki/User:Cburnett)
(Colin M.L. Burnett)
and licensed under [BSD license](https://opensource.org/licenses/BSD-3-Clause)
(among other licenses).

| Image | Repo file | Wikimedia link |
|-------|-----------|----------------|
| ![](Chess_bdt45.svg) | [Chess_bdt45.svg](Chess_bdt45.svg) | [Chess_bdt45.svg](https://commons.wikimedia.org/wiki/File:Chess_bdt45.svg) |
| ![](Chess_blt45.svg) | [Chess_blt45.svg](Chess_blt45.svg) | [Chess_blt45.svg](https://commons.wikimedia.org/wiki/File:Chess_blt45.svg) |
| ![](Chess_kdt45.svg) | [Chess_kdt45.svg](Chess_kdt45.svg) | [Chess_kdt45.svg](https://commons.wikimedia.org/wiki/File:Chess_kdt45.svg) |
| ![](Chess_klt45.svg) | [Chess_klt45.svg](Chess_klt45.svg) | [Chess_klt45.svg](https://commons.wikimedia.org/wiki/File:Chess_klt45.svg) |
| ![](Chess_ndt45.svg) | [Chess_ndt45.svg](Chess_ndt45.svg) | [Chess_ndt45.svg](https://commons.wikimedia.org/wiki/File:Chess_ndt45.svg) |
| ![](Chess_nlt45.svg) | [Chess_nlt45.svg](Chess_nlt45.svg) | [Chess_nlt45.svg](https://commons.wikimedia.org/wiki/File:Chess_nlt45.svg) |
| ![](Chess_pdt45.svg) | [Chess_pdt45.svg](Chess_pdt45.svg) | [Chess_pdt45.svg](https://commons.wikimedia.org/wiki/File:Chess_pdt45.svg) |
| ![](Chess_plt45.svg) | [Chess_plt45.svg](Chess_plt45.svg) | [Chess_plt45.svg](https://commons.wikimedia.org/wiki/File:Chess_plt45.svg) |
| ![](Chess_qdt45.svg) | [Chess_qdt45.svg](Chess_qdt45.svg) | [Chess_qdt45.svg](https://commons.wikimedia.org/wiki/File:Chess_qdt45.svg) |
| ![](Chess_qlt45.svg) | [Chess_qlt45.svg](Chess_qlt45.svg) | [Chess_qlt45.svg](https://commons.wikimedia.org/wiki/File:Chess_qlt45.svg) |
| ![](Chess_rdt45.svg) | [Chess_rdt45.svg](Chess_rdt45.svg) | [Chess_rdt45.svg](https://commons.wikimedia.org/wiki/File:Chess_rdt45.svg) |
| ![](Chess_rlt45.svg) | [Chess_rlt45.svg](Chess_rlt45.svg) | [Chess_rlt45.svg](https://commons.wikimedia.org/wiki/File:Chess_rlt45.svg) |
8 changes: 8 additions & 0 deletions examples/chess/board-immortal.asc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
r.bk...r
p..pBpNp
n....n..
.p.NP..P
......P.
...P....
P.P.K...
q.....b.
Loading

0 comments on commit 0ee0923

Please sign in to comment.