Chess is a command-line implementation of the classic board game for two human players. It implements the core rules of chess, including castling and en passant, and supports saving and loading games locally.. The project emphasizes clear object-oriented design and comprehensive move validation.
Although I no longer actively develop this project, I've chosen to preserve it as a snapshot of my early growth in object-oriented software design and rule modeling.
- Two-player command-line chess following the core rules of the game.
- Supports castling and en passant.
- Supports saving and loading games locally.
- Prevents illegal moves, including moves that would leave a king in check.
- Provides descriptive error messages explaining why a move is invalid.
- Validates castling conditions such as attacked squares and obstructing pieces.
- Colorized terminal display using the colorize gem.
- Clear turn-based prompts and descriptive error messages.
- Designed for play in a terminal environment.
- Models the game through classes representing the board, pieces, players, moves, and game state.
- Designed with extensibility in mind, making it straightforward to add additional rules, gameplay features, and computer-controlled opponents.
- Ruby 3.1.0
- YAML
- Colorize gem
Gameplay • Illegal move validation with descriptive feedback.
To run this project locally:
- Clone this repository
- Run
bundle install - Run
bundle exec ruby lib/main.rb
The color scheme may appear differently depending on your terminal configuration. Colors can be customized in the Display class, and String.colors lists all colors available through the colorize gem.
