Grobots Wiki
Register
Advertisement
Gunner

Author

Warren

Strategy

Autotroph with grenades

Last modified

5 Jan 2004

Gunner was the first side to shoot at enemies. It's essentially Algae with grenades.

It was originally hardcoded in C++ before user-defined sides worked, and served for basic balance tweaking. (The first time it fired at a colony of Algae, the grenade destroyed a dozen algae, and their death explosions did enough damage to create a chain reaction that killed the rest. Oops.) Later it was recreated in Forth.

Despite its simplicity, Gunner scored well in tournaments for many years. It's an autotroph, so it doesn't depend on territory for growth, and if unmolested it can grow quite large. Its immobility means it doesn't pick fights, and when it does fight it always fights as a group, so its defense is modestly effective. It has often frustrated authors of more sophisticated sides that didn't score as well.

Grudge is a derivative that avoids starting fights: it doesn't shoot at sides that haven't done anything hostile yet. This doesn't work very well with long-range grenades.

File[]

#side Gunner 4
#author Warren
March 1 2002, based on an old hardcoded side.
#color c0f

(Devon 20020409) Fixed for changes (removed focus, sensor cooldown)
(Devon 20030716) Ignore shielded targets.
(Devon 20040105) More reluctant to shoot nearby shielded targets.

#type Gunner
#color d00
#hardware
processor 5
constructor 0.399
energy 40 0
solar-cells 0.4
armor 200

robot-sensor 20 5
grenades 50 20 50

#code

#const scan-interval 70

do
	1 constructor-type!
	energy max-energy 10 - < 0 constructor-max-rate ifev constructor-rate!
	time robot-sensor-time scan-interval + < grenades-cooldown or nif
		fire-robot-sensor sync
		robot-found if
			do
				robot-shield-fraction 1 robot-distance grenades-range / 0.5 * - > if
					robot-position robot-velocity robot-distance grenades-speed / 0.8 *
						vs* v+ position v-
						rect-to-polar fire-grenade
					done-shooting& jump
				then
			next-robot while-loop
		done-shooting:
		then
	else
		sync
	then
forever
#end
Advertisement