Java implementation of Mancala with Kalah and Ayo rule variants, a Swing GUI, and save/load profiles.
- Two rule sets: Kalah and Ayo
- Swing-based graphical interface
- Save and resume games via player profiles
- Custom exceptions for invalid moves and game-state errors
- Modular OOP design (Board, Pit, Store, Player, Game, Rules)
The code represents a basic implementation of the Mancala game in Java. It consists of five classes which each have their own duties: Board, MancalaGame, Pit, Player, and Store. For example, the Board class creates the Mancala board with pits and stores, allowing players to make moves, distribute stones, and check the game's status. Moving on, the MancalaGame class manages the game, players, and their interactions with the board. Next, the Pit class represents individual pits on the board, keeping track of stone counts. Furthermore, the Player class defines player attributes, including their name and associated store. Lastly, the Store class is responsible for storing stones and keeping track of the player owner. Overall, the code works together to make a functional Mancala game, including moves, captures, and win conditions, and error handling is also implemented.
- JDK 17 (other versions may not be compatible)
- Gradle
gradle build
java -cp build/classes/java/main ui.MancalaUIsrc/main/java/
├── mancala/ # Game logic, rules, and data structures
└── ui/ # Swing user interface
assets/ # Images and resources
config/ # Build configuration
Sukhman Dhaliwal