Esempio n. 1
0
 def evaluate(self, gamestate: GameState):
     number = 0
     for player in gamestate.players_for_type(self.type):
         condition = self.if_creator(ConstantPlayerChooser(player))
         if condition.evaluate(gamestate):
             number += 1
     return self.number_of_players == number
Esempio n. 2
0
 def apply(self, gamestate: GameState):
     current_player = gamestate.current_player()
     current_phase = gamestate.current_phase()
     player = self.player_chooser.submitted()
     gamestate.switch_player(player,
                             gamestate.current_phase_for_player(player))
     gamestate.switch_player(current_player, current_phase)
Esempio n. 3
0
    def auto_submitted_values(self, gamestate: GameState) -> list:
        player = self.other.submitted()
        all_players = gamestate.players_for_type(player.type)
        index = all_players.index(player)

        new_index = index
        for i in range(abs(self.step)):
            k = 1 if self.step > 0 else -1
            new_index = (new_index + k) % len(all_players)
            while self.condition is not None and self.condition(
                    gamestate, all_players[new_index]):
                new_index = (new_index + k) % len(all_players)

        #new_index = (index + self.step) % len(all_players)
        return [all_players[new_index]]
Esempio n. 4
0
 def auto_submitted_values(self, gamestate: GameState) -> list:
     return [gamestate.table_player()]
Esempio n. 5
0
 def auto_submitted_values(self, gamestate: GameState) -> list:
     player = self.player_picker.submitted()
     return [gamestate.actual_place(player, self.place)]
Esempio n. 6
0
 def apply(self, gamestate: GameState):
     player = self.player_chooser.submitted()
     if gamestate.current_player() != player:
         gamestate.switch_player(player, self.phase)
     else:
         gamestate.switch_phase(self.phase)
Esempio n. 7
0
 def auto_submitted_values(self, gamestate: GameState) -> list:
     return [gamestate.current_player_for_type(self.type)]
Esempio n. 8
0
 def evaluate(self, gamestate: GameState):
     #TODO to samo co w emptyplace, pozniej pomysle
     self.last_player_chooser.requires_player_input(gamestate)
     last_player = self.last_player_chooser.submitted()
     current_player = gamestate.current_player_for_type(self.player_type)
     return current_player is last_player
Esempio n. 9
0
 def auto_submitted_values(self, gamestate: GameState) -> list:
     return [gamestate.players_for_type(self.type)[0]]
Esempio n. 10
0
 def evaluate(self, gamestate: GameState):
     # TODO to samo co w emptyplace, pozniej pomysle
     self.current_player_chooser.requires_player_input(gamestate)
     current = self.current_player_chooser.submitted()
     return gamestate.current_phase_for_player(current) is self.phase