コード例 #1
0
 def getAction(self, player: Player) -> Action:
     if player.isAI():
         return player.getAction(self.game)
     # Ask the user fo the action.
     while True:
         try:
             col = int(
                 input(" ".join([
                     self._playerCallout(player),
                     "Select a column on which to drop the token: "
                 ]))) - 1
             if (Action.isValid(col) and self.game.isValid(col)):
                 return Action(col)
         except ValueError:
             pass
         print(" ".join([self._playerCallout(player), "Invalid action."]))