Giter VIP home page Giter VIP logo

battle-bots's Introduction

Battle bots

Set up arenas, connect bots and let them do battle

Prerequisites

You will need Leiningen 2.0.0 or above installed.

Running

To start a web server for the application, run:

lein ring server

Then go to localhost:3000 to start

Integration with bots

Before any games can be run, they need an arena. This can be done via the frontend. Provide a name, the amount of rounds and the game. Different games have different rules, but all expect that each contenstant provides an endpoint that can recieve POST requests and which returns it's next move. Each round consists of the server sending the current state to each contenstant, after which it collects all responses and updates the score. Each contenstant will recieve a JSON object like the following (assuming that you are "contenstant 1"):

{
  "you": "id1",
  "state": [
    {"id": "id1", "name": "contenstant 1", "score": 12, "move": "paper"},
    {"id": "id2", "name": "contenstant 2", "score": 2, "move": "paper"},
    {"id": "id3", "name": "contenstant 3", "score": 5, "move": "rock"},
  ]
]

Which means that in last round players 1 and 2 played "paper", while player 3 played "rock". The previous round resulted in player 1 having 12 points, player 2 2 points and player 3 5 points.

If a player returns an invalid value, that player will be skipped during that round

Available games:

Rock, paper, scissors

During each round, each player shows one of rock, paper or scissors. Then the winner is last single player standing after the following eliminations:

  • any player that plays paper loses if any other player played scissors
  • any player that plays scissors loses if any other player played rock
  • any player that plays rock loses if any other player played paper

The only valid moves are "rock", "paper" or "scissors" - any other values result in a player automatically losing a given round. For testing, there is and endpoint (/rock_paper/random) which randomly returns one of the above values.

Iterated prisoner's dilemma

Each player can either "help" or "cheat". Then the following rules apply:

  • if both help, they both get 2 points
  • if both cheat, the both get 1 point
  • if one cheats and the other helps, then the cheater gets 5 points, while the helper 0

For testing use:

License

Copyright © 2018 FIXME

battle-bots's People

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.