Пример #1
0
 def generateControl(self, gameData, playerId):
     act = Support.randomFromList(self.actionName)
     fr = Support.randomFromList(self.firstName)
     sc = Support.randomFromList(self.secondName)
     th = Support.randomFromList(self.thirdName)
     
     fullName = act + " " + fr + " " + sc + " " + th
     print "Generated control with name " + fullName
     return Control(playerId, fullName, str(gameData.getFreeControlId()))
Пример #2
0
 def generateTasks (self , gameData, fixedTask=None, fixedTime=None):
     for (pid, pdata) in gameData.player.iteritems():
         if not gameData.hasTasks (pid):
             print "Generating task for player " + pid
             
             acts = gameData.getPossibleActions()
             if len(acts) > 0:
                 if fixedTask == None: 
                     ourAct = Support.randomFromList(acts)
                 else:
                     ourAct = acts[fixedTask]
                     
                 if fixedTime == None:
                     runtime = random.randint(self.taskTime[0], self.taskTime[1])
                 else:
                     runtime = fixedTime
                     
                 gameData.currentTasks += [ Task(ourAct[1], ourAct[0], pid, runtime) ]
                 print "> Task added"