-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
34 lines (25 loc) · 963 Bytes
/
main.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
################# Prisoner's Dilemma #################
choice_list = [ ["Y", "N"],["Y", "N"] ];
payoff_list = [[5, 5],[10, 0],[0, 10],[9, 9]];
TOTAL_GENERATION = 10;
# PRISONER_NUM=1000;
iterate_game(choice_list, payoff_list, TOTAL_GENERATION);
################# Battle of Sex #################
choice_list = [ ["S", "C"],["S", "C"] ];
payoff_list = [[6, 5],[1, 1],[0, 0],[5, 6]];
TOTAL_GENERATION = 20;
# PRISONER_NUM=1000;
iterate_game(choice_list, payoff_list, TOTAL_GENERATION);
# To caluculate the average least iteration time reaching NE
import statistics
a=[];
for ii in range(30):
b=iterate_game(choice_list, payoff_list,TOTAL_GENERATION);
a.append(b);
statistics.mean(a)
################# Paper, Scissor and Rock #################
choice_list = [ ["A", "B"],["A", "B"] ];
payoff_list = [[2, 0],[0, 1],[0, 1],[2, 0]];
TOTAL_GENERATION = 10;
# PRISONER_NUM=1000;
iterate_game(choice_list, payoff_list);