|
|
@ -919,17 +919,15 @@ def depthLimitedSearch2(curAnimals, turn, ID): # depth = 2
|
|
|
|
return x
|
|
|
|
return x
|
|
|
|
|
|
|
|
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
x = eagleToHome(curAnimals, ID, turn)
|
|
|
|
x = elephantAttack(curAnimals, ID, turn)
|
|
|
|
if x:
|
|
|
|
if x:
|
|
|
|
return x
|
|
|
|
return x
|
|
|
|
|
|
|
|
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
x = killTheMouth(curAnimals, ID, turn)
|
|
|
|
x = huangLAE(curAnimals, ID, turn)
|
|
|
|
if x:
|
|
|
|
if x:
|
|
|
|
return x
|
|
|
|
return x
|
|
|
|
|
|
|
|
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
x = elephantAttack(curAnimals, ID, turn)
|
|
|
|
x = eagleToHome(curAnimals, ID, turn)
|
|
|
|
if x:
|
|
|
|
if x:
|
|
|
|
return x
|
|
|
|
return x
|
|
|
|
|
|
|
|
|
|
|
@ -1115,7 +1113,7 @@ def lionAttack(Animals, ID, turn):
|
|
|
|
des = (6,i,j)
|
|
|
|
des = (6,i,j)
|
|
|
|
return findWayToDes(Animals, 6, des, ID)
|
|
|
|
return findWayToDes(Animals, 6, des, ID)
|
|
|
|
if AnimalsPos[6][0] == 8:
|
|
|
|
if AnimalsPos[6][0] == 8:
|
|
|
|
des = (6, 8, 3)
|
|
|
|
des = (6, 8, 1)
|
|
|
|
return findWayToDes(Animals, 6, des, ID)
|
|
|
|
return findWayToDes(Animals, 6, des, ID)
|
|
|
|
|
|
|
|
|
|
|
|
if AnimalsPos[6][1] == 0:
|
|
|
|
if AnimalsPos[6][1] == 0:
|
|
|
@ -1139,7 +1137,7 @@ def lionAttack(Animals, ID, turn):
|
|
|
|
des = (6,i,j)
|
|
|
|
des = (6,i,j)
|
|
|
|
return findWayToDes(Animals, 13, des, ID)
|
|
|
|
return findWayToDes(Animals, 13, des, ID)
|
|
|
|
if AnimalsPos[13][0] == 0:
|
|
|
|
if AnimalsPos[13][0] == 0:
|
|
|
|
des = (13, 0, 3)
|
|
|
|
des = (13, 0, 1)
|
|
|
|
return findWayToDes(Animals, 13, des, ID)
|
|
|
|
return findWayToDes(Animals, 13, des, ID)
|
|
|
|
|
|
|
|
|
|
|
|
if AnimalsPos[13][1] == 6:
|
|
|
|
if AnimalsPos[13][1] == 6:
|
|
|
@ -1169,7 +1167,7 @@ def elephantAttack(Animals, ID, turn):
|
|
|
|
des = (7,i,j)
|
|
|
|
des = (7,i,j)
|
|
|
|
return findWayToDes(Animals, 7, des, ID)
|
|
|
|
return findWayToDes(Animals, 7, des, ID)
|
|
|
|
if AnimalsPos[7][1] == 3:
|
|
|
|
if AnimalsPos[7][1] == 3:
|
|
|
|
des = (7, 8, 3)
|
|
|
|
des = (7, 6, 3)
|
|
|
|
return findWayToDes(Animals, 7, des, ID)
|
|
|
|
return findWayToDes(Animals, 7, des, ID)
|
|
|
|
|
|
|
|
|
|
|
|
if AnimalsPos[7][1] != 3:
|
|
|
|
if AnimalsPos[7][1] != 3:
|
|
|
@ -1186,7 +1184,7 @@ def elephantAttack(Animals, ID, turn):
|
|
|
|
des = (14,i,j)
|
|
|
|
des = (14,i,j)
|
|
|
|
return findWayToDes(Animals, 14, des, ID)
|
|
|
|
return findWayToDes(Animals, 14, des, ID)
|
|
|
|
if AnimalsPos[14][1] == 3:
|
|
|
|
if AnimalsPos[14][1] == 3:
|
|
|
|
des = (14, 0, 3)
|
|
|
|
des = (14, 2, 3)
|
|
|
|
return findWayToDes(Animals, 14, des, ID)
|
|
|
|
return findWayToDes(Animals, 14, des, ID)
|
|
|
|
|
|
|
|
|
|
|
|
if AnimalsPos[14][1] != 3:
|
|
|
|
if AnimalsPos[14][1] != 3:
|
|
|
@ -1228,7 +1226,7 @@ def killTheMouth(Animals, ID, turn):
|
|
|
|
if turn == 0 and ID[2] and ID[8]:
|
|
|
|
if turn == 0 and ID[2] and ID[8]:
|
|
|
|
if AnimalsPos[8] in pool:
|
|
|
|
if AnimalsPos[8] in pool:
|
|
|
|
return None
|
|
|
|
return None
|
|
|
|
x = killtheAnimal(curAnimals, ID, turn, 2, 8)
|
|
|
|
x = killtheAnimal(Animals, ID, turn, 2, 8)
|
|
|
|
if x:
|
|
|
|
if x:
|
|
|
|
return x
|
|
|
|
return x
|
|
|
|
if turn == 1 and ID[9] and ID[1]:
|
|
|
|
if turn == 1 and ID[9] and ID[1]:
|
|
|
@ -1240,6 +1238,27 @@ def killTheMouth(Animals, ID, turn):
|
|
|
|
return None
|
|
|
|
return None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def huangLAE(Animals, ID, turn):
|
|
|
|
|
|
|
|
AnimalsPos = getAnimalsPos(Animals, ID)
|
|
|
|
|
|
|
|
if turn == 0:
|
|
|
|
|
|
|
|
if ID[7] and ID[6] and AnimalsPos[7] == (6, 3) and Animals[6] == (8, 1):
|
|
|
|
|
|
|
|
return (7, 7 ,3)
|
|
|
|
|
|
|
|
if ID[7] and AnimalsPos[7] == (7, 3):
|
|
|
|
|
|
|
|
return (7, 8, 3)
|
|
|
|
|
|
|
|
if ID[6] and AnimalsPos[6] == (8, 1):
|
|
|
|
|
|
|
|
return (6, 8, 2)
|
|
|
|
|
|
|
|
if ID[6] and AnimalsPos[6] == (8, 2):
|
|
|
|
|
|
|
|
return (6, 8, 3)
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
if ID[14] and ID[13] and AnimalsPos[14] == (2, 3) and Animals[6] == (0, 5):
|
|
|
|
|
|
|
|
return (14, 1 ,3)
|
|
|
|
|
|
|
|
if ID[14] and AnimalsPos[14] == (1, 3):
|
|
|
|
|
|
|
|
return (14, 0, 3)
|
|
|
|
|
|
|
|
if ID[13] and AnimalsPos[13] == (0, 5):
|
|
|
|
|
|
|
|
return (13, 0, 4)
|
|
|
|
|
|
|
|
if ID[13] and AnimalsPos[6] == (0, 4):
|
|
|
|
|
|
|
|
return (13, 0, 4)
|
|
|
|
|
|
|
|
|
|
|
|
def main():
|
|
|
|
def main():
|
|
|
|
axis = [(0, 0), (2, 6), (1, 3), (1, 5), (2, 2), (2, 4), (2, 3), (2, 0), (6, 0), (7, 5), (7, 1), (6, 4), (6, 2),
|
|
|
|
axis = [(0, 0), (2, 6), (1, 3), (1, 5), (2, 2), (2, 4), (2, 3), (2, 0), (6, 0), (7, 5), (7, 1), (6, 4), (6, 2),
|
|
|
|
(6, 3), (6, 6)]
|
|
|
|
(6, 3), (6, 6)]
|
|
|
|