-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
45 lines (39 loc) · 886 Bytes
/
main.py
File metadata and controls
45 lines (39 loc) · 886 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
import numpy as np
import Bitboard as bb
import GameTree as gt
import time
from random import randrange
import Bitboard as bb
#all = pow(2,34) + pow(2,6) + pow(2,2)
#bb.printBitBoard(all)
#m = bb.getRookMoveMask(all,2)
#bb.printBitBoard(m)
#all = pow(2,17) + pow(2,22) + pow(2,43) + pow(2,3) + pow(2,19)
s = gt.State(True)
s.createStartConfig()
g = gt.GameTree(True)
#s.printState()
print len(s.getChildren())
g.alphaBeta(s,3,-200,200,True)
print len(s.getChildren())
s2 = s.getBestMove()
s2.printState()
#print g.getCount()
'''
moves = g.generateAllMoves(s)
print "white starts"
for m in moves:
pass
#m.printMove()
new = g.makeMove(s,moves[1])
print "white moves knight"
print"blacks turn"
moves = g.generateAllMoves(new)
for m in moves:
m.printMove()
for i in range(30):
moves = g.generateAllMoves(s)
r = randrange(len(moves))
s = g.makeMove(s,moves[r])
'''
#bb.debug(40)