-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathREADME
More file actions
130 lines (103 loc) · 2.72 KB
/
README
File metadata and controls
130 lines (103 loc) · 2.72 KB
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
Play a d,n,k game, where:
d is the number of dimensions;
n is the square board size;
k is how long a winning run needs to be.
For example, standard tic-tac-toe on a 3x3 board is d=2, n=3, k=3.
Example Usage
* A single game between two computer-controlled players choosing random moves:
/usr/hons2004/dvadas1/git/ttt)./main.py
Player 2 (O) wins: 1
Player 1 (X) wins: 0
Draws: 0
* A game between two human players:
/usr/hons2004/dvadas1/git/ttt)./main.py -1 Human -2 Human
A1: A2: A3:
B1: B2: B3:
C1: C2: C3:
Enter your move: a1
A1:X A2: A3:
B1: B2: B3:
C1: C2: C3:
Enter your move: b2
A1:X A2: A3:
B1: B2:O B3:
C1: C2: C3:
...
Enter your move: b3
A1:X A2:X A3:O
B1:O B2:O B3:X
C1:X C2:O C3:X
Game 1 - Draw
Player 2 (O) wins: 0
Player 1 (X) wins: 0
Draws: 1
* 3-dimensional tic-tac-toe:
/usr/hons2004/dvadas1/git/ttt)./main.py -vvv -d3
A11: A12: A13:
A21: A22: A23:
A31: A32: A33:
B11: B12: B13:
B21: B22: B23:
B31: B32: B33:
C11: C12: C13:
C21: C22: C23:
C31: C32: C33:
...
A11: A12:X A13:O
A21:X A22: A23:
A31:O A32: A33:O
B11:O B12: B13:X
B21:X B22: B23:O
B31:X B32: B33:X
C11: C12:X C13:O
C21: C22:O C23:O
C31: C32: C33:X
Game 1 - Player 2 (O) won through [ A33:O B23:O C13:O ]
Player 2 (O) wins: 1
Player 1 (X) wins: 0
Draws: 0
* A 4-dimensional board:
/usr/hons2004/dvadas1/git/ttt)./main.py -1 Human -2 Human -d4
A111: A112: A113:
A121: A122: A123:
A131: A132: A133:
A211: A212: A213:
A221: A222: A223:
A231: A232: A233:
A311: A312: A313:
A321: A322: A323:
A331: A332: A333:
B111: B112: B113:
B121: B122: B123:
B131: B132: B133:
B211: B212: B213:
B221: B222: B223:
B231: B232: B233:
B311: B312: B313:
B321: B322: B323:
B331: B332: B333:
C111: C112: C113:
C121: C122: C123:
C131: C132: C133:
C211: C212: C213:
C221: C222: C223:
C231: C232: C233:
C311: C312: C313:
C321: C322: C323:
C331: C332: C333:
* Simulating a large number of AI-controlled games:
/usr/hons2004/dvadas1/git/ttt)time ./main.py -g 10000
Player 1 (X) wins: 4341
Player 2 (O) wins: 4371
Draws: 1288
real 0m7.902s
user 0m7.764s
sys 0m0.063s
* More AI-controlled games, where Player 1 uses a better decision making process:
/usr/hons2004/dvadas1/git/ttt)time ./main.py -g 10000 -1 Centre
Player 1 (X) wins: 6024
Player 2 (O) wins: 3182
Draws: 794
real 0m8.403s
user 0m8.235s
sys 0m0.070s