[docs]classPlayer(ABC):def__init__(self,player_logic:"PlayerLogic")->None:# type: ignore # noqa: F821self.game_state=player_logic.game_stateself.undo_stack=Stack()# For undo and redo functionality
[docs]@abstractmethoddefundo(self,item:tuple)->None:iflen(self.game_state._board)==0:raiseself.game_state._board.EmptyBoardError("Cannot undo from empty board.")# Item can be guess or feedback, varies by player typeself.undo_stack.push(item)
[docs]defredo(self)->None:iflen(self.undo_stack)==0:raiseIndexError("Cannot undo from empty board.")returnself.undo_stack.pop()