Forgot to commit
parent
715a4517aa
commit
57e4b8489f
6
chess.py
6
chess.py
|
@ -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
|
||||||
|
|
1
main.py
1
main.py
|
@ -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"):
|
||||||
|
|
Loading…
Reference in New Issue