Skip to content

Latest commit

 

History

History
58 lines (37 loc) · 1.89 KB

README.md

File metadata and controls

58 lines (37 loc) · 1.89 KB

Roshambono

Roshambono is roshambo (or Rock-Paper-Scissors) with no ties.

Rock beats scissors, scissors beats paper, paper beats rock.

However, if there are is a tie, the player who has played that shape more often wins. If each player has played that shape the same number of times, then the player who has played the shape that beats it more wins. If still tied, then a coin is tossed.

For example, if both players play "Rock", then the player who has played "Rock" more often wins. If both players have played "Rock" the same amount of times, she who played "Paper" more wins.

You can write a robot by implementing the get_play() function in p_robot/player.py:

def get_play(player_id, state) 
    
    return 1 for Rock, 2 for Paper, and 3 for Scissors.

    player_id is an integer representing the id of your current opponent.

    state is an 8 bit unsigned integer representing the
    result of the last hand. 

    if it is 0, it is the first game. 

    otherwise, bits 0 and 1 represent your move,
    bits 2 and 3 represent your opponent's move, 
    bits 4 and 5 represent the number of tiebreakers
    needed to resolve the game, and 
    bit 6 is set if you won, or 0 if you lost.

    for example, if in the last game you played Rock,
    and your opponent played Scissors, state would be:

    (1) | (3 << 2) | (0 << 4) | (1 << 6) = 77

To play first to 100 rock against random:

$ git clone https://github.com/botfights/roshambono.git
$ cd roshambono
$ python roshambono.py play 100 p_rock p_random

Next, edit p_robot/player.py, implement get_play(), then play your robot against the random:

$ python roshambono.py play 100 p_robot p_random

To play a round robin tournament of 100 games each to 1000:

$ python roshambono.py tournament 100 1000 p_robot p_random p_rock p_paper p_scissors

Have fun!