-
Notifications
You must be signed in to change notification settings - Fork 2
/
tester.py
170 lines (156 loc) · 7.34 KB
/
tester.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
import sys
import random
from JeffnRpsCandidate import *
if __name__ == "__main__":
print "===================================================================="
print " Round Name\t\t\tW/L/T\t\t\tScore"
score = 0
#candidate = JeffnRpsCandidate(int(sys.argv[1]), int(sys.argv[2]), float(sys.argv[3]))
rounds = 10000
candidate = JeffnRpsCandidate()
for i in range(rounds):
otherPlay = ROCK
candidatePlay = candidate.getNextMove()
candidate.setOpponentsLastMove(otherPlay)
roundScore = candidate.getWins()-candidate.getLosses()
score += roundScore
print " Static\t\t\t\t%s/%s/%s\t\t%s" % (candidate.getWins(), candidate.getLosses(), candidate.getTies(), roundScore)
candidate.resetScoreKeepers()
candidate = JeffnRpsCandidate()
for i in range(rounds):
otherPlay = SCISSORS
if (i < (rounds/2)):
otherPlay = PAPER
candidatePlay = candidate.getNextMove()
candidate.setOpponentsLastMove(otherPlay)
roundScore = candidate.getWins()-candidate.getLosses()
score += roundScore
print " Swapping Static\t\t%s/%s/%s\t\t%s" % (candidate.getWins(), candidate.getLosses(), candidate.getTies(), roundScore)
candidate.resetScoreKeepers()
candidate = JeffnRpsCandidate()
for i in range(rounds):
otherPlay = i % 3
candidatePlay = candidate.getNextMove()
candidate.setOpponentsLastMove(otherPlay)
roundScore = candidate.getWins()-candidate.getLosses()
score += roundScore
print " Walking\t\t\t%s/%s/%s\t\t%s" % (candidate.getWins(), candidate.getLosses(), candidate.getTies(), roundScore)
candidate.resetScoreKeepers()
candidate = JeffnRpsCandidate()
for i in range(rounds/2):
otherPlay = i % 3
candidatePlay = candidate.getNextMove()
candidate.setOpponentsLastMove(otherPlay)
candidatePlay = candidate.getNextMove()
candidate.setOpponentsLastMove(otherPlay)
roundScore = candidate.getWins()-candidate.getLosses()
score += roundScore
print " Slower Walking\t\t\t%s/%s/%s\t\t%s" % (candidate.getWins(), candidate.getLosses(), candidate.getTies(), roundScore)
candidate.resetScoreKeepers()
candidate = JeffnRpsCandidate()
backwardsI = rounds/6
while(backwardsI >= 0):
otherPlay = backwardsI % 3
candidatePlay = candidate.getNextMove()
candidate.setOpponentsLastMove(otherPlay)
candidatePlay = candidate.getNextMove()
candidate.setOpponentsLastMove(otherPlay)
candidatePlay = candidate.getNextMove()
candidate.setOpponentsLastMove(otherPlay)
candidatePlay = candidate.getNextMove()
candidate.setOpponentsLastMove(otherPlay)
candidatePlay = candidate.getNextMove()
candidate.setOpponentsLastMove(otherPlay)
candidatePlay = candidate.getNextMove()
candidate.setOpponentsLastMove(otherPlay)
backwardsI = backwardsI - 1
roundScore = candidate.getWins()-candidate.getLosses()
score += roundScore
print " Even Slower Walking\t\t%s/%s/%s\t\t%s" % (candidate.getWins(), candidate.getLosses(), candidate.getTies(), roundScore)
candidate.resetScoreKeepers()
candidate = JeffnRpsCandidate()
backwardsI = rounds/12
while(backwardsI >= 0):
otherPlay = backwardsI % 3
candidatePlay = candidate.getNextMove()
candidate.setOpponentsLastMove(otherPlay)
candidatePlay = candidate.getNextMove()
candidate.setOpponentsLastMove(otherPlay)
candidatePlay = candidate.getNextMove()
candidate.setOpponentsLastMove(otherPlay)
candidatePlay = candidate.getNextMove()
candidate.setOpponentsLastMove(otherPlay)
candidatePlay = candidate.getNextMove()
candidate.setOpponentsLastMove(otherPlay)
candidatePlay = candidate.getNextMove()
candidate.setOpponentsLastMove(otherPlay)
candidatePlay = candidate.getNextMove()
candidate.setOpponentsLastMove(otherPlay)
candidatePlay = candidate.getNextMove()
candidate.setOpponentsLastMove(otherPlay)
candidatePlay = candidate.getNextMove()
candidate.setOpponentsLastMove(otherPlay)
candidatePlay = candidate.getNextMove()
candidate.setOpponentsLastMove(otherPlay)
candidatePlay = candidate.getNextMove()
candidate.setOpponentsLastMove(otherPlay)
candidatePlay = candidate.getNextMove()
candidate.setOpponentsLastMove(otherPlay)
backwardsI = backwardsI - 1
roundScore = candidate.getWins()-candidate.getLosses()
score += roundScore
print " Even Slowerer Walking\t\t%s/%s/%s\t\t%s" % (candidate.getWins(), candidate.getLosses(), candidate.getTies(), roundScore)
candidate.resetScoreKeepers()
candidate = JeffnRpsCandidate()
bouncingSet = [ROCK, PAPER, SCISSORS, SCISSORS, PAPER, ROCK]
for i in range(rounds):
otherPlay = bouncingSet[i % len(bouncingSet)]
candidatePlay = candidate.getNextMove()
candidate.setOpponentsLastMove(otherPlay)
roundScore = candidate.getWins()-candidate.getLosses()
score += roundScore
print " Bouncing Walk\t\t\t%s/%s/%s\t\t%s" % (candidate.getWins(), candidate.getLosses(), candidate.getTies(), roundScore)
candidate.resetScoreKeepers()
candidate = JeffnRpsCandidate()
for i in range(rounds):
otherPlay = ROCK
if (i > (rounds/3) and i < (2*rounds/3)):
otherPlay = SCISSORS
if (i > (2*rounds/3)):
otherPlay = PAPER
candidatePlay = candidate.getNextMove()
candidate.setOpponentsLastMove(otherPlay)
roundScore = candidate.getWins()-candidate.getLosses()
score += roundScore
print " Long Walk\t\t\t%s/%s/%s\t\t%s" % (candidate.getWins(), candidate.getLosses(), candidate.getTies(), roundScore)
candidate.resetScoreKeepers()
#candidate = JeffnRpsCandidate()
#for i in range(rounds):
# otherPlay = random.choice((SCISSORS,PAPER))
# candidatePlay = candidate.getNextMove()
# candidate.setOpponentsLastMove(otherPlay)
#roundScore = candidate.getWins()-candidate.getLosses()
#score += roundScore
#print " Random (ROCK,SCISSORS)\t\t%s/%s/%s\t\t%s" % (candidate.getWins(), candidate.getLosses(), candidate.getTies(), roundScore)
#candidate.resetScoreKeepers()
#candidate = JeffnRpsCandidate()
#for i in range(rounds):
# otherPlay = random.choice((0,1,2))
# candidatePlay = candidate.getNextMove()
# candidate.setOpponentsLastMove(otherPlay)
#roundScore = candidate.getWins()-candidate.getLosses()
#score += roundScore
#print " Full Random\t\t\t%s/%s/%s\t\t%s" % (candidate.getWins(), candidate.getLosses(), candidate.getTies(), roundScore)
#candidate.resetScoreKeepers()
#candidate = JeffnRpsCandidate()
#urandom = random.SystemRandom()
#for i in range(rounds):
# #otherPlay = (urandom.random() * 100) % 3
# otherPlay = urandom.choice((0,1,2))
# candidatePlay = candidate.getNextMove()
# candidate.setOpponentsLastMove(otherPlay)
#roundScore = candidate.getWins()-candidate.getLosses()
#score += roundScore
#print " Full Secure Random\t\t%s/%s/%s\t\t%s" % (candidate.getWins(), candidate.getLosses(), candidate.getTies(), roundScore)
#candidate.resetScoreKeepers()
print "____________________________________________________________________\n Total Score:\t\t\t\t\t\t%s\n\n" % (score)