Exemple #1
0
    def mid(self, state, sim):
        if state == "FREE_BALL_YOURS":

            # ON
            #####################################

            ball_field = P.radial(self.world.ball, 1, -200)# -5

            friend_field = P.solid_field(self.world.friend.position, 1, 15, ROBOT_SIZE, ROBOT_INFLUENCE_SIZE)
            enemy1_field = P.solid_field(self.world.enemy1.position, 1, 15, ROBOT_SIZE, ROBOT_INFLUENCE_SIZE)
            enemy2_field = P.solid_field(self.world.enemy2.position, 1, 15, ROBOT_SIZE, ROBOT_INFLUENCE_SIZE)

            advance = P.step_field(self.world.friend.position, rotate_vector(-90, get_play_direction(self.world)[0], get_play_direction(self.world)[1]), 2000, 1, 0)
            catch_up = P.step_field(self.world.venus.position, rotate_vector(-90, get_play_direction(self.world)[0], get_play_direction(self.world)[1]), 2000, 1, 0)


            # BUILD FIELD AND NEXT POSITION AND DIRECTIONS
            ####################################
            # todo too reliant on vision, must pick what to use for look ahead

            self.current_point = (self.world.venus.position[0], self.world.venus.position[1])
            self.current_direction = (self.world.venus.orientation[0], self.world.venus.orientation[1])

            potentials = [ball_field, friend_field, enemy1_field, enemy2_field, advance, catch_up] #todo add advance and catch up
            potential = Potential(self.current_point, self.current_direction, self.world, potentials)


            # MOTION
            #######################################
            if sim is False:
                angle, motion_length = self.calculate_angle_length_ball()
                #print "moving = " + str(self.world.ball_moving[0])
                if motion_length < 40 and potential.get_potential() < -0.7:
                    self.world.sensor = True
                    self.world.undistort[0] = 1
                    print("HAS BALL IN RANGE")
                    self.commands.s()
                    time.sleep(.5)
                    angle, motion_length = self.calculate_angle_length_ball()
                    self.commands.o()
                    self.commands.c(angle)

                    angle, motion_length = self.calculate_angle_length_ball()

                    if PITCH_COLS/4.0 <= self.world.venus.position[0] <= 3.0*PITCH_COLS/4.0:
                        #print "FIX A"
                        fix = 7
                    else:
                        #print "FIX B"
                        fix = 2
                    self.commands.f(motion_length - fix)  # todo hack
                    self.commands.g()
                    time.sleep(.5)
                    # todo need to implement considering objects
                    #if self.commands.query_ball() or self.commands.query_ball():
                    #    print("It thinks it has the ball")
                    #    #exit(0)
                else:
                    self.current_force = potential.get_force()
                    #print self.current_force
                    bearing = self.calculate_angle(self.current_force)
                    #print bearing
                    self.commands.move(bearing, 0)
                    #self.local_potential, self.points = potential.get_local_potential()

            ########################################

            # TESTING
            ########################################
            else:
                potential.map(num)

            ########################################

            ###########################################################################################################################################

        elif state == "FREE_BALL_2_GOALSIDE":

            # ON
            #####################################

            friend_field = P.solid_field(self.world.friend.position, 1, 15, ROBOT_SIZE, ROBOT_INFLUENCE_SIZE)
            enemy1_field = P.solid_field(self.world.enemy1.position, 1, 15, ROBOT_SIZE, ROBOT_INFLUENCE_SIZE)
            enemy2_field = P.solid_field(self.world.enemy2.position, 1, 15, ROBOT_SIZE, ROBOT_INFLUENCE_SIZE)

            advance = P.step_field(self.world.friend.position, rotate_vector(-90, get_play_direction(self.world)[0], get_play_direction(self.world)[1]), POSITION_INFLUENCE_RANGE, 1, 0)
            catch_up = P.step_field(self.world.venus.position, rotate_vector(-90, get_play_direction(self.world)[0], get_play_direction(self.world)[1]), POSITION_INFLUENCE_RANGE, 1, 0)

            if self.world.enemy1.out[0] == 0:
                free_up_pass_enemy1 = P.finite_axial_outside(self.world.enemy1.position, self.world.friend.position, POSITION_INFLUENCE_RANGE, 1.3, 2.5)
            else:
                free_up_pass_enemy1 = P.finite_axial_outside(self.world.enemy1.position, self.world.friend.position, POSITION_INFLUENCE_RANGE, 1.3, 0)

            if self.world.enemy2.out[0] == 0:
                free_up_goal_enemy2 = P.finite_axial_outside(self.world.enemy2.position, (self.world.their_goalX, self.world.their_goalmeanY), POSITION_INFLUENCE_RANGE, 1.3, 2.5)
            else:
                free_up_goal_enemy2 = P.finite_axial_outside(self.world.enemy2.position, (self.world.their_goalX, self.world.their_goalmeanY), POSITION_INFLUENCE_RANGE, 1.3, 0)
            # BUILD FIELD AND NEXT POSITION AND DIRECTIONS
            ####################################
            # todo too reliant on vision, must pick what to use for look ahead
            self.current_point = (self.world.venus.position[0], self.world.venus.position[1])
            self.current_direction = (self.world.venus.orientation[0], self.world.venus.orientation[1])

            potentials = [friend_field, enemy1_field, enemy2_field, free_up_pass_enemy1, free_up_goal_enemy2, advance, catch_up]
            potential = Potential(self.current_point, self.current_direction, self.world, potentials)

            # MOTION
            #######################################
            if sim is False:
                self.current_force = potential.get_force()
                #print self.current_force
                bearing = self.calculate_angle(self.current_force)
                #print bearing
                self.commands.move(bearing, 0)

            ########################################

            # TESTING
            ########################################
            else:
                potential.map(num)
            ########################################

            ###########################################################################################################################################

        elif state == "FREE_BALL_1_GOALSIDE":

            # ON
            #####################################

            friend_field = P.solid_field(self.world.friend.position, 1, 15, ROBOT_SIZE, ROBOT_INFLUENCE_SIZE)
            enemy1_field = P.solid_field(self.world.enemy1.position, 1, 15, ROBOT_SIZE, ROBOT_INFLUENCE_SIZE)
            enemy2_field = P.solid_field(self.world.enemy2.position, 1, 15, ROBOT_SIZE, ROBOT_INFLUENCE_SIZE)

            advance = P.step_field(self.world.friend.position, rotate_vector(-90, get_play_direction(self.world)[0], get_play_direction(self.world)[1]), 2000, 1, 0)
            catch_up = P.step_field(self.world.venus.position, rotate_vector(-90, get_play_direction(self.world)[0], get_play_direction(self.world)[1]), 2000, 1, 0)

            if self.world.enemy2.out[0] == 0:
                free_up_pass_enemy2 = P.finite_axial_outside(self.world.enemy1.position, self.world.friend.position, POSITION_INFLUENCE_RANGE, 1.3, 2.5)
            else:
                free_up_pass_enemy2 = P.finite_axial_outside(self.world.enemy1.position, self.world.friend.position, POSITION_INFLUENCE_RANGE, 1.3, 0)

            if self.world.enemy1.out[0] == 0:
                free_up_goal_enemy1 = P.finite_axial_outside(self.world.enemy2.position, (self.world.their_goalX, self.world.their_goalmeanY), POSITION_INFLUENCE_RANGE, 1.3, 2.5)
            else:
                free_up_goal_enemy1 = P.finite_axial_outside(self.world.enemy2.position, (self.world.their_goalX, self.world.their_goalmeanY), POSITION_INFLUENCE_RANGE, 1.3, 0)

            # BUILD FIELD AND NEXT POSITION AND DIRECTIONS
            ####################################
            # todo too reliant on vision, must pick what to use for look ahead
            self.current_point = (self.world.venus.position[0], self.world.venus.position[1])
            self.current_direction = (self.world.venus.orientation[0], self.world.venus.orientation[1])

            potential = [friend_field, enemy1_field, enemy2_field, free_up_pass_enemy2, free_up_goal_enemy1,advance, catch_up]
            potential = Potential(self.current_point, self.current_direction, self.world, potential)

            # MOTION
            #######################################
            if sim is False:
                self.current_force = potential.get_force()
                #print self.current_force
                bearing = self.calculate_angle(self.current_force)
                #print bearing
                self.commands.move(bearing, 0)

            ########################################

            # TESTING
            ########################################
            else:
                potential.map()
            ########################################

            ###########################################################################################################################################

        elif state == "FREE_BALL_BOTH_GOALSIDE":

            # ON
            #####################################

            friend_field = P.solid_field(self.world.friend.position, 1, 15, ROBOT_SIZE, ROBOT_INFLUENCE_SIZE)
            enemy1_field = P.solid_field(self.world.enemy1.position, 1, 15, ROBOT_SIZE, ROBOT_INFLUENCE_SIZE)
            enemy2_field = P.solid_field(self.world.enemy2.position, 1, 15, ROBOT_SIZE, ROBOT_INFLUENCE_SIZE)

            advance = P.step_field(self.world.friend.position, rotate_vector(-90, get_play_direction(self.world)[0], get_play_direction(self.world)[1]), 2000, 1, 0)
            catch_up = P.step_field(self.world.venus.position, rotate_vector(-90, get_play_direction(self.world)[0], get_play_direction(self.world)[1]), 2000, 1, 0)

            if self.world.enemy2.out[0] == 0:
                free_up_goal_enemy2 = P.finite_axial_outside(self.world.enemy1.position, (self.world.their_goalX, self.world.their_goalmeanY), POSITION_INFLUENCE_RANGE, 1.3, 2.5)
            else:
                free_up_goal_enemy2 = P.finite_axial_outside(self.world.enemy1.position, (self.world.their_goalX, self.world.their_goalmeanY), POSITION_INFLUENCE_RANGE, 1.3, 0)

            if self.world.enemy1.out[0] == 0:
                free_up_goal_enemy1 = P.finite_axial_outside(self.world.enemy2.position, (self.world.their_goalX, self.world.their_goalmeanY), POSITION_INFLUENCE_RANGE, 1.3, 2.5)
            else:
                free_up_goal_enemy1 = P.finite_axial_outside(self.world.enemy2.position, (self.world.their_goalX, self.world.their_goalmeanY), POSITION_INFLUENCE_RANGE, 1.3, 2.5)

            # BUILD FIELD AND NEXT POSITION AND DIRECTIONS
            ####################################
            # todo too reliant on vision, must pick what to use for look ahead
            self.current_point = (self.world.venus.position[0], self.world.venus.position[1])
            self.current_direction = (self.world.venus.orientation[0], self.world.venus.orientation[1])

            potentials = [friend_field, enemy1_field, enemy2_field, free_up_goal_enemy1, free_up_goal_enemy2,  advance, catch_up]
            potential = Potential(self.current_point, self.current_direction, self.world, potentials)

            # MOTION
            #######################################
            if sim is False:
                self.current_force = potential.get_force()
                #print self.current_force
                bearing = self.calculate_angle(self.current_force)
                #print bearing
                self.commands.move(bearing, 0)

            ########################################

            # TESTING
            ########################################
            else:
                potential.map()

            ########################################
            ###########################################################################################################################################

        elif state == "FREE_BALL_NONE_GOALSIDE":

            # ON
            #####################################

            friend_field = P.solid_field(self.world.friend.position, 1, 15, ROBOT_SIZE, ROBOT_INFLUENCE_SIZE)
            enemy1_field = P.solid_field(self.world.enemy1.position, 1, 15, ROBOT_SIZE, ROBOT_INFLUENCE_SIZE)
            enemy2_field = P.solid_field(self.world.enemy2.position, 1, 15, ROBOT_SIZE, ROBOT_INFLUENCE_SIZE)

            advance = P.step_field(self.world.friend.position, rotate_vector(-90, get_play_direction(self.world)[0], get_play_direction(self.world)[1]), 2000, 1, 0)
            catch_up = P.step_field(self.world.venus.position, rotate_vector(-90, get_play_direction(self.world)[0], get_play_direction(self.world)[1]), 2000, 1, 0)

            if self.world.enemy1.out[0] == 0:
                free_up_pass_enemy1 = P.finite_axial_outside(self.world.enemy2.position, self.world.friend.position, POSITION_INFLUENCE_RANGE, 1.3, 2.5)
            else:
                free_up_pass_enemy1 = P.finite_axial_outside(self.world.enemy2.position, self.world.friend.position, POSITION_INFLUENCE_RANGE, 1.3, 0)

            if self.world.enemy2.out[0] == 0:
                free_up_pass_enemy2 = P.finite_axial_outside(self.world.enemy1.position, self.world.friend.position, POSITION_INFLUENCE_RANGE, 1.3, 2.5)
            else:
                free_up_pass_enemy2 = P.finite_axial_outside(self.world.enemy1.position, self.world.friend.position, POSITION_INFLUENCE_RANGE, 1.3, 0)

            # BUILD FIELD AND NEXT POSITION AND DIRECTIONS
            ####################################
            # todo too reliant on vision, must pick what to use for look ahead
            self.current_point = (self.world.venus.position[0], self.world.venus.position[1])
            self.current_direction = (self.world.venus.orientation[0], self.world.venus.orientation[1])

            potentials = [friend_field, enemy1_field, enemy2_field, free_up_pass_enemy1, free_up_pass_enemy2, advance, catch_up]
            potential = Potential(self.current_point, self.current_direction, self.world, potentials)

            # MOTION
            #######################################
            if sim is False:
                self.current_force = potential.get_force()
                #print self.current_force
                bearing = self.calculate_angle(self.current_force)
                #print bearing
                self.commands.move(bearing, 0)
            ########################################

            # TESTING
            ########################################
            else:
                potential.map()

            ########################################

            ###########################################################################################################################################

        elif state == "ENEMY1_BALL_TAKE_GOAL":

            # ON
            #####################################
            ball_field = P.radial(self.world.ball, 1, 0)

            friend_field = P.solid_field(self.world.friend.position, 1, 60, ROBOT_SIZE, ROBOT_INFLUENCE_SIZE)
            enemy1_field = P.solid_field(self.world.enemy1.position, 1, 60, ROBOT_SIZE, ROBOT_INFLUENCE_SIZE)
            enemy2_field = P.solid_field(self.world.enemy2.position, 1, 60, ROBOT_SIZE, ROBOT_INFLUENCE_SIZE)

            advance = P.step_field(self.world.friend.position, rotate_vector(-90, get_play_direction(self.world)[0], get_play_direction(self.world)[1]), 2000, 1, 0)
            catch_up = P.step_field(self.world.venus.position, rotate_vector(-90, get_play_direction(self.world)[0], get_play_direction(self.world)[1]), 2000, 1, 0)

            block_goal_enemy1 = P.finite_axial_inside(self.world.enemy1.position, (self.world.our_goalX,self.world.our_goalmeanY), 1, -5)

            # BUILD FIELD AND NEXT POSITION AND DIRECTIONS
            ####################################
            # todo too reliant on vision, must pick what to use for look ahead
            self.current_point = (self.world.venus.position[0], self.world.venus.position[1])
            self.current_direction = (self.world.venus.orientation[0], self.world.venus.orientation[1])

            potentials = [ball_field, friend_field, enemy1_field, enemy2_field, block_goal_enemy1, advance, catch_up]
            potential = Potential(self.current_point, self.current_direction, self.world, potentials)

            # MOTION
            #######################################
            if not sim and potential.get_potential() > -30:
                self.current_force = potential.get_force()
                #print self.current_force
                bearing = self.calculate_angle(self.current_force)
                #print bearing
                self.commands.move(bearing, 0)
                print "velocity is " + str(math.sqrt(self.world.ball_velocity[0]**2 + self.world.ball_velocity[1]**2))

            ########################################

            # TESTING
            ########################################
            elif sim:
                potential.map(num)
            ########################################
            elif (self.world.enemy1.hasBallInRange[0] == 0 and self.world.enemy2.hasBallInRange[0] == 0) or self.world.ball_moving[0] == 1:
                ball_field = P.radial(self.world.ball, 1, -100)
                potentials = [ball_field, friend_field, enemy1_field, enemy2_field, block_goal_enemy1, advance, catch_up]
                potential = Potential(self.current_point, self.current_direction, self.world, potentials)
                self.current_force = potential.get_force()
                #print self.current_force
                bearing = self.calculate_angle(self.current_force)
                #print bearing
                self.commands.move(bearing, 0)
            else:
                self.world.undistort[0] = 1
                self.commands.s()
                self.commands.o()
                angle, length = self.calculate_angle_length_ball()
                self.commands.c(angle)
            ###########################################################################################################################################

        elif state == "ENEMY2_BALL_TAKE_GOAL":

            # ON
            #####################################
            ball_field = P.radial(self.world.ball, 1, 0)

            friend_field = P.solid_field(self.world.friend.position, 1, 60, ROBOT_SIZE, ROBOT_INFLUENCE_SIZE)
            enemy1_field = P.solid_field(self.world.enemy1.position, 1, 60, ROBOT_SIZE, ROBOT_INFLUENCE_SIZE)
            enemy2_field = P.solid_field(self.world.enemy2.position, 1, 60, ROBOT_SIZE, ROBOT_INFLUENCE_SIZE)

            advance = P.step_field(self.world.friend.position, rotate_vector(-90, get_play_direction(self.world)[0], get_play_direction(self.world)[1]), 2000, 1, 0)
            catch_up = P.step_field(self.world.venus.position, rotate_vector(-90, get_play_direction(self.world)[0], get_play_direction(self.world)[1]), 2000, 1, 0)

            block_goal_enemy2 = P.finite_axial_inside(self.world.enemy2.position, (self.world.our_goalX,self.world.our_goalmeanY), 1, -5)

            # BUILD FIELD AND NEXT POSITION AND DIRECTIONS
            ####################################
            # todo too reliant on vision, must pick what to use for look ahead
            self.current_point = (self.world.venus.position[0], self.world.venus.position[1])
            self.current_direction = (self.world.venus.orientation[0], self.world.venus.orientation[1])

            potentials = [ball_field, friend_field, enemy1_field, enemy2_field, block_goal_enemy2,  advance, catch_up]
            potential = Potential(self.current_point, self.current_direction, self.world, potentials)


            # MOTION
            #######################################

            if not sim and potential.get_potential() > -30:
                self.current_force = potential.get_force()
                #print self.current_force
                bearing = self.calculate_angle(self.current_force)
                #print bearing
                self.commands.move(bearing, 0)
                print "velocity is " + str(math.sqrt(self.world.ball_velocity[0]**2 + self.world.ball_velocity[1]**2))
            ########################################

            # TESTING
            ########################################
            elif sim:
                potential.map(num)

            ########################################
            elif (self.world.enemy1.hasBallInRange[0] == 0 and self.world.enemy2.hasBallInRange[0] == 0) or self.world.ball_moving[0] == 1:
                ball_field = P.radial(self.world.ball, 1, -100)
                potentials = [ball_field, friend_field, enemy1_field, enemy2_field, block_goal_enemy2,  advance, catch_up]
                potential = Potential(self.current_point, self.current_direction, self.world, potentials)
                self.current_force = potential.get_force()
                #print self.current_force
                bearing = self.calculate_angle(self.current_force)
                #print bearing
                self.commands.move(bearing, 0)
            else:
                self.world.undistort[0] = 1
                self.commands.s()
                self.commands.o()
                angle, length = self.calculate_angle_length_ball()
                self.commands.c(angle)

            ###########################################################################################################################################

        elif state == "ENEMY_BALL_TAKE_PASS":

            # ON
            #####################################
            ball_field = P.radial(self.world.ball, 1, 0)

            friend_field = P.solid_field(self.world.friend.position, 1, 60, ROBOT_SIZE, ROBOT_INFLUENCE_SIZE)
            enemy1_field = P.solid_field(self.world.enemy1.position, 1, 60, ROBOT_SIZE, ROBOT_INFLUENCE_SIZE)
            enemy2_field = P.solid_field(self.world.enemy2.position, 1, 60, ROBOT_SIZE, ROBOT_INFLUENCE_SIZE)

            advance = P.step_field(self.world.friend.position, rotate_vector(-90, get_play_direction(self.world)[0], get_play_direction(self.world)[1]), 2000, 1, 0)
            catch_up = P.step_field(self.world.venus.position, rotate_vector(-90, get_play_direction(self.world)[0], get_play_direction(self.world)[1]), 2000, 1, 0)

            block_pass = P.finite_axial_inside(self.world.enemy1.position, self.world.enemy2.position, 1, -5)

            # BUILD FIELD AND NEXT POSITION AND DIRECTIONS
            ####################################
            # todo too reliant on vision, must pick what to use for look ahead
            self.current_point = (self.world.venus.position[0], self.world.venus.position[1])
            self.current_direction = (self.world.venus.orientation[0], self.world.venus.orientation[1])

            potentials = [ball_field, friend_field, enemy1_field, enemy2_field, block_pass, advance, catch_up]
            potential = Potential(self.current_point, self.current_direction, self.world, potentials)

            # MOTION
            #######################################

            if not sim and potential.get_potential() > -30:
                self.current_force = potential.get_force()
                #print self.current_force
                bearing = self.calculate_angle(self.current_force)
                #print bearing
                self.commands.move(bearing, 0)
                print "velocity is " + str(math.sqrt(self.world.ball_velocity[0]**2 + self.world.ball_velocity[1]**2))
            ########################################

            # TESTING
            ########################################
            elif sim:
                potential.map()
            ########################################
            elif (self.world.enemy1.hasBallInRange[0] == 0 and self.world.enemy2.hasBallInRange[0] == 0) or self.world.ball_moving[0] == 1:
                ball_field = P.radial(self.world.ball, 1, -100)
                potentials = [ball_field, friend_field, enemy1_field, enemy2_field, block_pass, advance, catch_up]
                potential = Potential(self.current_point, self.current_direction, self.world, potentials)
                self.current_force = potential.get_force()
                #print self.current_force
                bearing = self.calculate_angle(self.current_force)
                #print bearing
                self.commands.move(bearing, 0)
            else:
                self.world.undistort[0] = 1
                self.commands.s()
                self.commands.o()
                angle, length = self.calculate_angle_length_ball()
                self.commands.c(angle)

            ###########################################################################################################################################

       ##############################################################################################

        elif state == "ATTACK_PASS":
            self.world.kicked = True
            self.world.undistort[0] = 1
            # pass ball to the friend, when attacking
            self.commands.pass_ball()

            ###########################################################################################################################################

        elif state == "ATTACK_GOAL":
            self.world.kicked = True
            self.world.undistort[0] = 1
            # you're in the good position to score
            self.commands.goal()

            ###########################################################################################################################################

        elif state == "RECEIVE_PASS":
            self.world.sensor = True
            self.world.undistort[0] = 1
            # you should be in the good position to catch the ball
            self.commands.catch_ball()
        def __init__(self, last_square, last_direction, world, potentials):

            self.world = world
            self.ball_next_square = False
            self.con = 0

            self.last_square = last_square
            self.last_direction = last_direction
            if (self.world.room_num == 0 and not self.world.we_have_computer_goal  or self.world.room_num == 1 and self.world.we_have_computer_goal) and self.world.ball[0] < 3*PITCH_COLS/4:
                self.top_wall = g.step_field(self.world.pitch_top_left, (self.world.pitch_top_right[0]-self.world.pitch_top_left[0], self.world.pitch_top_right[1]-self.world.pitch_top_left[1]), WALL_INFLUENCE, 1, 10) # best with 3 5
                self.bot_wall = g.step_field(self.world.pitch_bot_left, (self.world.pitch_bot_left[0]-self.world.pitch_bot_right[0], self.world.pitch_bot_left[1]-self.world.pitch_bot_right[1]), WALL_INFLUENCE, 1, 10)
                self.right_wall = g.step_field(self.world.pitch_top_right, (self.world.pitch_bot_right[0] - self.world.pitch_top_right[0], self.world.pitch_bot_right[1] - self.world.pitch_top_right[1]), WALL_INFLUENCE, 1, 30)
                self.left_wall = g.step_field(self.world.pitch_top_left, (self.world.pitch_top_left[0] - self.world.pitch_bot_left[0], self.world.pitch_top_left[1] - self.world.pitch_bot_left[1]), WALL_INFLUENCE, 1, 10)
            elif (self.world.room_num == 0 and self.world.we_have_computer_goal  or self.world.room_num == 1 and not self.world.we_have_computer_goal) and self.world.ball[0] > 3*PITCH_COLS/4:
                self.top_wall = g.step_field(self.world.pitch_top_left, (self.world.pitch_top_right[0]-self.world.pitch_top_left[0], self.world.pitch_top_right[1]-self.world.pitch_top_left[1]), WALL_INFLUENCE, 1, 10) # best with 3 5
                self.bot_wall = g.step_field(self.world.pitch_bot_left, (self.world.pitch_bot_left[0]-self.world.pitch_bot_right[0], self.world.pitch_bot_left[1]-self.world.pitch_bot_right[1]), WALL_INFLUENCE, 1, 10)
                self.right_wall = g.step_field(self.world.pitch_top_right, (self.world.pitch_bot_right[0] - self.world.pitch_top_right[0], self.world.pitch_bot_right[1] - self.world.pitch_top_right[1]), WALL_INFLUENCE, 1, 10)
                self.left_wall = g.step_field(self.world.pitch_top_left, (self.world.pitch_top_left[0] - self.world.pitch_bot_left[0], self.world.pitch_top_left[1] - self.world.pitch_bot_left[1]), WALL_INFLUENCE, 1, 30)
            else:
                self.top_wall = g.step_field(self.world.pitch_top_left, (self.world.pitch_top_right[0]-self.world.pitch_top_left[0], self.world.pitch_top_right[1]-self.world.pitch_top_left[1]), WALL_INFLUENCE, 1, 10) # best with 3 5
                self.bot_wall = g.step_field(self.world.pitch_bot_left, (self.world.pitch_bot_left[0]-self.world.pitch_bot_right[0], self.world.pitch_bot_left[1]-self.world.pitch_bot_right[1]), WALL_INFLUENCE, 1, 10)
                self.right_wall = g.step_field(self.world.pitch_top_right, (self.world.pitch_bot_right[0] - self.world.pitch_top_right[0], self.world.pitch_bot_right[1] - self.world.pitch_top_right[1]), WALL_INFLUENCE, 1, 10)
                self.left_wall = g.step_field(self.world.pitch_top_left, (self.world.pitch_top_left[0] - self.world.pitch_bot_left[0], self.world.pitch_top_left[1] - self.world.pitch_bot_left[1]), WALL_INFLUENCE, 1, 10)


            # use 1, 100
            if world.we_have_computer_goal and world.room_num == 1 or not world.we_have_computer_goal and world.room_num == 0: # there goal is on the right
                self.penalty_box_front = g.step_field_inside(self.world.defending_right_top, self.world.defending_right_bot, (self.world.defending_right_bot[0]-self.world.defending_right_top[0], self.world.defending_right_bot[1]-self.world.defending_right_top[1]), PENALTY_BOX_INFLUENCE, 1, 10) # 2, 500
                self.penalty_box_top = g.infinite_axial_inside((self.world.goal_right_top[0], self.world.defending_right_top[1]), self.world.defending_right_top, PENALTY_BOX_INFLUENCE, 1, 10)
                self.penalty_box_bot = g.infinite_axial_inside((self.world.goal_right_bot[0], self.world.defending_right_bot[1]), self.world.defending_right_bot, PENALTY_BOX_INFLUENCE, 1, 10)
            elif world.we_have_computer_goal and world.room_num == 0 or not world.we_have_computer_goal and world.room_num == 1: # obviously the left goal
                self.penalty_box_front = g.step_field_inside(self.world.defending_left_top, self.world.defending_left_bot, (self.world.defending_left_top[0]-self.world.defending_left_bot[0], self.world.defending_left_top[1]-self.world.defending_left_bot[1]), PENALTY_BOX_INFLUENCE, 1, 10)
                self.penalty_box_top = g.infinite_axial_inside((self.world.goal_left_top[0], self.world.defending_left_top[1]), self.world.defending_left_top, PENALTY_BOX_INFLUENCE, 1, 10)
                self.penalty_box_bot = g.infinite_axial_inside((self.world.goal_left_bot[0], self.world.defending_left_bot[1]), self.world.defending_left_bot, PENALTY_BOX_INFLUENCE, 1, 10)

            self.potential_list = potentials + [self.top_wall, self.bot_wall, self.right_wall, self.left_wall, self.penalty_box_bot, self.penalty_box_top, self.penalty_box_front]

            #self.potential_list = [self.ball_field]

            #self.local_potential = np.full((5, 5), fill_value=np.inf, dtype=np.float64)
            self.local_potential = np.zeros((5, 5), dtype=np.float64)
            self.points = np.zeros((5, 5, 2))
            self.heat_map = np.zeros((PITCH_ROWS, PITCH_COLS))