Fixed bug; moves stack cut too long on rebase
parent
9f6a78c7ea
commit
84cdf65c3a
11
chess.py
11
chess.py
|
@ -199,7 +199,7 @@ class Game:
|
||||||
"""Shorten moves and history stacks if move is made
|
"""Shorten moves and history stacks if move is made
|
||||||
while past game state is loaded into memory. Essentialy
|
while past game state is loaded into memory. Essentialy
|
||||||
overrides future game states."""
|
overrides future game states."""
|
||||||
self.moves = self.moves[:self.index+1]
|
self.moves = self.moves[:self.index]
|
||||||
self.history = self.history[:self.index+1]
|
self.history = self.history[:self.index+1]
|
||||||
|
|
||||||
def timetravel(self, i):
|
def timetravel(self, i):
|
||||||
|
@ -528,4 +528,11 @@ class Game:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
game = Game()
|
||||||
|
while True:
|
||||||
|
i = input(">> ")
|
||||||
|
game.AN_move(i)
|
||||||
|
if i =="prev":
|
||||||
|
game.prev()
|
||||||
|
print(game)
|
||||||
|
print(game.index, len(game.history), len(game.moves))
|
||||||
|
|
Loading…
Reference in New Issue