Welcome to the ThreeTrios game! This project allows users to create, configure, and play a highly customizable card-based strategy game. The game supports multiple player types, including human and AI players, with strategies tailored for competitive gameplay.
- Game Overview
- Creating a Customizable Game
- How the Game Works
- Executing the Game
- Player Types
- AI Strategies
ThreeTrios is a strategy game where players take turns placing cards on a grid to gain points by flipping opponent cards. The game ends when no valid moves remain, and the player with the most flipped cards wins.
The game can be configured using external configuration files, making it easy to customize gameplay mechanics and rules.
To customize the game, follow these steps:
-
Locate Configuration Files:
- Configuration files are located in the
docsdirectory.board.config: Defines the board size and layout.card.database: Specifies available card types, values, and attributes.
- Configuration files are located in the
-
Edit Configuration Files:
- Open
board.configto adjust the board dimensions. The first line should define the dimensions of the board, and the rest of the file should define the board layout, an 'X' being a hole and a 'C' being a place a card can be placed.Example:3 3 CCC CXC CCC - Edit
card.databaseto define card attributes. The format is as follows, NAME NORTH-VALUE EAST-VALUE SOUTH-VALUE WEST-VALUE Example:CorruptKing 7 3 9 A
- Open
-
Save Changes:
- Ensure all changes are saved in the respective configuration files.
-
Setup:
- The game initializes based on
board.configandcard.database. - Players receive a hand of cards to place on the board.
- The game initializes based on
-
Gameplay:
- Players take turns placing cards.
- When a card is placed, it may flip adjacent opponent cards if the placed card’s values dominate.
-
Winning Condition:
- The game ends when no valid moves remain or the turn limit is reached.
- The player with the most flipped cards wins.
To execute the game, follow these steps:
-
Build the JAR File:
- Ensure the project is compiled and packaged into a JAR file (e.g.,
ThreeTrios.jar).
- Ensure the project is compiled and packaged into a JAR file (e.g.,
-
Run the Game:
- Use the following command to start the game:
java -jar ThreeTrios.jar PLAYER1 PLAYER2 - Replace
PLAYER1andPLAYER2with the desired player types (e.g.,human,strategy1,strategy2).
- Use the following command to start the game:
-
Example:
- To play a game with one human and one AI using the "Flip The Most" strategy:
java -jar ThreeTrios.jar human strategy1
- To play a game with one human and one AI using the "Flip The Most" strategy:
- Description: Human players interact with the game via a graphical or text-based interface, manually selecting card placements.
- Description: AI players automatically decide their moves based on predefined strategies. This allows for dynamic and competitive gameplay without requiring human input.
- Purpose: Maximizes the number of opponent cards flipped in a single turn.
- Mechanics:
- Evaluates all possible moves.
- Chooses the move that flips the maximum number of cards.
- In case of a tie, selects the uppermost-leftmost position and the first card in hand.
- Purpose: Prioritizes placing cards in board corners to minimize the chance of being flipped.
- Mechanics:
- Identifies corner positions.
- Selects the move that minimizes risk based on opponent card values.
- Resolves ties by selecting the uppermost-leftmost position and the first card in hand.
Enjoy customizing and playing ThreeTrios!