A fully functional chess game that can be played in a terminal.
Final assignment for the Ruby section of The Odin Project.
Spec and details for the assignment can be found here.
Play online on replit
- Various modes - play vs a friend, vs the computer or watch the computer battle itself
- Save and load your game
- Sophisticated artificial intelligence*
- Gorgeous unicode graphics
- Beautiful blue and gray chessboard
* May not actually be sophisticated or intelligent
To play online, go here.
To play locally, you must have Ruby installed. See here for more details. This program was written in Ruby 2.7 but is backwards compatible to at least Ruby 2.5.
If you have Ruby installed, clone this repository, navigate to the top level folder and type ruby main.rb in your terminal, then follow the in game instructions.
To run the tests you must have rspec installed. More info on rspec can be found here. These tests were written using rspec 3.9. Execute the tests by simply typing rspec in your console in the top level folder.
Written with the community ruby style guide. See the .rubocop.yml file for specific tweaks.
A more complete list can be found at the project board here.
- Improve UX feedback - why a move failed (invalid move, you are in check etc)
- Improve saving system (more files, custom naming)
- Improve clarity of board / pieces
- Various refactorings - particularly en passant, castling, and reducing size of ref and round classes
- Increase test coverage
- More unit tests
- Integration testing?
- A Puzzle mode - mate in 3 etc
- Smarter AI
- It is possible to put yourself in check while doing an en pasasnt move, leading to an illegal board state. This will raise an exception.
The hardest and most complex project I've worked on to date. Difficult both for the depth and breadth of problems to solve, and then integrating those various solutions together in a clean and modular way. Managing the bloat and cruft from various little experiments, or implementations that needed to change after realising they would need to change because of an edge case was a challenge. While I put quite a lot of thought into planning my overall design, which was a useful exercise, there were a lot of things that only became obvious after encountering / working through them.
I definitely see the value of keeping systems as modular as possible, as the parts that were entangled became very difficult to make even small changes on as the project grew in size. Likewise testing discipline is important for being able to make changes and refactor safely.
On the whole a great project and a lot of lessons learned.
ChargrilledChook#7159 on discord 🐔