Inspiration
We were having trouble with an idea to come up with at the beginning of this hackathon, but Terence had for a long time wanted to build a method for him to play mental chess with his google home. We decided to build that, and learned a lot along the way.
What it does
Mental Chess allows the user to play a mental game of chess with it. It takes user input in the form of speech through dialougeflow's interface, and uses stockfish (an open source chess engine) to analyze the state of the board and reply with a move. This is then sent back through dialougeflow where the google home tells the user the move that was just made.
The multiplayer functionality functions in a similar way, however, instead of stockfish analyzing the board, the google home performs the move and listens for the input of a second user.
Games either end with stalemates or checkmates for either side (the google home or you).
How we built it
We built it using the google home SDK, dialougeflow and a backend web server written using python and flask, which functioned as an event loop listening for data from the google home, interacting with stockfish for an opposing move and then returning the necessary response to google home. This is all done using the UCI (Universal Chess Interface) protocol.
The current state of the board is saved as in FEN (Forsyth–Edwards Notation) format, in a separate database and overridden after every move. This allows the board to switch states between each move and maintain the flow of the game.
Challenges we ran into
- Understanding FEN notation
- Flask is blocking and synchronous, and since using asynchronous is both complex and beyond the scope of the time we had to complete the project after we realized its importance required us to structure our code in such a way that it would remain efficient and work as expected, while taking advantage of flask's functionality.
- Understanding how the dialougeflow worked, and writing training data for the google home machine learning api so it would understand our commands as natural speech.
- Getting multiplayer to work.
What we learned
- Flask
- Api.ai/Dialougeflow
- How very good and very bad sides of python.
- A lot about chess.
What's next for blindChess
- Polishing up the app and building a difficulty system for it.
- Fixing multiplayer to be less buggy.
- Dealing with certain irritating edge cases that glitch out our app.
Log in or sign up for Devpost to join the conversation.