Giter VIP home page Giter VIP logo

barannmeisterr / mangala-board-game Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 14 KB

Mangala is a Turkish strategy game played by two players. The game board consists of 12 small pits, 6 for each player, and a large storehouse where each player collects their stones. The game is played with a total of 48 stones.

License: MIT License

Java 100.00%
adjacency-matrix array-manipulations dfs-algorithm directed-graph java mancala-game mancala-java mangala-mind-game mangala-zeka-oyunu oop stack

mangala-board-game's Introduction

Mangala/Mancala Board Game

Mangala is a Turkish strategy game played by two players. The game board consists of 12 small pits, 6 for each player, and a large storehouse where each player collects their stones. The game is played with a total of 48 stones.

Players distribute the 48 stones evenly, with 4 stones in each pit. Each player's side consists of 6 pits, and their opponent's side is directly opposite. Players aim to collect the most stones in their storehouse by the end of the game.

The game starts with player 1. The player 1 starts by selecting any of their pits and taking 4 stones from it. They then distribute these stones one by one in a counter-clockwise direction, placing one stone in each pit until they run out of stones. If a stone lands in their storehouse, the player gets another turn. If a player's pit has only one stone, they can move that stone to the adjacent pit on their side. Then it's the opponent's turn. The fate of the game depends on the last stone remaining in a player's hand.

During their turn, if a player still has stones in their hand after distributing them in their own pits, they continue distributing stones into the opponent's pits. If a stone lands in a pit on the opponent's side and the total number of stones in that pit becomes even (2, 4, 6, 8, etc.), the player collects all the stones in that pit and adds them to their storehouse. Then it's the opponent's turn.

If, while distributing stones, the last stone in a player's hand lands in one of their own empty pits, and the opposite pit on the opponent's side contains stones, the player collects the stones from the opponent's pit and the stone they placed in their empty pit, adding them all to their storehouse. Then it's the opponent's turn.

The game ends when one player's pits are empty. The player whose side is emptied first also collects all the stones from the opponent's side. Thus, the dynamics of the game remain intense until the very end.

Author

  • Arda Baran

Features

  • The game can be played by two player
  • The game take pit number inputs from players.
  • The game starts with player 1. The player 1 starts by selecting any of their pits and taking 4 stones from it. They then distribute these stones one by one in a counter-clockwise direction, placing one stone in each pit until they run out of stones. If a stone lands in their storehouse, the player gets another turn. If a player's pit has only one stone, they can move that stone to the adjacent pit on their side. Then it's the opponent's turn. The fate of the game depends on the last stone remaining in a player's hand.
  • During their turn, if a player still has stones in their hand after distributing them in their own pits, they continue distributing stones into the opponent's pits. If a stone lands in a pit on the opponent's side and the total number of stones in that pit becomes even (2, 4, 6, 8, etc.), the player collects all the stones in that pit and adds them to their storehouse. Then it's the opponent's turn.
  • If, while distributing stones, the last stone in a player's hand lands in one of their own empty pits, and the opposite pit on the opponent's side contains stones, the player collects the stones from the opponent's pit and the stone they placed in their empty pit, adding them all to their storehouse. Then it's the opponent's turn.
  • The game ends when one player's pits are empty. The player whose side is emptied first also collects all the stones from the opponent's side. Thus, the dynamics of the game remain intense until the very end.

Technologies And Data Structures Used

  • Java
  • Directed Graph
  • Array
  • Two Dimensional Array For Adjacency Matrix
  • Stack Array Implementation
  • DFS Algorithm
  • Scanner
  • Object Oriented Programming
  • switch-case

File Structure

  • src/: Contains the Java source code

mangala-board-game's People

Contributors

barannmeisterr avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.