Example #1
0
 def set_color(self, stone: str):
     if self.stone in STONE:
         raise StoneException("Player is already registered")
     if stone not in STONE:
         raise StoneException("Invalid Stone in Player")
     self.stone = stone
Example #2
0
 def get_color(self):
     if self.stone:
         return self.stone
     else: 
         raise StoneException("Player color has not been set")
Example #3
0
def check_stone(Stone: str, Operation: str = ""):
    if Stone not in STONE:
        raise StoneException("Invalid Stone - cannot perform {} operation for stone: {}".format(Operation, Stone))
Example #4
0
 def get_stone(self):
     if self.received:
         return self.player.get_stone()
     else: 
         raise StoneException("Player has no stones")
Example #5
0
 def receive_stones(self, stone: str):
     if stone not in STONE: 
         raise StoneException("Invalid Stone in Player")
     self.stone = stone
Example #6
0
 def set_stone(self, stone: str):
     if not self.registered:
         raise PlayerException("Player has not been registered yet")
     if stone not in STONE:
         raise StoneException("Invalid Stone in Player")
     self.stone = stone
Example #7
0
def check_stone(Stone: str, Operation: str = ""):
    if (Stone not in STONE):
        raise StoneException("Invalid Stone - cannot perform " + Operation +
                             " operation")