Ejemplo n.º 1
0
    def __init__(self, bzrc):
        self.bzrc = bzrc
        init_window(800, 800)
        self.constants = self.bzrc.get_constants()

        self.obsOcc = float(self.constants['truepositive'])
        self.notObsNotOcc = float(self.constants['truenegative'])
        self.obsNotOcc = 1 - self.notObsNotOcc
        self.notObsOcc = 1 - self.obsOcc
        self.positive_threshold = .9999999
        self.negative_threshold = .0000001
        self.add_obstacle_counter = 0
        self.vision_range = 75

        self.commands = []
        self.mytanks = [tank for tank in self.bzrc.get_mytanks()]

        self.init_common_potential_fields()
        self.get_mycolor()

        for idx, tank in enumerate(self.mytanks):
            self.mytanks[idx].role = None
            self.mytanks[idx].field = None

        self.grid = numpy.array([[0.25 for x in range(0, 800)]
                                 for y in range(0, 800)])
Ejemplo n.º 2
0
    def __init__(self, bzrc):
        self.bzrc = bzrc
        init_window(800, 800)
        self.constants = self.bzrc.get_constants()

        self.obsOcc = float(self.constants['truepositive'])
        self.notObsNotOcc = float(self.constants['truenegative'])
        self.obsNotOcc = 1 - self.notObsNotOcc
        self.notObsOcc = 1 - self.obsOcc
        self.positive_threshold = .9999999
        self.negative_threshold = .0000001
        self.add_obstacle_counter = 0
        self.vision_range = 75

        self.commands = []
        self.mytanks = [tank for tank in self.bzrc.get_mytanks()]

        self.init_common_potential_fields()
        self.get_mycolor()

        for idx, tank in enumerate(self.mytanks):
            self.mytanks[idx].role = None
            self.mytanks[idx].field = None

        self.grid = numpy.array([[0.25 for x in range(0,800)] for y in range(0,800)])
Ejemplo n.º 3
0
 def __init__(self, bzrc):
     self.bzrc = bzrc
     self.constants = self.bzrc.get_constants()
     print self.constants
     self.true_pos = float(self.constants['truepositive'])
     self.true_neg = float(self.constants['truenegative'])
     self.map_size = int(self.constants['worldsize'])
     self.commands = []
     self.start_tank_angles = {}
     self.ticks_passed = 500
     self.grid = np.zeros((self.map_size,self.map_size))
     self.grid.fill(.5)
     gl.init_window(self.map_size, self.map_size) 
     self.ticks_since_turn = 0;
Ejemplo n.º 4
0
 def __init__(self, bzrc):
     self.bzrc = bzrc
     self.constants = self.bzrc.get_constants()
     self.commands = []
     bases = self.bzrc.get_bases()
     for base in bases:
         if base.color == self.constants['team']:
             self.base = Answer()
             self.base.x = (base.corner1_x + base.corner3_x) / 2
             self.base.y = (base.corner1_y + base.corner3_y) / 2
     self.grid = np.zeros(shape=(int(self.constants['worldsize']),
                                 int(self.constants['worldsize'])))
     for row in range(len(self.grid)):
         for col in range(len(self.grid)):
             self.grid[row][col] = .5
     self.previousOutput = np.zeros(
         shape=(int(self.constants['worldsize']),
                int(self.constants['worldsize'])))
     self.tank = {}
     # print "tank location: x: "+str(self.tank.x)+" y: "+str(self.tank.y)
     grid_filter_gl.init_window(800, 800)
     self.grid_size = 100
     self.points = []
     self.prior = .5
     self.threshold = .5
     self.chosenX = 0
     self.chosenY = 0
     self.needGoal = True
     self.trueP = float(self.constants['truepositive'])
     self.trueN = float(self.constants['truenegative'])
     worldsize = int(self.constants['worldsize'])
     for i in range(self.grid_size / 2 - worldsize / 2, worldsize / 2,
                    self.grid_size):
         for j in range(self.grid_size / 2 - worldsize / 2, worldsize / 2,
                        self.grid_size):
             self.points.append((i, j))
     self.timer = 0
     self.past_position = {}
     self.goals = {}
     self.stuck = {}
     self.stuck_count = 0
     self.last_x = 0
     self.last_y = 0
     self.mytanks, othertanks, flags, shots = self.bzrc.get_lots_o_stuff()
     for tank in self.mytanks:
         self.past_position[tank.index] = tank.x, tank.y
         self.bzrc.speed(tank.index, 1)
         self.goals[tank.index] = None
         self.stuck[tank.index] = 0
     self.update(0)
Ejemplo n.º 5
0
 def __init__(self, bzrc):
     self.bzrc = bzrc
     self.constants = self.bzrc.get_constants()
     self.commands = []
     bases = self.bzrc.get_bases()
     for base in bases:
         if base.color == self.constants['team']:
             self.base = Answer()
             self.base.x = (base.corner1_x+base.corner3_x)/2
             self.base.y = (base.corner1_y+base.corner3_y)/2
     self.grid = np.zeros(shape=(int(self.constants['worldsize']),int(self.constants['worldsize'])))
     for row in range(len(self.grid)):
         for col in range(len(self.grid)):
             self.grid[row][col]=.5
     self.previousOutput = np.zeros(shape=(int(self.constants['worldsize']),int(self.constants['worldsize'])))
     self.tank={}
     # print "tank location: x: "+str(self.tank.x)+" y: "+str(self.tank.y)
     grid_filter_gl.init_window(800, 800)
     self.grid_size = 100
     self.points = []
     self.prior = .5
     self.threshold = .5
     self.chosenX=0
     self.chosenY=0
     self.needGoal=True
     self.trueP=float(self.constants['truepositive'])
     self.trueN=float(self.constants['truenegative'])
     worldsize = int(self.constants['worldsize'])
     for i in range(self.grid_size / 2 - worldsize / 2, worldsize / 2, self.grid_size):
         for j in range(self.grid_size / 2 - worldsize / 2, worldsize / 2, self.grid_size):
             self.points.append((i, j))
     self.timer = 0
     self.past_position = {}
     self.goals = {}
     self.stuck = {}
     self.stuck_count = 0
     self.last_x = 0
     self.last_y = 0
     self.mytanks, othertanks, flags, shots = self.bzrc.get_lots_o_stuff()
     for tank in self.mytanks:
         self.past_position[tank.index] = tank.x, tank.y
         self.bzrc.speed(tank.index, 1)
         self.goals[tank.index] = None
         self.stuck[tank.index] = 0
     self.update(0)
Ejemplo n.º 6
0
    def __init__(self, bzrc):
        self.bzrc = bzrc
        self.constants = self.bzrc.get_constants()
        self.constants["truepositive"] = float(self.constants["truepositive"])
        self.constants["truenegative"] = float(self.constants["truenegative"])
        self.constants["falsepositive"] = 1 - self.constants["truepositive"]
        self.constants["falsenegative"] = 1 - self.constants["truenegative"]
        self.constants["worldsize"] = int(self.constants["worldsize"])
        self.commands = []
        self.obstacles = []
        self.iterations = 0

        # initialize the global occupancy grid
        self.grid = [[0.4 for i in range(int(self.constants["worldsize"]))] for j in range(int(self.constants["worldsize"]))]

        self.search_grid = [[False for i in range(self.constants["worldsize"]/SEARCH_GRID_SIZE)] for j in range(self.constants["worldsize"]/SEARCH_GRID_SIZE)]

        grid_filter_gl.init_window(int(self.constants["worldsize"]), int(self.constants["worldsize"]))
        print self.constants