Git Product home page Git Product logo

mancala's Introduction

Mancala Game

This project is an implementation of Mancala game using Java.

Technologies Used

  • Java 11
  • Spring Boot 2
  • Spring Data JPA
  • MySQL - For game persistence
  • Caffeine - In-Memory Cache
  • Swagger - For API Docs
  • Flutter - For UI
  • JUnit5
  • Mockito
  • H2 database - For test cases
  • JaCoCo - For Code Coverage

Features at a Glance

  • Two player game
  • Well covered test cases with 85% coverage
  • Game UI designed with Flutter Web. Can be easily ported to mobile application as well with the same code
  • Option to continue any abandoned game
  • REST API based game

Configurations

  • Both the number of pits and initial number of coins in each pit are configurable from properties

Assumptions

  • Cache is coded to an interface. It can be easily replaced with a distributed cache in the future
  • Cache layer is designed with the assumption that there is only one app server. When this application is horizontally scaled with multiple app servers, a timestamp based cache invalidation strategy or a distributed cache should be used.
  • Ambiguity : In the current design, if a player inserts his last coin in his own empty pit, he will steal his coins and opponents coins and puts in his large pit. In some versions of Mancala, stealing is not allowed if the opponent's pit is empty.

Future Improvements

  • Right now, the jacoco code coverage is 85%. In future, it can be improved to 95 - 100%
  • Undo, Redo of moves can be added
  • Hints can be shown to user to assist him in making better moves
  • Computer can be made as opponent in the place of another human
  • Number of pits and the initial number of coins in each pit can be configurable while creating a game
  • Containerization of deployment can be done
  • CI/CD with Travis can be done

To Build

Server Dependencies:

  • OpenJDK 11
  • MySQL 8. Username and password are configurable in properties
  • MySQL CLI client

Client Dependencies:

  • Python 2 or Python 3 to server the html content

To Run

Server

  • Run the SQL Command create database mancala;
  • Switch to project directory on terminal
  • ./mvnw clean install
  • cd target/
  • java -jar mancala-0.0.1-SNAPSHOT.jar

Client

  • Switch to project directory on terminal
  • cd web/
  • python -m SimpleHTTPServer 8000 if python 2 is installed (or)
  • python -m http.server 8000 if python 3 is installed
  • Game can be played by visiting the url http://localhost:8000

API Docs

Architecture

Architecture

UI

UI

mancala's People

Contributors

praveen-erramilli 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.