[][src]Module games::rps

Rock Paper scissors

use games::rps::*;
let rps = RpsGame::new("rock").expect("Invalid weapons will throw an error");
match rps.into() {
    GameResult::Win {player, robo} => println!("{} beats {}, you win!", player, robo),
    GameResult::Lose {player, robo} => println!("{} is weaker than {}, you lose!", player, robo),
    GameResult::Draw { .. } => println!("Too bad the objective wasn't to guess the other parties weapon. This is a draw!")
}

Structs

RpsGame

Rock Paper scissors Game

Enums

GameResult

Result of RpsGame

Weapon

Weapons for Rock paper scissors

WeaponParseError

Error parsing weapon