Giter VIP home page Giter VIP logo

risk-game's Introduction

Risk-Game

Risk is a strategic board game, where two or more players tend to dominate the whole map using their troops.

This project is an online simplified version of the game, we allow only two players in every game, we also skip fortifying step.

At the beginning, the user choose which two agents should play the game from the following options:

  • Human Agent, where the user plays himself.
  • Passive Agent, that only deploys, but never attacks.
  • Aggressive Agent, that takes extreme choices.
  • Nearly Pacifist Agent, that plays safe moves.
  • Greedy Agent, that examines all possible moves and play the local best one.
  • A* Agent, that runs A* search for every turn to find the best move.
  • Real-time A* Agent, that does a search of depth one only.
  • Minimax Agent, that assumes optimal moves for opponent, and act upon it.

How it works

The client sends an AJAX request upon starting the game carrying the user choices of map and agents, which is validated by the view module, it then invokes the controller to create the model(Game, Node, Agent..etc.) if it is valid, and asynchronously render the map.

A WebSocket (Django channels) is opened after initial render is complete, allowing the server consumer the send initial random distribution of troops and territories.

The controller keeps track of the game turns, and calls Deploy and Attack functions for every agent in it's turn.

Rendering the new view after every update in the model, is done by few message passing between client and server consumer, except for the case of Human Agent, where the process of message passing is reversed in terms of order.

The controller checks for the winning state after every turn, and terminates the model, and send a winning message in the case of winning.

Technologies

  • Django 2.1.2
  • Django Channels 2.1.5
  • Jquery 3.3.1

Screenshots

ScreenShot1 ScreenShot2 ScreenShot3

risk-game's People

Contributors

ahmedhammad97 avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

amr17 caesar-blip

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.