Git Product home page Git Product logo

mancala's Introduction

Mancala

Mancala-Screenshot

Yeap. As you might think, this is yet another game development project of mine. If you haven't done it yet, I highly recommend checking the other ones I have on GitHub:


These were the main goals behind it:

If you want to, you can play with your friends and defy the AI. I should warn you, it's not a good idea.

Play it here

Mancala

Mancala (Arabic: منقلة manqalah) refers to a family of two-player turn-based strategy board games played with small stones, beans, or seeds and rows of holes or pits in the earth, a board or other playing surface. The objective is usually to capture all or some set of the opponent's pieces.

Versions of the game date back past the 3rd century and evidence suggests the game existed in Ancient Egypt. It is among the oldest known games to still be widely played today.

Webworker

Web Workers are a simple means for web content to run scripts in background threads. The worker thread can perform tasks without interfering with the user interface. Once created, a worker can send messages to the JavaScript code that created it by posting messages to an event handler specified by that code (and vice versa).
This is where the AI CPU's heavier usage takes place.

AI

It uses Minimax as artificial intelligence.

Minmax (sometimes Minimax, MM, or saddle point) is a decision rule used in artificial intelligence, decision theory, game theory, statistics, and philosophy for minimizing the possible loss for a worst-case (maximum loss) scenario. When dealing with gains, it is referred to as "maximin" – to maximize the minimum gain. Originally formulated for several-player zero-sum game theory, covering both the cases where players take alternate moves and those where they make simultaneous moves, it has also been extended to more complex games and to general decision-making in the presence of uncertainty.

AI levels

The level of difficulty is pre-determined by how deep the AI tree can be explored. The shallower, the stupider the AI gets. Setting the non-easy levels can get a bit tricky because different factors come into play:

  • It cannot be too difficult
  • It cannot be too easy
  • It can't take too long to explore all leaves
    • Heavily based on target users' devices.

Note that depending on where you're playing it, and how skilled and anxious you are, you can have a completely different experience. A small last disclaimer, if you are too anxious, look for medical treatment.

With no further ado, I have defined:

  • Easy: 0 depth tree
  • Medium: 2 depth tree
  • Hard: 9 depth tree

Tweak these numbers around if you disagree with the ones I came up with. Go crazy.

This is how you would do it

Project Setup

npm install

Compile and Hot-Reload for Development

npm run dev

Type-Check, Compile, and Minify for Production

npm run build

Format

npm run format

mancala's People

Contributors

dependabot[bot] avatar virgs avatar

Watchers

 avatar  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.