import Board class Field(): """ Class of single field on game board :version: 0.1 :author: Martin Putzlocher """ """ ATTRIBUTES board (private) occupied (private) number (private) color (private) """ def __init__(self, board:Board.Board=None, number:int=0, color:str="black", house:bool=False): if board is None: raise Exception("No Board Exception") self.board = board self._n = number self._c = color self._h = house self._id = "" self.set_id(color, number, house) def get_id(self): """ Get ID of field instance """ return self._id def set_id(self, color:str, number:int, house:bool): """ Set ID of field instance :param color:str: :param number:int: :param house:bool: """ if house: assert 0 <= number <= 3 self._id = "H" + color[:3] + str(number) else: assert 0 <= number <= 10 self._id = "S" + color[:3] + str(number) return self._id def get_next_field(self, color_of_stone = "black"): """Give back next field on board, dependent on the color of a stone on the current field. :param color_of_stone: Default value = "black") :returns: Field : @author : Martin Putzlocher """ return self.board.get_next_field_by_color(self, color_of_stone)