This project is a Java-based implementation of the classic board game Risk. Risk is a strategy game where players aim to conquer the world by controlling armies and engaging in battles. This implementation focuses on providing a robust and interactive command-line version of the game, allowing players to experience the strategic depth and excitement of Risk.
- Turn-based Gameplay: Players take turns to deploy armies, attack territories, and fortify positions.
- AI Opponents: Play against computer-controlled opponents with varying levels of difficulty.
- Save/Load Game: Save your progress and load previous games.
- Command-line Interface: Intuitive CLI for interacting with the game.
- Detailed Logging: Game events are logged for review and debugging.
-
Clone the repository:
git clone https://github.com/gursimran2407/Risk_Game_Java.git cd Risk_Game_Java -
Compile the project:
javac -d bin src/*.java -
Run the game:
java -cp bin Main
-
Starting a New Game:
- Run the
Mainclass. - Follow the on-screen prompts to set up the game, including the number of players and their types (human or AI).
- Run the
-
Gameplay:
- Players take turns to perform actions: deploy armies, attack territories, and fortify positions.
- Enter commands as prompted by the CLI.
-
Saving and Loading:
- Save the game state using the
savecommand. - Load a saved game using the
loadcommand followed by the filename.
- Save the game state using the
- Objective: Conquer all territories on the map or achieve specific mission objectives.
- Setup: Players start with a set number of armies and territories.
- Turn Phases:
- Reinforcement: Deploy new armies to controlled territories.
- Attack: Engage in battles to conquer new territories.
- Fortification: Move armies between controlled territories to strengthen positions.
- Combat: Dice rolls determine the outcome of battles, with attackers and defenders rolling dice based on their army sizes.
- Main Class: Entry point of the game.
- Game Engine: Manages game state, player turns, and game logic.
- Player Class: Represents a player (human or AI).
- Territory Class: Represents a territory on the map.
- Command Parser: Interprets and executes player commands.
- Logger: Logs game events for review.
-
Fork the repository: Click the 'Fork' button on the top right corner of this page.
-
Create a new branch:
git checkout -b feature-branch
-
Make your changes:
- Ensure your code follows the project's coding standards.
- Include appropriate tests.
-
Commit your changes:
git commit -m "Description of your changes" -
Push to your branch:
git push origin feature-branch
-
Create a Pull Request: Submit your pull request from your fork's branch to the main repository's
masterbranch.
This project is licensed under the MIT License. See the LICENSE file for more details.