Fixed DragonKill undo bug
This commit is contained in:
@@ -177,6 +177,7 @@ class DragonKillAction(Action):
|
|||||||
assert action_board.bunker[self.destination_bunker_id] == (
|
assert action_board.bunker[self.destination_bunker_id] == (
|
||||||
self.dragon, 4)
|
self.dragon, 4)
|
||||||
assert len(self.source_stacks) == 4
|
assert len(self.source_stacks) == 4
|
||||||
|
action_board.bunker[self.destination_bunker_id] = None
|
||||||
for position, index in self.source_stacks:
|
for position, index in self.source_stacks:
|
||||||
if position == board.Position.Field:
|
if position == board.Position.Field:
|
||||||
action_board.field[index].append(self.dragon)
|
action_board.field[index].append(self.dragon)
|
||||||
@@ -184,7 +185,6 @@ class DragonKillAction(Action):
|
|||||||
action_board.bunker[index] = self.dragon
|
action_board.bunker[index] = self.dragon
|
||||||
else:
|
else:
|
||||||
raise RuntimeError("Can only kill dragons in field and bunker")
|
raise RuntimeError("Can only kill dragons in field and bunker")
|
||||||
action_board.bunker[self.destination_bunker_id] = None
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ from .boards import my_board
|
|||||||
|
|
||||||
def main() -> None:
|
def main() -> None:
|
||||||
A = solver.SolitaireSolver(my_board)
|
A = solver.SolitaireSolver(my_board)
|
||||||
for _, B in zip(range(1), A.solve()):
|
for _, B in zip(range(100), A.solve()):
|
||||||
print(*B, sep='\n')
|
#print(*B, sep='\n')
|
||||||
print(len(B))
|
print(len(B))
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
Reference in New Issue
Block a user