Download Latest Version robotwar.zip (214.0 kB)
Email in envelope

Get an email when there's a new version of Robot War

Home
Name Modified Size InfoDownloads / Week
README 2016-12-04 1.9 kB
robotwar.zip 2016-12-04 214.0 kB
Totals: 2 Items   215.9 kB 0
Edit list of contestants in 'war.scm'.

Essential variables and procedures to use in robots include:
max-x              ;x coordinate of right edge.
max-y              ;y coordinate of bottom edge.
(random n)         ;random non-negative integer less than n.
(read-x)           ;x coordinate of robot (starts randomly).
(read-y)           ;y coordinate of robot (starts randomly).
(read-fuel)        ;available fuel remaining for robot (starts at 20).
(read-health)      ;remaining health of robot (starts at 5000).
(read-velocity-x)  ;x velocity of robot.
(read-velocity-y)  ;y velocity of robot.
(read-direction)   ;direction of robot (0 up, clockwise 45 degree increments).
(say m)            ;say string message m.
(turn-left!)       ;use time and 1 unit of fuel to turn left 45 degrees.
(turn-right!)      ;use time and 1 unit of fuel to turn right 45 degrees.
(re-fuel!)         ;use time to produce one unit of fuel.
(accelerate! n)    ;use time and 10n units of fuel to accelerate by n.
(brake! n)         ;use time and 10n units of fuel to decelerate by n.
(fire!)            ;use 2 units of fuel to fire a photon
                   ;(causing 100 damage to target).
                   ;gun requires recharging after each firing.
                   ;returns #t if successful, else #f.
(look!)            ;use time to look ahead.
                   ;returns an associative list of robots in line of sight,
                   ;for example (('bonnie . bonnie-robot)
                   ;             ('clyde . clyde-robot))
                   ;Each robot r responds to the symbolic methods:
                   ;(r 'x) is the robot's x-coordinate
                   ;(r 'y) is the robot's y-coordinate
                   ;(r 'velocity-x) is the robot's x-velocity
                   ;(r 'velocity-y) is the robot's y-velocity

;Inessential Procedures:
(stopped?)         ;#t if velocity is zero, else #f.
(set-name! name)
(set-color! color)
Source: README, updated 2016-12-04