// Make a game that has two robots A and B. The A robot is controlled
// by the user and the B robot is programmed by the computer.
// The user wins if A can catch B before 13 seconds elapse.
//
//each time the up(down) arrow is pressed robot 1 speed
//increases(decreases) by 2 pixels/second and each time the right (left)
//arrow is pressed, the direction of the robot rotates 15 degrees to
// the right (left)
//arrows 2 15
KEY "UP" [SPEED = SPEED + 2]
KEY "RIGHT" [DIR = DIR + 15]
//
robot 1 [shape [size 0.3 [star 5]] speed = 20 rgt -100 0 ]
robot 2 [on shape [size 0.3 [star 6]] speed = 19 rgt 100 0
every 2 [robot 2 [dir = dir + rnd 100 ]]
]
robot 1 [every 0.5 [if (rdist 2 <=20) [ bg blue
jt -100 0 size 4 [wr "Human won"] robot 1 [hide] robot 2 [hide]
after 4 [stop]]
]]
after 13 [
bg red jt -100 0 size 4 [wr "computer won"] robot 1 [hide] robot 2 [hide]
after 4 [stop]]
jt 0 0