How gabriellui1/chess works
This is a terminal chess game. The main workflow is command input, state-aware parsing, controller dispatch, move selection, board updates and rule evaluation, followed by text output and score updates. Setup, undo and PGN display are distinct game capabilities; computer opponents provide four difficulty levels. The board also owns move history and exposes observer updates. The README is only a brief TODO list, so it does not document architecture; relationships below are limited to the supplied source excerpts and index references.
Main entry points: GameController.cpp Game controller · Computer.cpp Computer base · PieceFactory.cpp Piece factory · Board.cpp Board and history
Components 19
Game control
- Program entry
main.cpp - Game controller
GameController.cpp - Command parser
CommandParser.cpp - Chess utilities
Helper.cpp - Scoreboard
ScoreBoard.cpp
Chess domain
- Board and history
Board.cpp - Move rules
Rules.cpp - Piece behavior
Piece.cpp - Pawn behavior
Pawn.cpp - Other pieces
Pieces.cpp - Piece factory
PieceFactory.cpp
Players
- Human player
Player.cpp - Computer base
Computer.cpp - Computer level 1
Level1.cpp - Computer level 2
Level2.cpp - Computer level 3
Level3.cpp - Computer level 4
Level4.cpp
Terminal interface
- Text view
TextView.cpp
Other components
- Terminal user
Connections 24
- Program entry → Game controller: runs
main.cpp - Terminal user → Game controller: enters commands
GameController.cpp - Game controller → Command parser: parses input
GameController.cpp - Game controller → Text view: shows output
GameController.cpp - Game controller → Board and history: updates board
GameController.cpp - Game controller → Move rules: checks position
GameController.cpp - Game controller → Human player: selects human
GameController.cpp - Game controller → Computer level 1: creates opponent
GameController.cpp - Game controller → Computer level 2: creates opponent
GameController.cpp - Game controller → Computer level 3: creates opponent
GameController.cpp - Game controller → Computer level 4: creates opponent
GameController.cpp - Game controller → Piece factory: creates setup piece
GameController.cpp - Game controller → Scoreboard: records result
GameController.cpp - Game controller → Chess utilities: formats messages
GameController.cpp - Board and history → Text view: notifies observer
Board.cpp - Piece factory → Pawn behavior: creates pawn
PieceFactory.cpp - Piece factory → Other pieces: creates pieces
PieceFactory.cpp - Computer level 1 → Computer base: specializes
- Computer level 2 → Computer base: specializes
- Computer level 3 → Computer base: specializes
- Computer level 4 → Computer base: specializes
- Computer base → Move rules: uses rules
- Pawn behavior → Piece behavior: inherits behavior
- Other pieces → Piece behavior: inherits behavior