-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenerate_combinations.py
88 lines (79 loc) · 3.34 KB
/
generate_combinations.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
"""
This where we generate all possible combination plan
"""
from random import shuffle
# Emotion A: Angry S: Sad
# Strategy: R: Random, T: Tit-for-Tat (Copy previous??"
COMBINATION_STARTS = [["Red", "A", "T"],
["Red", "A", "R"],
["Red", "S", "T"],
["Red", "S", "R"],
["Blue", "A", "T"],
["Blue", "A", "R"],
["Blue", "S", "T"],
["Blue", "S", "R"]]
BLOCK_COMBOS = [[('Red', 'A', 'T'), ('Blue', 'S', 'R'), ('Red', 'A', 'R'), ('Blue', 'S', 'T')],
[('Red', 'A', 'T'), ('Blue', 'S', 'T'), ('Red', 'A', 'R'), ('Blue', 'S', 'R')],
[('Red', 'A', 'R'), ('Blue', 'S', 'T'), ('Red', 'A', 'T'), ('Blue', 'S', 'R')],
[('Red', 'A', 'R'), ('Blue', 'S', 'R'), ('Red', 'A', 'T'), ('Blue', 'S', 'T')],
[('Red', 'S', 'T'), ('Blue', 'A', 'R'), ('Red', 'S', 'R'), ('Blue', 'A', 'T')],
[('Red', 'S', 'T'), ('Blue', 'A', 'T'), ('Red', 'S', 'R'), ('Blue', 'A', 'R')],
[('Red', 'S', 'R'), ('Blue', 'A', 'T'), ('Red', 'S', 'T'), ('Blue', 'A', 'R')],
[('Red', 'S', 'R'), ('Blue', 'A', 'R'), ('Red', 'S', 'T'), ('Blue', 'A', 'T')],
[('Blue', 'A', 'T'), ('Red', 'S', 'R'), ('Blue', 'A', 'R'), ('Red', 'S', 'T')],
[('Blue', 'A', 'T'), ('Red', 'S', 'T'), ('Blue', 'A', 'R'), ('Red', 'S', 'R')],
[('Blue', 'A', 'R'), ('Red', 'S', 'T'), ('Blue', 'A', 'T'), ('Red', 'S', 'R')],
[('Blue', 'A', 'R'), ('Red', 'S', 'R'), ('Blue', 'A', 'T'), ('Red', 'S', 'T')],
[('Blue', 'S', 'T'), ('Red', 'A', 'R'), ('Blue', 'S', 'R'), ('Red', 'A', 'T')],
[('Blue', 'S', 'T'), ('Red', 'A', 'T'), ('Blue', 'S', 'R'), ('Red', 'A', 'R')],
[('Blue', 'S', 'R'), ('Red', 'A', 'T'), ('Blue', 'S', 'T'), ('Red', 'A', 'R')],
[('Blue', 'S', 'R'), ('Red', 'A', 'R'), ('Blue', 'S', 'T'), ('Red', 'A', 'T')]]
# Which block Combo each of our participant will get
PPT_PLAN = [15, 11, 10, 2, 1, 9, 13, 7, 4, 12, 3, 0, 8, 14, 6, 5, 10, 14, 11, 6, 4, 1, 3, 7, 8, 15, 0, 2, 9, 12, 13, 5]
def generate_blocks():
block_combinations = []
for pattern in COMBINATION_STARTS:
r1 = pattern[0]
e1 = pattern[1]
s1 = pattern[2]
# robot
if r1 == "Red":
r2 = "Blue"
else:
r2 = "Red"
#emotion
if e1 == "A":
e2 = "S"
else:
e2 = "A"
#strategy
if s1 == "T":
s2 = "R"
else:
s2 = "T"
block_combinations.append([(r1, e1, s1),
(r2, e2, s2),
(r1, e1, s2),
(r2, e2, s1)])
block_combinations.append([(r1, e1, s1),
(r2, e2, s1),
(r1, e1, s2),
(r2, e2, s2)])
print("There are %d possible block combination" % len(block_combinations))
for block in block_combinations:
print(block)
def generate_plan(total_ppt):
block_options = []
deal_block = []
option_count = len(BLOCK_COMBOS)
for i in range(0, option_count):
block_options.append(i)
for j in range(0, total_ppt, option_count):
shuffle(block_options)
deal_block = deal_block + block_options
print(deal_block)
return deal_block
if __name__ == "__main__":
#generate_blocks()
#generate_plan(32)
pass