Two players face each other on a square board with n
rows and n
columns, where n
is an even integer. By default, n=8
.
- Queen: Moves orthogonally or diagonally to an empty square, provided all squares between the starting and ending positions are empty (like a chess queen, but without capturing opposing pieces).
- Rook: Moves orthogonally to an empty square, provided all squares between the starting and ending positions are empty (like a chess rook, but without capturing opposing pieces).
- Each player starts with:
- 1 queen.
n² // 4 - 1
rooks.
- After a rook moves, it can capture opposing rooks if it forms a rectangle with its queen.
- Captures only occur when:
- The moved rook and the queen of the same player form two vertices of a rectangle.
- Opposing rooks are located on one or both of the other vertices of this rectangle.
- Queens cannot capture, and they cannot be captured.
- A player loses when they have two or fewer pieces left (queen and rooks combined).
The game is implemented in Python with the Tkinter graphics library. Object-oriented programming principles and encapsulation must be strictly followed.
-
Player
Class:- Attributes: Coordinates of the player's queen, number of remaining pieces.
-
Game
Class:- Attributes: A 2D list modeling the game board and other necessary attributes.
- Board Customization:
- Choice of board size via a menu (
n
must be even and between 6 and 12).
- Choice of board size via a menu (
- Game Display:
- Visualization of the grid and pieces.
- Indication of the current player's turn.
- Piece Selection:
- Players select a piece to move using the mouse.
- Selected pieces are visually highlighted (e.g., with a circle).
- Movement and Captures:
- Enforce movement and capture rules.
- Turn Management:
- Alternation of turns between players.
- Victory Condition:
- Detect and display the winner.
- End of Game:
- Show results and offer the option to start a new game.
- The application must decouple algorithmic logic (game rules and board management) from graphical logic (display and event handling).
The following optional features provide additional functionality:
- Move Preview:
- Highlight playable moves for the selected piece.
- Save and Load Game:
- Save the current game state to a text file and resume it later.
- Visual and Sound Effects:
- Add animations and sounds for movements and captures.
- AI Mode:
- Play against the computer, either with random moves or an intelligent algorithm.
- Clone the repository:
git clone <repository_url>