-
Notifications
You must be signed in to change notification settings - Fork 0
/
NDTTT.py
73 lines (58 loc) · 1.71 KB
/
NDTTT.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
b = [ [ [0,0,0], [0,0,0], [0,0,0] ],
[ [0,0,0], [0,0,0], [0,0,0] ],
[ [0,0,0], [0,0,0], [0,0,0] ] ]
D = [3,3,3]
b = [ [ [0 for z in range(D[2])] for y in range(D[1])] for x in range(D[0]) ]
def openSpots(B):
spots = []
for p in b.keys() :
if B[p] == 0:
spots.append(p)
return spots
def diags(B, point ):
diagnols = []
if point.count(0) + point.count( len(B)-1 ) == D : # Corner point
for hold in range( D + 1 ):
line = [ [-1 for j in range( D )] for k in range( N ) ]
for c in range( D ):
if c != hold:
if point[c] = 0:
for i in range( N ):
line[i][c] = point[c] + i
else: # point[c] is max coordiate value aka = dimension -1
for i in range( N ):
line[i][c] = point[c] - i
else:
for i in range( N )
line[i][c] = point[c]
diagnols.append( line )
elif point.count(0) + point.count( len(B)-1 ) == len(B) -1: # edge point not on corner
i = 0
while hold == -1 :
if point[i] != 0 and point[i] != len(B)-1:
hold = i
else:
i += 1
line = [ [-1 for j in range( D )] for k in range( N ) ]
for c in range( D ):
if c != hold:
if point[c] = 0:
for i in range( N ):
line[i][c] = point[c] + i
else: # point[c] is max coordiate value aka = dimension -1
for i in range( N ):
line[i][c] = point[c] - i
else:
for i in range( N )
line[i][c] = point[c]
diagnols.append( line )
elif point.count( ( len(B) -1 )/2 ) == len(B) -1: # center face
else: # center
for i in range( len(board) ):
d.append( board[len(board)-1 - i][i] )
return d
def downDiag(board):
d = []
for i in range( len(board) ):
d.append( board[i][i] )
return d