How ilyaan-umatia/eater-passer-game works
Project Type and Purpose
• This is a single‐executable, console‐based C program implementing a two‐player strategy board game (“Eater and Passer”).
• It is neither a client/server nor a multi‐service system—it’s a monolithic, command‐line application demonstrating game logic, board state management, player input, and AI strategies.
High-Level Architectural Components
A. Game Controller
• Orchestrates the main game loop
• Invokes input, state update, win‐check, and rendering
B. Board State Manager
• Maintains the 2D array representing the board
• Provides functions to initialize and update cells
C. Player Input Handler
• Reads and validates human moves from stdin
D. AI Strategy Module
• Implements two strategy submodules:
– RandomPlayer (random valid move)
– StraightLinePlayer (greedy top‐to‐bottom path)
E. Win Condition Checker
F. Console Renderer
• Renders the 2D board array in the console after each move
Relationships and Data Flows
• The Game Controller sits at the center.
• It first calls the Board State Manager to initialize the board.
• In each turn:
a. Game Controller → Player Input Handler or AI Module (based on whose turn)
b. Player Module → Game Controller (returns chosen move)
c. Game Controller → Board State Manager (apply move)
d. Game Controller → Win Condition Checker (check for victory)
f. Loop until Win Condition Checker signals game end
Architectural Patterns and Principles
• Single Responsibility: each module has a well‐defined role (e.g., rendering vs. logic).
• Strategy Pattern (informal C‐style): the AI Strategy Module can swap in different “player” implementations without touching the Controller.
• Data Encapsulation: the Board State Manager abstracts the underlying 2D array.
Technologies and Key Constructs
• Language: C
• Data Structure: 2D array for board representation
• Control Flow: main game loop, switch between human and AI turns
• I/O: printf/scanf (or similar) for console I/O
• Algorithms: DFS/graph‐search or greedy pathfinding for win check and StraightLinePlayer