A Ruby-based CLI chess game built as the final project for The Odin Project’s Ruby course, with a strong focus on TDD. This project deepened my understanding of object-oriented design and disciplined Git workflows, and was developed using AI tools like ChatGPT to support iterative problem-solving.
- Two-player CLI chess game
- Validates legal moves
- Detects check/checkmate
- Save/load functionality
- Disciplined Git and testing workflow
Place the opponent's king under attack with no legal move to escape (checkmate).
White is on right! Queen always goes on her color First row: rook, knight, bishop, queen, king, bishop, knight, rook Second row: pawns
- Two players (white and black)
- White moves first
- Players alternate turns
Each side begins with:
- 1 King
- 1 Queen
- 2 Rooks
- 2 Bishops
- 2 Knights
- 8 Pawns
- A piece does not move through other pieces (except Knight)
- It does not capture its own pieces
- It does not put or leave the player's king in threat of capture (check)
- The pawn does not move backward
- On their first move, pawns can move forward 2 squares, after that they can only move forward one square
- The pawn is the only piece that captures diagonally
- Stalemate
- Castling
- En passant
- Pawn Promotion
- Draw by repetition or 50-move rule
- Play against the Qwerty
- Attributes
- 8x8 grid data structure
- Current position of all pieces
- Methods
- Initializes board with pieces
- Moves a piece
- Displays the board in the CLI
Subclasses for each type:
- Attributes
- Position
- Color
- Methods
- Validates moves
- Attributes
- Board
- Players
- Current player
- Game state
- Methods
- Handles main game loop
- Toggles players
- Determines check/checkmate
- Ends game
- Attributes
- Player color
- Player name
- Methods
- Prompts and receives input
Images sourced from the U.S. Chess Federation and used for educational purposes under fair use.