You get a gold star on the chart for the day!

Today we can all be thankful for rrobots.rb.

Here's the listing of my first bot, affectionately titled BotOne. He
lays a savage beat down on the aptly named NervousBot, but he is by no
means invincible.

#Begin listing

require 'robot'

class BotOne
	include Robot
	def tick events
		@rapid_fire = 0 if @rapid_fire.nil?
		@last_seen = 0 if @last_seen.nil?
		@turn_speed  = 3 if @turn_speed.nil?
		
		if time - @last_seen > 200
			@turn_speed *= -1
			@last_seen = time
		end
		
		turn @turn_speed
		
		if( @rapid_fire > 0 )
			fire 0.84
			turn_gun -(@turn_speed / @turn_speed) *2
			@rapid_fire = @rapid_fire - 1
		else
			turn_gun @turn_speed * 1.25
		end

		if( !events['robot_scanned'].empty? )
			@turn_speed *= -1
			@last_seen = time
			@rapid_fire = 20
		end
		@last_hit = time unless events['got_hit'].empty?
		if @last_hit && time - @last_hit < 20
			accelerate(-1)
		else
			accelerate 1
		end
	end
end

#End listing

This bot prefers long matches, as he fires low power shots. This, on
my machine at least exposes some performance problems associated with
shooting a lot. Matching a couple of rapid firing bots brings the app
to it's knees after only a few thousand ticks. My first idea where
maybe that the bullets were not being cleaned up properly, but looking
at the source it looks like they are being remove from the hash and
canvas, so I don't know.

Barring that though, this is brilliant!

One thousand thanks,
-Harold

On 11/24/05, Simon Kr?ger <SimonKroeger / gmx.de> wrote:
> Gyoung-Yoon Noh wrote:
>
> > On 11/24/05, Simon Kr?ger <SimonKroeger / gmx.de> wrote:
> >
> >>v0.1.1 is ready for download.
> >>(and hopefully realy platform independent)
> >>
> >
> >
> > My screenshot:
> > http://static.flickr.com/26/66471832_4ceaf3b81b_o.png
> >
> > --
> > http://nohmad.sub-port.net
>
> Hehe, nice!
>
> and thanks for the feedback.
>
> Simon
>
>