Chess typing practice
A chess board where you never touch the mouse. To move a piece you type a valid command in the programming language you are practising — so a game of chess doubles as a typing drill on the syntax you actually write.
- 14languages to move in
- 3bot strengths
- ELOon online games
How a move is written
Pick a language, then type the move as a command in it. In JavaScript a pawn from e2 to e4 is:
board.move('e2', 'e4');
Castling is written as the king moving two squares — e1 to g1 for kingside — because there is no separate castle command; the engine recognises it and records it as O-O. Promotion takes a third argument naming the piece: q, r, b or n.
board.move('e1', 'g1');
board.move('e7', 'e8', 'q');
The same move in all 14 languages
Pawn e2 to e4, written the way each language would actually write it:
| JavaScript | board.move('e2', 'e4'); |
|---|---|
| TypeScript | board.move({ from: 'e2', to: 'e4' }); |
| C# | board.Move("e2", "e4"); |
| Python | board.move("e2", "e4") |
| Java | board.makeMove(new Move("e2", "e4")); |
| Go | board.Move("e2", "e4") |
| SQL | UPDATE board SET pos = 'e4' WHERE piece = 'e2'; |
| Bash | chess --from e2 --to e4 |
| C and C++ | board.move(Square::E2, Square::E4); |
| Rust | board.move_piece(Square::E2, Square::E4); |
| HTML | <move from="e2" to="e4" /> |
| CSS | piece[from="e2"] { to: e4; } |
| JSON | {"from":"e2","to":"e4"} |
| special characters | e2->e4 |
Why the syntax is checked strictly
Every language keeps its own rules, so the command is only accepted if it would compile. C# and Java reject 'e2' because single quotes mean a char, not a string. SQL rejects "e2" because double quotes mean an identifier. JSON only allows ". Go also accepts backticks. Semicolons are required where the language requires them and optional where it does not.
Who you play
Play a bot at three strengths, a friend on the same keyboard, or someone online. Online games are rated with standard ELO and need an account; everything else works signed out. Each side gets 15 minutes, or you can turn the clock off.