-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathteam4.py
More file actions
28 lines (26 loc) · 885 Bytes
/
team4.py
File metadata and controls
28 lines (26 loc) · 885 Bytes
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
####
# Each team's file must define four tokens:
# team_name: a string
# strategy_name: a string
# strategy_description: a string
# move: A function that returns 'c' or 'b'
####
team_name = 'The name the team gives to itself' # Only 10 chars displayed.
strategy_name = 'The name the team gives to this strategy'
strategy_description = 'How does this strategy decide?'
def move(my_history, their_history, my_score, their_score):
import random
if len(their_history) == 0:
if random.random() < .25:
return 'b'
else:
return 'c'
elif their_history[-1] == 'b':
return 'b'
elif their_history[-1] == 'c' and my_history[-1] == 'c':
if random.random() < .1:
return 'b'
else:
return 'c'
elif their_history[-1] == 'c' and my_history[-1] == 'b':
return 'b'