The pre_move_validation() method also calls another method called update_game_statistics() on successfully recording a move (see 4.06—model.py):
def update_game_statistics(self, piece, dest, start_pos, end_pos): if piece.color == 'black': self.fullmove_number += 1 self.halfmove_clock += 1 abbr = piece.name if abbr == 'pawn': abbr = '' self.halfmove_clock = 0 if dest is None: move_text = abbr + end_pos.lower() else: move_text = abbr + 'x' + end_pos.lower() self.halfmove_clock = 0 self.history.append(move_text)
Congratulations, our chess game is now functional!
Let's complete the iteration by binding the File | New Game menu item to start a new game. Earlier, we defined the start_new_game() method. Now, it's simply a matter ...