Version 5, last updated by jcbozonier at July 26, 2008 10:45 UTC

Overview

NOTE: Special thanks to Justin Wilcox and the Boulders OSS for providing a lot of inspiration. http://www.assembla.com/wiki/show/boulders

The contest consists of up to three separate apps.

  • TheOctagon- This is the app that runs on the client and consumes the rock, paper, scissors (aka RPS) bots’ data.
  • Contestant 1- a bot exposed via a REST/JSON web service.
  • Contestant 2- a bot exposed via a REST/JSON web service.

The bot with the most wins at the end of the match wins. Points are assigned as follows:

  • Wins (1 point): Rock beats Scissors, Scissors beats Paper, Paper beats Rock, Dynamite beats all and ties with Dynamite.
  • Draws (0 points): Contestants both throw the same value (“rock” | “paper” | “scissors” | “dynamite”). The first player to win after a draw or series of draws gets a point for each draw in the series.
    • Example: If contestants 1 and 2 each throw rock 5 times in a row and then contestant 1 wins the next round, contestant 1 earns 6 points and contestant 2 earns none.
  • Losses (0 points): If not a win or draw it’s a loss.

NOTE: If your bot throws an exception you will be disqualified from the match.’’

NOTE: You only get enough dynamite to be used on 5% of the rounds. So for 250 rounds you will only get 12 sticks of dynamite. If you try to use dynamite when you don’t have any you will lose that round.

To use TheOctagon, first enter the URI of both of the contestant bots with no trailing slash.

examples of some valid bot URIs: http://10.215.32.220:8080/contestant1 or http://10.215.32.220:8080/bots/contestant2. If you experience issues with using localhost as your domain (specifically Django users) use your ip address instead.

Tournament Psuedo Logic

  1. Enter URIs for all contestants.
  2. Push them onto contestant stack.
  3. Call introductions for all contestants.
  4. if there is only one contestant alert winner else..
  5. Spawn a thread for each pair and run their game.
  6. onComplete gather the URIs of the winners and push them onto contestant stack.
  7. Goto step 3

Web Service API

Given a URI of something similar to http://10.215.32.220:8080/contestant1 TheOctagon expects the following:

http://10.215.32.220:8080/contestant1/introductions

  • HTTP Action: POST
  • Purpose: Introduces your bot to TheOctagon.
  • Parameters Expected:
    • data
      • Properties
        • Name- id, Type: String; ex. “contestant1”; Description: The contestant’s id.
        • Name- round_count; Type: Number, ex. 250; Desc: The total number of rounds in the game.
    • There is only one param “data” and it is a JSON string. That string contains the constestant’s identifier (whether it is contestant1 or contestant2) and the number of rounds in the contest.
  • Parameters Returned:
    • type: JSON String
      • Properties
        • Name- bot_name, Type: String, Desc: Whatever you want to name your bot.
        • Name- author; Type: String, Desc: The name of the programmer.
  • http://10.215.32.220:8080/contestant1/play
    • HTTP Action: GET
    • Parameters Expected: None.
    • Parameters Returned:
      • type: String
      • one of the following strings: “rock” | “paper” | “scissors” (no quotes though)
  • http://10.215.32.220:8080/contestant1/outcome
    • HTTP Action: POST
    • Parameters Expected:
      • type: JSON String
      • data: {"contestant1":“rock” | “paper” | “scissors”, “contestant2”:“rock” | “paper” | “scissors”, “winner”: “contestant1” | “constestant2 | draw”}
    • Parameters Returned:
      • type: String
      • Some text. “ok” is sufficient but can be just about anything. Just a response to let TheOctagon know you’re alive.