Giter VIP home page Giter VIP logo

hackathonsose24's Introduction

BitWars Player Rust

Your task is to implement the best bitWars player logic! :)

Preparation

  1. Choose a team name (BitBattler?)
  2. Fork this repository
  3. Add the following secret:
    • TOKEN (value will be provided by the facilitator)
  4. Add the following variables:
    • NAMESPACE (value will be provided by the facilitator)
    • TEAMNAME (your team name - only lowercase letters, digits and dashes, must start with a lowercase letter)
  5. Run the main workflow in GitHub - it will be deployed automatically
  6. Notify the facilitator once you are done :)

How it works

Run it locally

Run the player directly:

cargo run

or build an executable:

cargo build
./target/debug/player-Rust

Functionality

This application template provides a HTTP server with a single POST endpoint (/) on port 3000. The bit-dealer sends a POST request containing the current game state as a JSON object. Your task is to implement a function which returns a PlayerAction as a response. You'll find a predefined function decide() in this file: /logic/strategy.rs. In this file you can add unit-tests to quickly debug your application locally. Run all unit-tests with the following command (executed in the root path of this project):

cargo test

Example Request Body

{
   "actions":[
      {
         "uuid":"52c3866e-4481-41ac-8470-cac378788567",
         "player":1002,
         "src":1,
         "dest":2,
         "amount":1,
         "progress":{
            "distance":4,
            "traveled":4
         }
      }
   ],
   "bases":[
      {
         "uid":1,
         "player":1001,
         "population":2,
         "level":0,
         "units_until_upgrade":0,
         "position":{
            "x":0,
            "y":0,
            "z":0
         }
      },
      {
         "uid":2,
         "player":0,
         "population":7,
         "level":1,
         "units_until_upgrade":0,
         "position":{
            "x":3,
            "y":-3,
            "z":0
         }
      },
      {
         "uid":3,
         "player":0,
         "population":12,
         "level":1,
         "units_until_upgrade":0,
         "position":{
            "x":3,
            "y":3,
            "z":0
         }
      }
   ],
   "config":{
      "base_levels":[
         {
            "max_population":20,
            "upgrade_cost":1000,
            "spawn_rate":1
         },
         {
            "max_population":40,
            "upgrade_cost":1000,
            "spawn_rate":2
         },
         {
            "max_population":80,
            "upgrade_cost":1000,
            "spawn_rate":3
         },
         {
            "max_population":100,
            "upgrade_cost":1000,
            "spawn_rate":4
         },
         {
            "max_population":200,
            "upgrade_cost":1000,
            "spawn_rate":25
         }
      ],
      "paths":{
         "grace_period":10,
         "death_rate":1
      }
   },
   "game":{
      "uid":1,
      "tick":17,
      "player_count":3,
      "remaining_players":3,
      "player":1
   }
}

Start the game

Now it's your turn! Start implementing the Strategy function to do more than just do nothing every turn. Or rework the whole application. You can do what you want, as long as you provide the endpoint that is registered in the game. Have fun!

Rules

More Infos: https://bitwars.de/

hackathonsose24's People

Contributors

imd0odo avatar

Watchers

 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.