file cabinet
25 Nov 2005, 06:19 AM
I saw this on the comp.lang.ruby:
http://groups.google.com/group/comp.lang.ruby/browse_thread/thread/843bca1927e6eb2f/00ac7bfa095f38db
or read here which is more up-to-date then the above link:
http://www.ruby-forum.com/topic/15285
It is a game where you can code a robot and battle someone elses robot:
http://www.intpcentral.com/uploads/screenshot-2005-11-25-1132899436.png
I've always wanted to try something like this. Now if only I could remember more of math and try to predict where the robot is located and other such things.
something for my brain to munch on..
here is the one I have for the moment:
require 'robot'
class Testing
include Robot
def initialize bf
super(bf)
@saw_robot = false
end
def tick events
accelerate 1
if @saw_robot
direction = time%2==0 ? -1 : 1
turn_gun 20*direction
turn 1*direction
@saw_robot = false
else
turn_gun 10
turn 2
end
if !events['robot_scanned'].empty?
fire 1
@saw_robot=true
end
end
end
it does okay against one of the robots posted to the thread linked above.. but mmm
To get started install Ruby:
http://www.ruby-lang.org/en/20020102.html
Then download RRobots from here:
http://rubyforge.org/frs/?group_id=1109&release_id=3602
What is Ruby?
http://en.wikipedia.org/wiki/Ruby_programming_language
http://groups.google.com/group/comp.lang.ruby/browse_thread/thread/843bca1927e6eb2f/00ac7bfa095f38db
or read here which is more up-to-date then the above link:
http://www.ruby-forum.com/topic/15285
It is a game where you can code a robot and battle someone elses robot:
http://www.intpcentral.com/uploads/screenshot-2005-11-25-1132899436.png
I've always wanted to try something like this. Now if only I could remember more of math and try to predict where the robot is located and other such things.
something for my brain to munch on..
here is the one I have for the moment:
require 'robot'
class Testing
include Robot
def initialize bf
super(bf)
@saw_robot = false
end
def tick events
accelerate 1
if @saw_robot
direction = time%2==0 ? -1 : 1
turn_gun 20*direction
turn 1*direction
@saw_robot = false
else
turn_gun 10
turn 2
end
if !events['robot_scanned'].empty?
fire 1
@saw_robot=true
end
end
end
it does okay against one of the robots posted to the thread linked above.. but mmm
To get started install Ruby:
http://www.ruby-lang.org/en/20020102.html
Then download RRobots from here:
http://rubyforge.org/frs/?group_id=1109&release_id=3602
What is Ruby?
http://en.wikipedia.org/wiki/Ruby_programming_language