-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathteam16.py
More file actions
25 lines (23 loc) · 779 Bytes
/
team16.py
File metadata and controls
25 lines (23 loc) · 779 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
####
# 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 = 'SneakyT4T' # Only 10 chars displayed.
strategy_name = 'T4T but occasionally betrays randomly'
strategy_description = 'T4T but occasionally betrays randomly'
def move(my_history, their_history, my_score, their_score):
import random
if len(their_history)==0:
return 'c'
elif their_history[-1] == 'b':
return 'b'
else:
#Collude 90% of the time after opponent colludes
if random.random() < 0.90:
return 'c'
#Betray 10% of the time after opponent colludes
else:
return 'b'