示例#1
0
文件: mycmd.py 项目: wildertm/jytwai
    def initialize(self):
        """Use this function to setup your bot before the game starts."""
        self.GRAPHICS = True
        #Initialized a graphical representation of work and the graph.
        #Makes 88x50 graph with adjacent squares having edges.
        #CALLS regressions2.make_graph to do this.
        regressions2.make_graph(self)
        regressions2.update_graph(self)

        if self.GRAPHICS:
            regressions2.initialize_graphics(self)        
            #Calculate initial probability distribution for location of enemies.
            #Show initial gui graphics.
            regressions2.update_graphics_probability(self, mode = "p_enemy")
            self.visualizer.tick()
        
        self.verbose = True
        self.counter = 0
        
        #Used to store bots current command.
        self.bots = {}
        for bot in self.game.team.members:
            self.bots[bot.name] = {}
            self.bots[bot.name]["command"] = None
            
        # Classifier: Structured as {commands.Attack : (regression0, coefficient0), (regression1, coefficient1}... commands.Defend : (regression0.....)}
        self.classifier = self.classifierGenerator()
        print 'DONE initializing'
示例#2
0
文件: mycmd.py 项目: wildertm/jytwai
    def initialize(self):
        """Use this function to setup your bot before the game starts."""
        self.GRAPHICS = True
        #Initialized a graphical representation of work and the graph.
        #Makes 88x50 graph with adjacent squares having edges.
        #CALLS regressions2.make_graph to do this.
        regressions2.make_graph(self)
        regressions2.update_graph(self)

        if self.GRAPHICS:
            regressions2.initialize_graphics(self)
            #Calculate initial probability distribution for location of enemies.
            #Show initial gui graphics.
            regressions2.update_graphics_probability(self, mode="p_enemy")
            self.visualizer.tick()

        self.verbose = True
        self.counter = 0

        #Used to store bots current command.
        self.bots = {}
        for bot in self.game.team.members:
            self.bots[bot.name] = {}
            self.bots[bot.name]["command"] = None

        # Classifier: Structured as {commands.Attack : (regression0, coefficient0), (regression1, coefficient1}... commands.Defend : (regression0.....)}
        self.classifier = self.classifierGenerator()
        print 'DONE initializing'
示例#3
0
文件: mycmd.py 项目: wildertm/jytwai
 def graphics_tick(self):
     if self.GRAPHICS:
         regressions2.update_graphics_probability(self, mode=self.GRAPHICS)
         self.visualizer.tick()
     elif self.DRAW_POINTS:
         regressions2.draw_points(self, self.points)
         self.visualizer.tick()
         self.visibilities.fill(0)
示例#4
0
文件: mycmd.py 项目: wildertm/jytwai
 def graphics_tick(self):
     if self.GRAPHICS:
         regressions2.update_graphics_probability(self, mode = self.GRAPHICS) 
         self.visualizer.tick()
     elif self.DRAW_POINTS:
         regressions2.draw_points(self, self.points)
         self.visualizer.tick()
         self.visibilities.fill(0)
示例#5
0
文件: mycmd.py 项目: wildertm/jytwai
    def initialize(self):
        """Use this function to setup your bot before the game starts."""
        self.points = []
        self.verbose = True
        self.counter = 0
        self.enemies = {}
        self.botID = None
        self.HOLD_RATE = 10
        self.COMMAND_RATE = 35
        self.AVAIL_RATE = 3
        self.SUICIDE_CHECK_RATE = 4
        #Number of ticks between storage of enemy position for extrapolation.
        self.EXTRAP_STORE_RATE = 15

        #Used to tell whether the bot is calculating actions.
        self.computing = False

        #Used to store bots current command.
        self.bots = {}
        for bot in self.game.team.members:
            self.bots[bot.name] = {}
            self.bots[bot.name]["command"] = None
            self.bots[bot.name]["last_command_time"] = -5.0
            self.bots[bot.name]["visibility"] = set()

        # Classifier: Structured as {commands.Attack : (regression0, coefficient0), (regression1, coefficient1}... commands.Defend : (regression0.....)}
        self.classifier = self.classifierGenerator()

        #GRAPHICS LOGIC
        #Toggles graphics to desired display. Must be off to submit!!!
        ##        self.GRAPHICS = "p_enemy"
        ##        self.GRAPHICS = "p_enemy_sight"
        ##        self.GRAPHICS = "p_enemy_fire"
        ##        self.GRAPHICS = "ambush"
        ##        self.GRAPHICS = "pheremone"
        ##        self.GRAPHICS = "exit_path"
        ##        self.GRAPHICS = "camp_target"
        ##        self.GRAPHICS = "choke_covered"
        ##        self.GRAPHICS = "camp_location"

        self.GRAPHICS = False

        #Toggles drawing helper points.
        ##        self.DRAW_POINTS = "extrap"
        self.DRAW_POINTS = "flanking"
        ##        self.DRAW_POINTS = "camp"
        ##        self.DRAW_POINTS = False

        #Refactoring functional self variables here for easy tweaking.
        #At what distance do we cut off speculation on an enemy's location?
        self.MAX_ENEMY_DISTANCE = 25
        #Variable used in enemy_belief to determine how many points to do sight calcs on.
        self.TOTAL_FS_NODES = 13
        #Determines minimum probability of an enemy being in a node for it to be evaluated.
        self.MINIMUM_ENEMY_PROB = 0.01

        #Initialized a graphical representation of work and the graph.
        #Makes 88x50 graph with adjacent squares having edges.
        #CALLS regressions2.make_graph to do this.
        regressions2.make_graph(self)
        ##        regressions2.calculate_control_main_route2(self)
        self.camp_positions = spawn_camp.calculate_spawn_camp(self)
        regressions2.update_graph(self)

        if self.GRAPHICS or self.DRAW_POINTS:
            regressions2.initialize_graphics(self)
            #Calculate initial probability distribution for location of enemies.
            #Show initial gui graphics.
            regressions2.update_graphics_probability(self, mode=self.GRAPHICS)
            self.visualizer.tick()

        print 'DONE initializing'
示例#6
0
文件: mycmd.py 项目: wildertm/jytwai
    def initialize(self):
        """Use this function to setup your bot before the game starts."""
        self.points = []
        self.verbose = True
        self.counter = 0
        self.enemies = {}
        self.botID = None
        self.HOLD_RATE = 10
        self.COMMAND_RATE = 35
        self.AVAIL_RATE = 3
        self.SUICIDE_CHECK_RATE = 4
        #Number of ticks between storage of enemy position for extrapolation.
        self.EXTRAP_STORE_RATE = 15

        #Used to tell whether the bot is calculating actions.
        self.computing = False
        
        #Used to store bots current command.
        self.bots = {}
        for bot in self.game.team.members:
            self.bots[bot.name] = {}
            self.bots[bot.name]["command"] = None
            self.bots[bot.name]["last_command_time"] = -5.0
            self.bots[bot.name]["visibility"] = set()
            
        # Classifier: Structured as {commands.Attack : (regression0, coefficient0), (regression1, coefficient1}... commands.Defend : (regression0.....)}
        self.classifier = self.classifierGenerator()

        #GRAPHICS LOGIC     
        #Toggles graphics to desired display. Must be off to submit!!!
##        self.GRAPHICS = "p_enemy"
##        self.GRAPHICS = "p_enemy_sight"
##        self.GRAPHICS = "p_enemy_fire"
##        self.GRAPHICS = "ambush"
##        self.GRAPHICS = "pheremone"      
##        self.GRAPHICS = "exit_path"
##        self.GRAPHICS = "camp_target"
##        self.GRAPHICS = "choke_covered"
##        self.GRAPHICS = "camp_location"
        
        self.GRAPHICS = False
        
        #Toggles drawing helper points.
##        self.DRAW_POINTS = "extrap"
        self.DRAW_POINTS = "flanking"
##        self.DRAW_POINTS = "camp"
##        self.DRAW_POINTS = False
        
        #Refactoring functional self variables here for easy tweaking.
        #At what distance do we cut off speculation on an enemy's location?
        self.MAX_ENEMY_DISTANCE = 25
        #Variable used in enemy_belief to determine how many points to do sight calcs on. 
        self.TOTAL_FS_NODES = 13
        #Determines minimum probability of an enemy being in a node for it to be evaluated.
        self.MINIMUM_ENEMY_PROB = 0.01
        
        #Initialized a graphical representation of work and the graph.
        #Makes 88x50 graph with adjacent squares having edges.
        #CALLS regressions2.make_graph to do this.
        regressions2.make_graph(self)
##        regressions2.calculate_control_main_route2(self)
        self.camp_positions = spawn_camp.calculate_spawn_camp(self)
        regressions2.update_graph(self)
        
        if self.GRAPHICS or self.DRAW_POINTS:
            regressions2.initialize_graphics(self)   
            #Calculate initial probability distribution for location of enemies.
            #Show initial gui graphics.
            regressions2.update_graphics_probability(self, mode = self.GRAPHICS)
            self.visualizer.tick()

        print 'DONE initializing'
示例#7
0
文件: mycmd.py 项目: wildertm/jytwai
 def graphics_tick(self):
     if self.GRAPHICS == True:
         regressions2.update_graphics_probability(self, mode = "p_enemy_fire") 
         self.visualizer.tick()      
示例#8
0
文件: mycmd.py 项目: wildertm/jytwai
 def graphics_tick(self):
     if self.GRAPHICS == True:
         regressions2.update_graphics_probability(self, mode="p_enemy_fire")
         self.visualizer.tick()