Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Shogi

Shogi against whoever else turns up, played on GitHub. Nothing to install, and no account beyond the one you already have: every move is an issue, and the board is this file.

9a white lance to move8a white knight to move6a white gold to move5a white king to move4a white gold to move3a white silver to move2a white knight to move1a white lance to move
8b white rook to move6b white silver to move2b white bishop to move
9c white pawn to move7c white pawn to move6c white pawn to move5c white pawn to move4c white pawn to move3c white pawn to move2c white pawn to move1c white pawn to move
8d white pawn to move

7f black pawn
9g black pawn8g black pawn7g black knight6g black pawn5g black pawn4g black pawn3g black pawn2g black pawn1g black pawn
8h black bishop5h black rook
9i black lance7i black silver6i black gold5i black king4i black gold3i black silver2i black knight1i black lance

Click a piece, then a square. Takes about 30 seconds. · Resign

Last move: R-5h · Black 0 · White 0 · 0 games · 1 player

How to play

Click a piece to select it, then click one of the red circles to move it there. Each click opens an issue with the move already written in the title — press Submit, and about 30 seconds later the board above has moved and the issue is closed with the move spelled out.

Both sides are played by strangers, so a game is usually a relay rather than a duel. Whoever clicks next plays whichever side is to move, and only that side keeps its colour on the board.

  • A captured piece goes to the hand shown beside the board and can be dropped back onto an empty square
  • A move into the last three ranks offers a promotion, and the board asks before it commits
  • A game that will never reach mate ends with Resign; the next one starts with Start a new game
  • Finished games are kept in .github/shogi-log.txt

How it works

scripts/shogi.py is the whole game: the rules, the state in .github/shogi.json, and the renderer that writes the board between the two markers above. .github/workflows/shogi.yml runs it whenever an issue is opened whose title starts with shogi|, then commits the redrawn README and closes the issue.

The board is 81 linked images inside a <pre>. A table cannot be the board: GitHub pads and borders every cell, so the squares read as a spreadsheet, and pre is the only element whose white-space survives GitHub's stripping of style — which is what stops a rank from wrapping and breaking the board on a phone.

The pieces in .github/koma are drawn by scripts/make_koma.py and committed rather than generated on each move, so the check in .github/workflows/checks.yml regenerates them on every pull request and fails if the committed art no longer matches its generator.

This board started on kanywst's profile and moved here so that it could keep going after the profile moved on to something else.

About

Shogi played by whoever turns up. Every move is a GitHub issue and the board is the README.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages