-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
49 lines (39 loc) · 956 Bytes
/
Copy pathmain.py
File metadata and controls
49 lines (39 loc) · 956 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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
from models import *
from random import randrange
from board import Board
from player import Player
def main():
runMultiGames()
# debug()
return
def debug():
b = Board(8)
p = Player(b)
win = p.play(True)
print(win)
print(b.moveCounter)
print(*p.freeNodeCntHistory)
def runMultiGames():
winCounter = 0
playCounter = 0
totalMoves = 0
totalWinGamesMoves = 0
b = Board(8)
p = Player(b)
numOfWinReq = 400
while winCounter < numOfWinReq:
b = Board(8)
p = Player(b)
playCounter += 1
win = p.play()
if win:
totalWinGamesMoves += b.moveCounter
winCounter += 1
b.printBorad()
totalMoves += b.moveCounter
print()
print('wins: ' + str(winCounter) + '/ play: ' + str(playCounter))
print(totalMoves / numOfWinReq)
print(totalWinGamesMoves / numOfWinReq)
if __name__ == '__main__':
main()