GithubHelp home page GithubHelp logo

ctf's Introduction

CTF

Program your robot tank to capture the flag and destroy other tanks in this turn-based strategy game in Elixir! You have only a few milliseconds to make a decision, so don't spend too much time computing your move.

Requirements

Game Rules

  • Players are automated, no human input is allowed! (aside from the code)
  • On each turn, each player has (maximum) three action points and may allocate them among three action types:
    • Move forward n squares (move: n)
    • Rotate clockwise or counterclockwise 90 degrees n times (clockwise: n, counterclockwise: n)
    • Fire forward n squares (fire: n)
  • After actions are decided and validated, player tanks perform the actions simultaneously in lock-step. Collisions damage both tanks and nullify the movement command.
  • Players have 5 health points, which are diminished by enemy fire and collisions.
  • The first player to reach the enemy flag wins! Even if your player incapacitates the other player, you must get to their flag.

Some example turns might be:

# Move forward twice, rotate clockwise once
[move: 2, clockwise: 1]

# Fire at opponent 3 squares away
[fire: 3]

# Invalid turn, only first three actions used. 
# Essentially the same as the first turn above.
[move: 2, clockwise: 2]

Defining Your Player

To define your player, you must implement a module with the following behaviour:

defmodule Ctf.Player do
  # Some types used in the callback definition
  @type state() :: any()
  @type actions() :: [move: 1..3, rotate: 1..3, fire: 1..3]

  # Implement this function!
  @callback turn(Game.t(), Player.t(), state()) :: {actions(), state()}
  
  # Name your player (optional, defaults to the module name)
  @callback name() :: String.t()
  
  @optional_callbacks [name: 0]
end

ctf's People

Contributors

alanvoss avatar

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.