ThreeMusketeers
Two Player
Turn-Based Game
Overview
This version of ThreeMusketeers extends beyond the traditional ThreeMusketeer board game. In this thrilling battle, one player takes control of the three musketeer pieces, while the other player commands the remaining enemy pieces.
The objective of the game is clear for both players: the musketeer player aims to strategically move their three musketeer pieces to capture all enemy pieces, while the enemy player seeks to outmaneuver the musketeers and prevent their capture.
In this version of the game, more customization is added to the game, and a new AI agent is introduced. Moreover, move undo and redo functionalities are added to the game, as well as board creation, saving and loading, theme selection, and more.
Details
Features and Functionality
- Intuitive gameplay with a user-friendly interface, allowing smooth navigation, piece movement, and turn-based interactions.
- Two-player mode featuring strategic gameplay, where one player controls the three musketeer pieces and the other player controls the rest of the enemy pieces.
- Unique movement rule for the musketeer pieces, requiring adjacent enemy pieces for a valid move during their turn.
- Win conditions based on capturing all enemy pieces or ensuring the musketeer player cannot make a valid move.
- AI-controlled opponent with two modes: Random mode selects legal moves randomly, while Greedy mode employs the minimax algorithm with alpha-beta pruning to make optimal moves.
- Save and load functionality for game boards, enabling players to store and retrieve game progress in text file format, ensuring convenience and continuity in gameplay sessions.
Design
ThreeMusketeers is meticulously designed with a strong emphasis on Object-Oriented Programming (OOP) principles, enabling a modular and extensible structure. The game leverages the power of OOP to encapsulate game elements into classes, promoting code reusability, maintainability, and flexibility.
Furthermore, ThreeMusketeers showcases intelligent gameplay through the integration of AI elements. The game incorporates a sophisticated AI algorithm based on the minimax algorithm with alpha-beta pruning. This AI feature adds depth and challenge to the gameplay, as it strategically evaluates and selects optimal moves to compete against players. By implementing AI, ThreeMusketeers provides an engaging experience for both casual players and those seeking a more formidable opponent.
GUI Interface
Implementation of a Model-View-Controller (MVC) pattern for game interaction, ensuring seamless user experience and efficient communication between game components
AI Opponent
Utilizes a minimax algorithm with alpha-beta pruning to create a challenging opponent with a dynamic difficulty level
Scene Management
Utilizes a strategy pattern to manage scenes and their transactions, allowing for dynamic and intuitive gameplay
Customizable Themes
Offers a builder pattern for creating themes with adjustable properties, enabling players to personalize their gaming environment
Flexible Cell Construction
Implements a builder pattern for cells, enhancing customizability and supporting various game mode variations
Move Command System
Utilizes a command pattern for manging game moves, enabling undo and redo functionality for strategic decision-making
Undo/Redo Capability
Implements an iterator pattern to support undo and redo functionality, allowing players to navigate through move history and revise their gameplay
Concise Cell Building
Utilizes a template method for streamlined cell construction, ensuring consistent functionality and reduce code complexity.
Resizable Components
Implements a composite pattern for making JavaFX components resizable, providing responsive and adpatable user interface
Board Saving and Loading
Utilizes a serialization pattern to save and load game boards, allowing players to save their progress and resume gameplay
Technologies
Responsibilities
- Created documentation for the project, including the requirements, design, and testing documents
- Implemented the undo and redo functionality using the command pattern
- Implemented a turn count visualizer using the iterator pattern
- Implemented the AI opponent using the minimax algorithm with alpha-beta pruning
- Implemented the save and load functionality using the serialization pattern
- Implemented the GUI interface using the MVC pattern