Forgot to commit

master
Tibor Bizjak 2023-02-26 23:34:11 +01:00
parent 715a4517aa
commit 57e4b8489f
2 changed files with 5 additions and 4 deletions

View File

@ -490,7 +490,6 @@ class Game:
the move puts the player in check.""" the move puts the player in check."""
new = deepcopy(self) new = deepcopy(self)
valid = new.move(source, dest, promotion) valid = new.move(source, dest, promotion)
new.turn = self.turn
return valid, new return valid, new
def AN_move(self, move): def AN_move(self, move):
@ -517,8 +516,9 @@ class Game:
moves = [] moves = []
for sq in sqrs: for sq in sqrs:
valid, new = self.validate_move(sq, dest, promotion) valid, new = self.validate_move(sq, dest, promotion)
check = new.is_check()==info.check and new.is_mate()==info.mate check = new.is_check()==info.check
if valid and check: mate = new.is_mate()==info.mate
if valid and (check or mate):
moves.append((sq, dest, promotion)) moves.append((sq, dest, promotion))
if len(moves) != 1: if len(moves) != 1:
return False return False

View File

@ -34,6 +34,7 @@ def move():
id = request.get_cookie("gameid", secret=KEY) id = request.get_cookie("gameid", secret=KEY)
valid = True valid = True
if is_submitted("newgame"): if is_submitted("newgame"):
if id in games:
del games[id] del games[id]
redirect("/") redirect("/")
if is_submitted("prev"): if is_submitted("prev"):