def setUp(self):
		main.init(False)
		main.set_system_state(self.system_state)

		for robot in main.system_state().their_robots:
			robot.set_vis_for_testing(True)

		self.length = constants.Field.Length
		self.width = constants.Field.Width
		self.botRadius = constants.Robot.Radius

		self.center_y = self.length / 2
		self.right_side = self.width / 2
		self.left_side = -self.width / 2

		self.their_robots = main.system_state().their_robots[0:6]
		self.our_robots = main.system_state().our_robots[0:6]
		self.ball = main.system_state().ball
		self.ball.set_pos_for_testing(robocup.Point(0, 0))

		for our_robot, their_robot in zip(self.our_robots, self.their_robots):
			our_robot.set_vis_for_testing(False)
			their_robot.set_vis_for_testing(False)

		main.set_their_robots(main.system_state().their_robots[0:6])
		main.set_our_robots(main.system_state().our_robots[0:6])
		main.set_ball(main.system_state().ball)
Esempio n. 2
0
    def setUp(self):
        main.init(False)
        main.set_system_state(self.system_state)

        for robot in main.system_state().their_robots:
            robot.set_vis_for_testing(True)

        self.length = constants.Field.Length
        self.width = constants.Field.Width
        self.botRadius = constants.Robot.Radius

        self.center_y = self.length / 2
        self.right_side = self.width / 2
        self.left_side = -self.width / 2

        self.their_robots = main.system_state().their_robots[0:6]
        self.our_robots = main.system_state().our_robots[0:6]
        self.ball = main.system_state().ball
        self.ball.set_pos_for_testing(robocup.Point(0, 0))

        for our_robot, their_robot in zip(self.our_robots, self.their_robots):
            our_robot.set_vis_for_testing(False)
            their_robot.set_vis_for_testing(False)

        main.set_their_robots(main.system_state().their_robots[0:6])
        main.set_our_robots(main.system_state().our_robots[0:6])
        main.set_ball(main.system_state().ball)
Esempio n. 3
0
	def set_robots_around_pos(self, x, y, rad):
		dist_from_point = constants.Robot.Radius * rad
		self.robots[0].set_pos(x - dist_from_point, y - dist_from_point)
		self.robots[1].set_pos(x - dist_from_point, y + dist_from_point)
		self.robots[2].set_pos(x, y + dist_from_point)
		self.robots[3].set_pos(x + dist_from_point, y - dist_from_point)
		self.robots[4].set_pos(x + dist_from_point, y)
		self.robots[5].set_pos(x, y - dist_from_point)
		main.set_their_robots(self.robots)
Esempio n. 4
0
    def test_eval_pt_to_seg(self):
        # NOTE: setting the root play like this is really hacky and should be changed
        # without doing this though, set_our_robots() fails
        main._root_play = root_play.RootPlay()

        # add an opponent sitting right in front of their goal
        bot = robocup.OpponentRobot(11)
        bot.pos = robocup.Point(0, constants.Field.Length - constants.Robot.Radius * 1.5)
        bot.visible = True
        main.set_their_robots([bot])
        main.set_our_robots([])

        shot_from = robocup.Point(0, constants.Field.Length / 2.0)

        win_eval = evaluation.window_evaluator.WindowEvaluator()
        windows, best = win_eval.eval_pt_to_opp_goal(shot_from)

        # the obstacle should split our shot into two windows
        self.assertEqual(len(windows), 2)
        self.assertTrue(best != None)
Esempio n. 5
0
	def set_robot_pos(self, x, y):
		for robot in self.robots:
			robot.set_pos(x, y)
		main.set_their_robots(self.robots)
Esempio n. 6
0
	def setUp(self):
		main.init(False)
		self.robots = [Moc_Robot(0, 0), Moc_Robot(0, 0), Moc_Robot(0, 0), 
				Moc_Robot(0, 0), Moc_Robot(0, 0), Moc_Robot(0, 0)]
		main.set_their_robots(self.robots)
	def setUp(self):
		self.robots = [Moc_Robot(0, 0), Moc_Robot(0, 0), Moc_Robot(0, 0), 
				Moc_Robot(0, 0), Moc_Robot(0, 0), Moc_Robot(0, 0)]
		main.set_their_robots(self.robots)