예제 #1
0
파일: autocmd.py 프로젝트: wildertm/jytwai
 def classifierGenerator(self):
     if self.game.team.name == 'Red':
         botID = int(os.environ['red_team_bot_id'])
         classifier = pythonDbHandler.loadClassifier(botID)
     elif self.game.team.name == 'Blue':
         botID = int(os.environ['blue_team_bot_id'])
         classifier = pythonDbHandler.loadClassifier(botID)
     if classifier != None:
         self.botID = botID
         return classifier
     else:
         classifier = {
             commands.Attack: [[regressions.attackRegression, 1],
                               [regressions.botsInSightCone, 1]],
             'currentAction': [[regressions.currentActionRegression, 1],
                               [regressions.botsInSightCone, 1]],
             commands.Charge: [[regressions.chargeRegression, 1],
                               [regressions.botsInSightCone, 1]],
             commands.Move: [
                 [regressions.moveRegression, 1],
                 [regressions.botsInSightCone, 1],
             ],
             commands.Defend: [[regressions.defendRegression, 1],
                               [regressions.botsInSightCone, 1]]
         }
         return classifier
예제 #2
0
파일: autocmd.py 프로젝트: wildertm/jytwai
 def classifierGenerator(self):
     if self.game.team.name == 'Red':
         botID = int(os.environ['red_team_bot_id'])
         classifier = pythonDbHandler.loadClassifier(botID)
     elif self.game.team.name == 'Blue':
         botID = int(os.environ['blue_team_bot_id'])
         classifier = pythonDbHandler.loadClassifier(botID)
     if classifier != None:
         self.botID = botID
         return classifier 
     else:
         classifier = {
         commands.Attack : [[regressions.attackRegression, 1],
                            [regressions.botsInSightCone, 1]
                            ],
         'currentAction' : [[regressions.currentActionRegression, 1],
                            [regressions.botsInSightCone, 1]
                            ],
         commands.Charge : [[regressions.chargeRegression, 1],
                            [regressions.botsInSightCone, 1]
                            ],
         commands.Move : [[regressions.moveRegression, 1],
                          [regressions.botsInSightCone, 1],
                          ],
         commands.Defend : [[regressions.defendRegression, 1],
                            [regressions.botsInSightCone, 1]
                           ]
                     }
         return classifier
예제 #3
0
파일: mycmd.py 프로젝트: wildertm/jytwai
 def get_classifier_from_env(self):
     if self.game.team.name == 'Red':
         botID = int(os.environ['red_team_bot_id'])
         classifier = pythonDbHandler.loadClassifier(botID)
     elif self.game.team.name == 'Blue':
         botID = int(os.environ['blue_team_bot_id'])
         classifier = pythonDbHandler.loadClassifier(botID)
     if classifier != None:
         self.botID = botID
         return classifier
예제 #4
0
파일: mycmd.py 프로젝트: wildertm/jytwai
 def get_classifier_from_env(self):
     if self.game.team.name == 'Red':
         botID = int(os.environ['red_team_bot_id'])
         classifier = pythonDbHandler.loadClassifier(botID)
     elif self.game.team.name == 'Blue':
         botID = int(os.environ['blue_team_bot_id'])
         classifier = pythonDbHandler.loadClassifier(botID)
     if classifier != None:
         self.botID = botID	
         return classifier
예제 #5
0
 def get_offspring(self, parents, dead_bots):
     offspring = []
     for parent in parents.keys():
         classifier = pythonDbHandler.loadClassifier(parent)
         offspring.append((parent, copy.deepcopy(classifier)))
         #Replace the dead bot's classifiers with the living one at a time.
         bot_to_be_overwritten = dead_bots.pop()
         offspring.append((bot_to_be_overwritten, copy.deepcopy(classifier)))
     return offspring
예제 #6
0
 def get_offspring(self, parents, dead_bots):
     offspring = []
     for parent in parents.keys():
         classifier = pythonDbHandler.loadClassifier(parent)
         offspring.append((parent, copy.deepcopy(classifier)))
         #Replace the dead bot's classifiers with the living one at a time.
         bot_to_be_overwritten = dead_bots.pop()
         offspring.append(
             (bot_to_be_overwritten, copy.deepcopy(classifier)))
     return offspring
예제 #7
0
파일: mycmd.py 프로젝트: wildertm/jytwai
    def classifierGenerator(self):
        if LOAD:
            classifier = pythonDbHandler.loadClassifier(22)
            print classifier
        elif TRAINING:
            print "LOADING BOT"
            classifier = self.get_classifier_from_env()
        else:
            print "USING STOCK BOT"
            classifier = {commands.Charge: [#[regressions2.max_angles, 0.0],
            [regressions2.go_to_camp, 1.0],
            [regressions2.go_to_flank_brink, 15.0],
            [regressions2.spread_targets2, 1.0],
            [regressions2.camp_strategy_go_toward_flag, 2.0],
            [regressions2.enemy_distance, 10.0],
            [regressions2.friendly_to_enemy_ratio, 5.0],
            [regressions2.max_angles, 20.0],
            [regressions2.spread_targets2, 1.0]
            ],

            commands.Attack: [#[regressions2.max_angles, 0.0],
            [regressions2.go_to_camp, 1.0],
            [regressions2.go_to_flank_brink, 15.0],
            [regressions2.spread_targets2, 1.0],
            [regressions2.camp_strategy_go_toward_flag, 1.0],
            [regressions2.enemy_distance, 10.0],
            [regressions2.friendly_to_enemy_ratio, -5.0],
            [regressions2.max_angles, 20.0],
            [regressions2.spread_targets2, 1.0]
            ],

            commands.Move : [],

            commands.Defend : [[regressions2.evaluate_camp_command, 1000.0],
                               [regressions2.lower_redundant_camp_value, 20.0]]
            }
            
        return classifier
예제 #8
0
파일: mycmd.py 프로젝트: wildertm/jytwai
    def classifierGenerator(self):
        if LOAD:
            classifier = pythonDbHandler.loadClassifier(22)
            print classifier
        elif TRAINING:
            print "LOADING BOT"
            classifier = self.get_classifier_from_env()
        else:
            print "USING STOCK BOT"
            classifier = {
                commands.Charge: [  #[regressions2.max_angles, 0.0],
                    [regressions2.go_to_camp, 1.0],
                    [regressions2.go_to_flank_brink, 15.0],
                    [regressions2.spread_targets2, 1.0],
                    [regressions2.camp_strategy_go_toward_flag, 2.0],
                    [regressions2.enemy_distance, 10.0],
                    [regressions2.friendly_to_enemy_ratio, 5.0],
                    [regressions2.max_angles, 20.0],
                    [regressions2.spread_targets2, 1.0]
                ],
                commands.Attack: [  #[regressions2.max_angles, 0.0],
                    [regressions2.go_to_camp, 1.0],
                    [regressions2.go_to_flank_brink, 15.0],
                    [regressions2.spread_targets2, 1.0],
                    [regressions2.camp_strategy_go_toward_flag, 1.0],
                    [regressions2.enemy_distance, 10.0],
                    [regressions2.friendly_to_enemy_ratio, -5.0],
                    [regressions2.max_angles, 20.0],
                    [regressions2.spread_targets2, 1.0]
                ],
                commands.Move: [],
                commands.Defend:
                [[regressions2.evaluate_camp_command, 1000.0],
                 [regressions2.lower_redundant_camp_value, 20.0]]
            }

        return classifier