Example #1
0
def role():
    cheater1 = Cheat_Swapper()
    cheater2 = Cheat_Loaded_Dice()

    cheater1.roll()
    cheater2.roll()
    print("=" * 70)
    print("Player 1 rolled " + str(cheater1.get_dice()), sum(cheater1.get_dice()))
    print("Player 2 rolled " + str(cheater2.get_dice()), sum(cheater2.get_dice()))


    cheater1.cheat()
    cheater2.cheat()
    print("=" * 70)
    print("Player 1 rolled " + str(cheater1.get_dice()), sum(cheater1.get_dice()))
    print("Player 2 rolled " + str(cheater2.get_dice()), sum(cheater2.get_dice()))

    if sum(cheater1.get_dice()) == sum(cheater2.get_dice()):
        print("Draw")
    elif sum(cheater1.get_dice()) > sum(cheater2.get_dice()):
        print("Player 1 Wins")
    else:
        print("Player 2 Wins")
Example #2
0
#!/usr/bin/env python3

from cheatdice import Player
from cheatdice import Cheat_Swapper
from cheatdice import Cheat_Loaded_Dice

cheater1 = Cheat_Swapper()
cheater2 = Cheat_Loaded_Dice()

cheater1.roll()
cheater2.roll()

cheater1.cheat()
cheater2.cheat()

print("Cheater 1 rolled " + str(cheater1.get_dice()))
print("Cheater 2 rolled " + str(cheater2.get_dice()))

if sum(cheater1.get_dice()) == sum(cheater2.get_dice()):
    print("Draw!")

elif sum(cheater1.get_dice()) > sum(cheater2.get_dice()):
    print("Cheater 1 Wines!")

else:
    print("Cheater 2 Wine!")

Example #3
0
from cheatdice import Player
from cheatdice import Cheat_Swapper
from cheatdice import Cheat_Loaded_Dice

swapper = Cheat_Swapper()
loaded_dice = Cheat_Loaded_Dice()
swapper_score = 0
loaded_dice_score = 0
number_of_games = 100000
game_number = 0
print("Simulation running")
print("==================")
while game_number < number_of_games:
    swapper.roll()
    loaded_dice.roll()

    swapper.cheat()
    loaded_dice.cheat()
    #Remove # before print statements to see simulation running
    #Simulation takes approximately one hour to run with print
    #statements or ten seconds with print statements
    #commented out

    #print("Cheater 1 rolled" + str(swapper.get_dice()))
    #print("Cheater 2 rolled" + str(loaded_dice.get_dice()))
    if sum(swapper.get_dice()) == sum(loaded_dice.get_dice()):
        #print("Draw!")
        pass
    elif sum(swapper.get_dice()) > sum(loaded_dice.get_dice()):
        #print("Dice swapper wins!")