Forums | Admin

Discussion Forums: robots

Start New Thread Start New Thread

 

By: Ilmari Heikkinen
RE: DebugDuck02 - Helps You Debug Your Duck :) [ reply ]  
2005-12-09 15:12
When I'm pasting stuff from here, it comes up with spaces in front.. doing the following tweaks to the ruencode.rb script helped:

x=<<EODATA -> x=<<-EODATA

x=x.unpack("m").first -> x=x.gsub(/ /,'').unpack("m").first

By: Nobody
RE: DebugDuck02 - Helps You Debug Your Duck :) [ reply ]  
2005-12-09 13:57
Here is the one i wrote.. just pass the files as arguments...

#start of ruby encoded file ruencode.rb
x=<<EODATA
eJyVUMFKxDAQvecrhtnDNiD5gGX3UFgVT4KIB42HtJlosE1rkmLV9d9NG2VX
WFg8DfNm3uO95+l1sJ5g+dHYasn6IQbARYjKR+gM+KF6B3J1p0mDsQ0FZOXN
5Z0gVT+D7mCn/NOOAVykm+h6ckUC+HwxEw5wUhIWnzO7UoGcamlW+MID8rhZ
r8+vt+VteYA+3CfHq9WWTKMiCZ1nYYQnpfmj6FX9UmCLfE+RDLMMGzejGNz8
IrGVyIWxPkTm/9axTyXxqEuJZxLfEv83sRG9ty5CNnflsjmbZzFyRk5PIX5a
Sds/O0mMSYOdEAj4DakEmgs=
EODATA
x=x.unpack("m").first
require 'zlib'
File.open("ruencode.rb","w") do |f|
f.print Zlib::Inflate.inflate(x)
end
#end of ruby encoded file ruencode.rb

By: Nobody
RE: DebugDuck02 - Helps You Debug Your Duck :) [ reply ]  
2005-12-09 05:48
yeah that's how i noticed that my debugduck post had that problem. btw, duckbill ruins debugduck02. :) 47 to 3 ...

moxio

By: sox box
RE: DebugDuck02 - Helps You Debug Your Duck :) [ reply ]  
2005-12-09 05:20
It wold be real cool if someone posted instructions or script for doing the pack/zlib thing that some of the other bots used. I had the same problem with my last bot ( give it a TRY ) were the robot code was mistaken for HTML code.

By: Nobody
RE: DebugDuck02 - Helps You Debug Your Duck :) [ reply ]  
2005-12-09 05:16
for some reason there's a line that reads
"turn_gun -@last_turn /> fire 0.2"

the "/>" shouldn't be there, that's supposed to be a carriage return. the program will run if "/>" is removed and "fire 0.2" is on the next line.

moxio

By: Nobody
DebugDuck02 - Helps You Debug Your Duck :) [ reply ]  
2005-12-06 20:09
this clown started off as HitMePleaseDuck, but now has become quite the assassin. he can beat most ducks handily. he wins about 30% of the time against SniperDuck and 50% of the time against Rrrkele and greater than 60% against the other ducks posted. kinda happy since he's only 70 lines of code. will sit down one day and work out the math ... then will make 007Duck. let me know what you think of this version so far! i learned ruby only this past saturday!
hopefully i pasted everything correctly.

moxio

require 'robot'

class DebugDuck02
include Robot

def tick events
@last_turn = -rand()+4.5 if @last_turn == nil
@found = 0 if @found == nil
@changesign = 0 if @changesign == nil
@randturn = 0.75*rand()+1 if time%100 == 0
turn(@randturn) if energy >= 45
turn(1) if velocity == 0 and energy == 100 and time > 200
if time%700 == 0
@changesign = @changesign + 1
@newaccel = 1 if @changesign%2 == 0
@newaccel = -1 if @changesign%2 == 1
end
accelerate(@newaccel)
turn(@randturn-0.5*rand()) if energy < 45
if energy > 20
@multiply = 1
else
@multiply = 3
end
if time < 60
turn_gun 25
end
if events['robot_scanned'].empty?
if @found == 1
@last_turn = @last_turn/2
turn_gun -@last_turn /> fire 0.2
elsif @found == 0
if energy > 45
@last_turn = -(rand()+11)
else
@last_turn = -(rand()+9)
end
turn_gun @last_turn
fire 0.1
end
@found = 0
else
if events['robot_scanned'][0][0] <=350
@last_turn =
-@last_turn /> turn_gun @last_turn
fire 1.6 if @multiply == 1
fire 1.9 if @multiply == 3
elsif events['robot_scanned'][0][0] > 350 and events['robot_scanned'][0][0] <= 650
@last_turn =-@last_turn
turn_gun @last_turn
fire 0.2 if @multiply == 1
fire 0.3 if @multiply == 3
else
@last_turn =-(@last_turn)
turn_gun @last_turn+1
fire 0.3 if @multiply == 1
fire 0.3 if @multiply == 3
end
@found = 1
end
end
end