本文整理汇总了Python中simulation.Simulation.golf_hole方法的典型用法代码示例。如果您正苦于以下问题:Python Simulation.golf_hole方法的具体用法?Python Simulation.golf_hole怎么用?Python Simulation.golf_hole使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类simulation.Simulation
的用法示例。
在下文中一共展示了Simulation.golf_hole方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: state_rep_callback
# 需要导入模块: from simulation import Simulation [as 别名]
# 或者: from simulation.Simulation import golf_hole [as 别名]
def state_rep_callback():
global ball, hole, robot_front, robot_back
fieldstate = Simulation([], ball, [], (640, 480))
fieldstate.golf_hole = hole
robot.pos = (robot_front.pos[0] + robot_back.pos[0])/2, (robot_front.pos[1]+robot_back.pos[1])/2
robot.orientation = atan2(robot_front.pos[1] - robot_back.pos[1], robot_front.pos[0] - robot_back.pos[0])
print "Ball pos: " + str(ball.pos)
print "Ball speed: "+ str(ball.speed)
move = ai.get_move(fieldstate)
print move
ai_server.move(move[0], move[1])
示例2: FakeAI
# 需要导入模块: from simulation import Simulation [as 别名]
# 或者: from simulation.Simulation import golf_hole [as 别名]
sys.path.append('simulator')
sys.path.append('ai')
sys.path.append('math')
from robot import Robot
from ball import Ball
from simulation import Simulation
from fake_ai import FakeAI
from golf_ai import SimpleGolfAI
from golf_hole import GolfHole
from window import run_sim
# c1 = FakeAI(pygame.K_LEFT, pygame.K_RIGHT, pygame.K_UP, pygame.K_DOWN)
c1 = SimpleGolfAI()
ai_arr = [c1]
r1 = Robot((100, 300), 0, (255, 0, 0), 40, 5, 10, 2, c1)
robots = [r1]
h1 = GolfHole((200, 100), 5, 0.5)
updaters = [h1]
ball = Ball((250, 150), 3, (0, 255, 255), 0.99, 1.2)
dim = (640, 480)
sim = Simulation(robots, ball, updaters, dim)
sim.golf_hole = h1
run_sim(sim, ai_arr, dim)