Permalink
Browse files

Added test codes for ships.

  • Loading branch information...
1 parent a0a3e9f commit 73796879644d04ab490c0e6ac4b094ac58eb36d3 @mauricioszabo committed Feb 24, 2012
Showing with 30 additions and 0 deletions.
  1. +15 −0 random_wander.rb
  2. +15 −0 random_wander2.rb
View
@@ -0,0 +1,15 @@
+class RandomWander < Code
+ each_frame do
+ randomize! if @to_x.nil?
+ if @to_x == me.x && @to_y == me.y
+ randomize!
+ end
+ end
+
+ def randomize!
+ @to_x = rand(500)
+ @to_y = rand(500)
+ goto @to_x, @to_y
+ puts "P1 GOTO #{@to_x}, #{@to_y}"
+ end
+end
View
@@ -0,0 +1,15 @@
+class RandomWander2 < Code
+ each_frame do
+ randomize! if @to_x.nil?
+ if @to_x == me.x && @to_y == me.y
+ randomize!
+ end
+ end
+
+ def randomize!
+ @to_x = rand(500)
+ @to_y = rand(500)
+ goto @to_x, @to_y
+ puts "P2 GOTO #{@to_x}, #{@to_y}"
+ end
+end

0 comments on commit 7379687

Please sign in to comment.