March 2018
Beginner to intermediate
422 pages
10h 33m
English
The code needed to keep track of all the available moves for a player is as follows:
def get_all_available_moves(self, color): result = [] for position in self.keys(): piece = self.get_piece_at(position) if piece and piece.color == color: moves = piece.moves_available(position) if moves: result.extend(moves) return result
The description of the code is as follows: