Esempio n. 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
Esempio n. 2
0
 def get_color(self):
     if self.stone:
         return self.stone
     else: 
         raise StoneException("Player color has not been set")
Esempio n. 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))
Esempio n. 4
0
 def get_stone(self):
     if self.received:
         return self.player.get_stone()
     else: 
         raise StoneException("Player has no stones")
Esempio n. 5
0
 def receive_stones(self, stone: str):
     if stone not in STONE: 
         raise StoneException("Invalid Stone in Player")
     self.stone = stone
Esempio n. 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
Esempio n. 7
0
def check_stone(Stone: str, Operation: str = ""):
    if (Stone not in STONE):
        raise StoneException("Invalid Stone - cannot perform " + Operation +
                             " operation")