Example #1
0
    def command_routine(self):
        for bot in self.game.team.members:           
            #If it makes sense to move, evaluate actions and take the best. Otherwise don't waste processing power calculating an action.
            no_command = self.check_to_see_if_no_command(bot)
            if no_command == False and bot.health > 0 or bot in self.game.bots_available:
                legalActions = self.get_p_actions(bot)
                command, value = self.get_action(bot, legalActions)
                
                #Consider whether the strength of continuing the current command and hence having no command wait is superior.
                #If it isn't, issue the command, otherwise, continue the present command.

                #Resets bots' stored commands to None who are dead or have finished a task.
                self.refresh_bot_commands()
                if self.bots[bot.name]["command"] != None:
                    continue_value = regressions2.evaluate_continue_present_command(self, bot, command)
                    if continue_value > value: #TODO calibrate skipping
                        continue
                self.issue_cmd(command)
Example #2
0
    def command_routine(self):
        for bot in self.game.team.members:
            #If it makes sense to move, evaluate actions and take the best. Otherwise don't waste processing power calculating an action.
            no_command = self.check_to_see_if_no_command(bot)
            if no_command == False and bot.health > 0 or bot in self.game.bots_available:
                legalActions = self.get_p_actions(bot)
                command, value = self.get_action(bot, legalActions)

                #Consider whether the strength of continuing the current command and hence having no command wait is superior.
                #If it isn't, issue the command, otherwise, continue the present command.

                #Resets bots' stored commands to None who are dead or have finished a task.
                self.refresh_bot_commands()
                if self.bots[bot.name]["command"] != None:
                    continue_value = regressions2.evaluate_continue_present_command(
                        self, bot, command)
                    if continue_value > value:  #TODO calibrate skipping
                        continue
                self.issue_cmd(command)
Example #3
0
    def tick(self):
        """Routine to deal with new information every interval of about .1s"""

        self.counter += 1
        # Refreshes visuals
        if self.counter % 15 == 0:
            ##            regressions2.update_graphics(self)
            enemy_belief.update_enemy_graph(self)
            self.visualizer.tick()
            # Updates graph info
            regressions2.update_graph(self)

        test_enemy = self.game.enemyTeam.members[0]
        if self.counter % 20 == 0:
            pass
        ##            print "health: " , test_enemy.health
        ##            print "state: ", test_enemy.state
        ##            print "position: ", test_enemy.position
        ##            print "facingDirection: ", test_enemy.facingDirection

        for bot in self.game.team.members:

            # If it makes sense to move, evaluate actions and take the best. Otherwise don't waste processing power calculating an action.
            can_shoot_enemy, no_enemy_sighted = self.check_to_see_if_no_command(bot)
            if (
                self.counter % 15 == 0
                and can_shoot_enemy == False
                and bot.health > 0
                or bot in self.game.bots_available
            ):
                legalActions = self.get_p_actions(bot)
                command, value = self.get_action(bot, legalActions)

                # Consider whether the strength of continuing the current command and hence having no command wait is superior.
                # If it isn't, issue the command, otherwise, continue the present command.

                # Resets bots' stored commands to None who are dead or have finished a task.
                self.refresh_bot_commands()
                if self.bots[bot.name]["command"] != None:
                    continue_value = regressions2.evaluate_continue_present_command(self, bot, command)
                    if continue_value > value:  # TODO calibrate skipping
                        continue
                self.issueCMD(command)
Example #4
0
    def tick(self):
        """Routine to deal with new information every interval of about .1s"""

        self.counter += 1
        #Refreshes visuals
        if self.counter % 15 == 0:
            ##            regressions2.update_graphics(self)
            enemy_belief.update_enemy_graph(self)
            self.visualizer.tick()
            #Updates graph info
            regressions2.update_graph(self)

        test_enemy = self.game.enemyTeam.members[0]
        if self.counter % 20 == 0:
            pass
##            print "health: " , test_enemy.health
##            print "state: ", test_enemy.state
##            print "position: ", test_enemy.position
##            print "facingDirection: ", test_enemy.facingDirection

        for bot in self.game.team.members:

            #If it makes sense to move, evaluate actions and take the best. Otherwise don't waste processing power calculating an action.
            can_shoot_enemy, no_enemy_sighted = self.check_to_see_if_no_command(
                bot)
            if self.counter % 15 == 0 and can_shoot_enemy == False and bot.health > 0 or bot in self.game.bots_available:
                legalActions = self.get_p_actions(bot)
                command, value = self.get_action(bot, legalActions)

                #Consider whether the strength of continuing the current command and hence having no command wait is superior.
                #If it isn't, issue the command, otherwise, continue the present command.

                #Resets bots' stored commands to None who are dead or have finished a task.
                self.refresh_bot_commands()
                if self.bots[bot.name]["command"] != None:
                    continue_value = regressions2.evaluate_continue_present_command(
                        self, bot, command)
                    if continue_value > value:  #TODO calibrate skipping
                        continue
                self.issueCMD(command)