picnic: use ttr's checker boards

This commit is contained in:
Wilee999 1980-01-01 18:56:35 -08:00
parent a7e57a8694
commit 9ed7402631
2 changed files with 1143 additions and 1143 deletions

View file

@ -1,336 +1,336 @@
class CheckersBoard: class CheckersBoard:
def __init__(self): def __init__(self):
self.squareList = [] self.squareList = []
for x in xrange(32): for x in range(32):
self.squareList.append(CheckersTile(x)) self.squareList.append(CheckersTile(x))
self.squareList[0].setAdjacent([None, self.squareList[0].setAdjacent([None,
None, None,
4, 4,
None]) None])
self.squareList[1].setAdjacent([None, self.squareList[1].setAdjacent([None,
4, 4,
5, 5,
None]) None])
self.squareList[2].setAdjacent([None, self.squareList[2].setAdjacent([None,
5, 5,
6, 6,
None]) None])
self.squareList[3].setAdjacent([None, self.squareList[3].setAdjacent([None,
6, 6,
7, 7,
None]) None])
self.squareList[4].setAdjacent([0, self.squareList[4].setAdjacent([0,
8, 8,
9, 9,
1]) 1])
self.squareList[5].setAdjacent([1, self.squareList[5].setAdjacent([1,
9, 9,
10, 10,
2]) 2])
self.squareList[6].setAdjacent([2, self.squareList[6].setAdjacent([2,
10, 10,
11, 11,
3]) 3])
self.squareList[7].setAdjacent([3, self.squareList[7].setAdjacent([3,
11, 11,
None, None,
None]) None])
self.squareList[8].setAdjacent([None, self.squareList[8].setAdjacent([None,
None, None,
12, 12,
4]) 4])
self.squareList[9].setAdjacent([4, self.squareList[9].setAdjacent([4,
12, 12,
13, 13,
5]) 5])
self.squareList[10].setAdjacent([5, self.squareList[10].setAdjacent([5,
13, 13,
14, 14,
6]) 6])
self.squareList[11].setAdjacent([6, self.squareList[11].setAdjacent([6,
14, 14,
15, 15,
7]) 7])
self.squareList[12].setAdjacent([8, self.squareList[12].setAdjacent([8,
16, 16,
17, 17,
9]) 9])
self.squareList[13].setAdjacent([9, self.squareList[13].setAdjacent([9,
17, 17,
18, 18,
10]) 10])
self.squareList[14].setAdjacent([10, self.squareList[14].setAdjacent([10,
18, 18,
19, 19,
11]) 11])
self.squareList[15].setAdjacent([11, self.squareList[15].setAdjacent([11,
19, 19,
None, None,
None]) None])
self.squareList[16].setAdjacent([None, self.squareList[16].setAdjacent([None,
None, None,
20, 20,
12]) 12])
self.squareList[17].setAdjacent([12, self.squareList[17].setAdjacent([12,
20, 20,
21, 21,
13]) 13])
self.squareList[18].setAdjacent([13, self.squareList[18].setAdjacent([13,
21, 21,
22, 22,
14]) 14])
self.squareList[19].setAdjacent([14, self.squareList[19].setAdjacent([14,
22, 22,
23, 23,
15]) 15])
self.squareList[20].setAdjacent([16, self.squareList[20].setAdjacent([16,
24, 24,
25, 25,
17]) 17])
self.squareList[21].setAdjacent([17, self.squareList[21].setAdjacent([17,
25, 25,
26, 26,
18]) 18])
self.squareList[22].setAdjacent([18, self.squareList[22].setAdjacent([18,
26, 26,
27, 27,
19]) 19])
self.squareList[23].setAdjacent([19, self.squareList[23].setAdjacent([19,
27, 27,
None, None,
None]) None])
self.squareList[24].setAdjacent([None, self.squareList[24].setAdjacent([None,
None, None,
28, 28,
20]) 20])
self.squareList[25].setAdjacent([20, self.squareList[25].setAdjacent([20,
28, 28,
29, 29,
21]) 21])
self.squareList[26].setAdjacent([21, self.squareList[26].setAdjacent([21,
29, 29,
30, 30,
22]) 22])
self.squareList[27].setAdjacent([22, self.squareList[27].setAdjacent([22,
30, 30,
31, 31,
23]) 23])
self.squareList[28].setAdjacent([24, self.squareList[28].setAdjacent([24,
None, None,
None, None,
25]) 25])
self.squareList[29].setAdjacent([25, self.squareList[29].setAdjacent([25,
None, None,
None, None,
26]) 26])
self.squareList[30].setAdjacent([26, self.squareList[30].setAdjacent([26,
None, None,
None, None,
27]) 27])
self.squareList[31].setAdjacent([27, self.squareList[31].setAdjacent([27,
None, None,
None, None,
None]) None])
self.squareList[0].setJumps([None, self.squareList[0].setJumps([None,
None, None,
9, 9,
None]) None])
self.squareList[1].setJumps([None, self.squareList[1].setJumps([None,
8, 8,
10, 10,
None]) None])
self.squareList[2].setJumps([None, self.squareList[2].setJumps([None,
9, 9,
11, 11,
None]) None])
self.squareList[3].setJumps([None, self.squareList[3].setJumps([None,
10, 10,
None, None,
None]) None])
self.squareList[4].setJumps([None, self.squareList[4].setJumps([None,
None, None,
13, 13,
None]) None])
self.squareList[5].setJumps([None, self.squareList[5].setJumps([None,
12, 12,
14, 14,
None]) None])
self.squareList[6].setJumps([None, self.squareList[6].setJumps([None,
13, 13,
15, 15,
None]) None])
self.squareList[7].setJumps([None, self.squareList[7].setJumps([None,
14, 14,
None, None,
None]) None])
self.squareList[8].setJumps([None, self.squareList[8].setJumps([None,
None, None,
17, 17,
1]) 1])
self.squareList[9].setJumps([0, self.squareList[9].setJumps([0,
16, 16,
18, 18,
2]) 2])
self.squareList[10].setJumps([1, self.squareList[10].setJumps([1,
17, 17,
19, 19,
3]) 3])
self.squareList[11].setJumps([2, self.squareList[11].setJumps([2,
18, 18,
None, None,
None]) None])
self.squareList[12].setJumps([None, self.squareList[12].setJumps([None,
None, None,
21, 21,
5]) 5])
self.squareList[13].setJumps([4, self.squareList[13].setJumps([4,
20, 20,
22, 22,
6]) 6])
self.squareList[14].setJumps([5, self.squareList[14].setJumps([5,
21, 21,
23, 23,
7]) 7])
self.squareList[15].setJumps([6, self.squareList[15].setJumps([6,
22, 22,
None, None,
None]) None])
self.squareList[16].setJumps([None, self.squareList[16].setJumps([None,
None, None,
25, 25,
9]) 9])
self.squareList[17].setJumps([8, self.squareList[17].setJumps([8,
24, 24,
26, 26,
10]) 10])
self.squareList[18].setJumps([9, self.squareList[18].setJumps([9,
25, 25,
27, 27,
11]) 11])
self.squareList[19].setJumps([10, self.squareList[19].setJumps([10,
26, 26,
None, None,
None]) None])
self.squareList[20].setJumps([None, self.squareList[20].setJumps([None,
None, None,
29, 29,
13]) 13])
self.squareList[21].setJumps([12, self.squareList[21].setJumps([12,
28, 28,
30, 30,
14]) 14])
self.squareList[22].setJumps([13, self.squareList[22].setJumps([13,
29, 29,
31, 31,
15]) 15])
self.squareList[23].setJumps([14, self.squareList[23].setJumps([14,
30, 30,
None, None,
None]) None])
self.squareList[24].setJumps([None, self.squareList[24].setJumps([None,
None, None,
None, None,
17]) 17])
self.squareList[25].setJumps([16, self.squareList[25].setJumps([16,
None, None,
None, None,
18]) 18])
self.squareList[26].setJumps([17, self.squareList[26].setJumps([17,
None, None,
None, None,
19]) 19])
self.squareList[27].setJumps([18, self.squareList[27].setJumps([18,
None, None,
None, None,
None]) None])
self.squareList[28].setJumps([None, self.squareList[28].setJumps([None,
None, None,
None, None,
21]) 21])
self.squareList[29].setJumps([20, self.squareList[29].setJumps([20,
None, None,
None, None,
22]) 22])
self.squareList[30].setJumps([21, self.squareList[30].setJumps([21,
None, None,
None, None,
23]) 23])
self.squareList[31].setJumps([22, self.squareList[31].setJumps([22,
None, None,
None, None,
None]) None])
return return
def delete(self): def delete(self):
for x in self.squareList: for x in self.squareList:
x.delete() x.delete()
del self.squareList del self.squareList
def getSquare(self, arrayLoc): def getSquare(self, arrayLoc):
return self.squareList[arrayLoc] return self.squareList[arrayLoc]
def getState(self, squareNum): def getState(self, squareNum):
return self.squareList[squareNum].getState() return self.squareList[squareNum].getState()
def setState(self, squareNum, newState): def setState(self, squareNum, newState):
self.squareList[squareNum].setState(newState) self.squareList[squareNum].setState(newState)
def getAdjacent(self, squareNum): def getAdjacent(self, squareNum):
return self.squareList[squareNum].adjacent return self.squareList[squareNum].adjacent
def getStates(self): def getStates(self):
retList = [] retList = []
for x in xrange(32): for x in range(32):
retList.append(self.squareList[x].getState()) retList.append(self.squareList[x].getState())
return retList return retList
def setStates(self, squares): def setStates(self, squares):
y = 0 y = 0
for x in xrange(32): for x in range(32):
self.squareList[x].setState(squares[x]) self.squareList[x].setState(squares[x])
def getJumps(self, squareNum): def getJumps(self, squareNum):
return self.squareList[squareNum].jumps return self.squareList[squareNum].jumps
class CheckersTile: class CheckersTile:
def __init__(self, tileNum): def __init__(self, tileNum):
self.tileNum = tileNum self.tileNum = tileNum
self.state = 0 self.state = 0
self.adjacent = [] self.adjacent = []
self.jumps = [] self.jumps = []
def delete(self): def delete(self):
del self.tileNum del self.tileNum
del self.state del self.state
del self.adjacent del self.adjacent
def setJumps(self, jumpList): def setJumps(self, jumpList):
for x in jumpList: for x in jumpList:
self.jumps.append(x) self.jumps.append(x)
def getJumps(self): def getJumps(self):
return self.jumps return self.jumps
def setAdjacent(self, adjList): def setAdjacent(self, adjList):
for x in adjList: for x in adjList:
self.adjacent.append(x) self.adjacent.append(x)
def getAdjacent(self): def getAdjacent(self):
return self.adjacent return self.adjacent
def setState(self, newState): def setState(self, newState):
self.state = newState self.state = newState
def getState(self): def getState(self):
return self.state return self.state
def getNum(self): def getNum(self):
return self.tileNum return self.tileNum

File diff suppressed because it is too large Load diff