I created an application that allows users to solve chess puzzles by texting 613-704-4683 the following commands:
commands
puzzle
<move> # Examples: "e2e4", "e4", "Qxd8", "Qxd8#" (not case sensitive)
hint
answer
General Conversation Flow
- Start by sending
puzzle
this will randomly select 1 of 500 puzzles for you to solve. - Send your solution. Your move can be in PGN form, or if you're unfamiliar with PGN form you can write the name of the start and end squares
e2e4
which also works. - If you got the answer wrong try asking for a hint by sending
hint
. This will tell you the type of piece you need to move. - If you still can't figure out the answer send
answer
to reveal the answer and end the puzzle. - Only after getting the correct answer or sending
answer
will you you be allowed to access a new puzzle. - Ask for another puzzle by sending
puzzle
The application is a REST API written in Go that provides a callback endpoint for Twilio to send text messages.
The puzzles were created using a dataset from Lichess containing 200,000 games played online. I wanted puzzles that contained a checkmate in one move to keep things simple. So I wrote a Python script to filter out 500 games from high rated players that ended in checkmate. Then I saved the PGN, the last move, who played the last move, and the type of piece used on the last move (this was used to give hints). The puzzles can found in the puzzles.json file.
I would consider the application finished. But there are other features that would be interesting to implement:
- Puzzles that take multiple moves to solve
- Playing a full chess game with an opponent or engine.