Skip to content

arjun120/war-card-game

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Table of Contents
  1. About The Project
  2. Getting Started
  3. Potential Improvements / Alternative Design Choices
  4. Contact

About The Project

Product Screen Shot Product Screen Shot

War is a card game with it's simplest version played between two players. The rules for this implementation can be found here. You can read up more about the game here.

Built With

The major frameworks/libraries used in this project are as listed below:

  • Flask
  • React
  • MySQL

Getting Started

Prerequisites

The backend flask server and mysql server are dockerized to run in two containers. Prior to setting up and running the backend and mysql server, make sure you have docker and docker-compose installed and setup. The installation guide for the docker engine can be found here. Docker-compose is installed with the desktop version of docker engine, you can visit this page for more information. Follow the instructions on these pages carefully and verify the installation and the version at the end.

For the frontend, make sure Node and NPM are installed on your computer. You can download both at this link (NPM is included in your Node installation).

Note: The following commands and installation steps have been tested on MacOS.

Installation

Once you have verified docker-compose and npm are installed and working correctly, you may first proceed to build and run the backend and database services.

  1. Clone the repo
    git clone https://github.com/arjun120/war-card-game.git
  2. cd war-card-game
  3. Here, you can use docker-compose to build the images and start the containers for the backend and SQL db.
    docker-compose up -d
  4. The endpoint to your backend Flask server is exposed on port 4000.
  5. Now that your backend and db services are up and running, you can run the frontend React server.
  6. cd war-ui
  7. Now, install NPM packages using
    npm install
  8. Now, if your backend is running on 127.0.0.1 that is localhost if you ran your containers locally, you can start the react server using the following command:
    REACT_APP_BACKEND_IP=127.0.0.1 npm start
    Replace the 127.0.0.1 with the DNS of the container depending on where your backend service is running.
  9. Now, you have successfully installed and run the war game. You should be able to access the game at http://localhost:3000/.

Potential Improvements / Alternative Design Choices

  1. The backend for this project currently simulates the game between two players. This could be extended to accommodate more players by adapting to a different version of the game. Currently a variation of the regular version is implemented to handle and avoid infinite sessions of the game. The current fix includes declaring the game as a draw in case the number of cards in each players deck toggles between two fixed values for a threshold number of rounds. While this variation is a reasonable fix, alternate versions could be explored.
  2. The backend and db for this game have been dockerized and packaged as a unit which can be brought up and down easily. The UI is a separate service, which runs independently. While this decoupling was a design choice, the three services could be dockerized and brought up finally exposing only the UI to the users. These services could also be deployed and orchestrated using tools such as Kubernetes on a cloud platform.
  3. Finally, the UI could be improved to show the cards in play dynamically. However, observing the number of rounds these games typically last for, this may not be viable. Other improvements such as beautification of the UI could be potential directions to explore.

Contact

Arjun Manjunatha Rao | LinkedIn | email

Project Link: https://github.com/arjun120/war-card-game

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published