Qpel

Untitled

Feb 23rd, 2018
374
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.41 KB | None | 0 0
  1. class Cdalele
  2.   def initialize(x,y, dx, dy)
  3.     @x=x
  4.     @y=y
  5.     @dx=dx
  6.     @dy=dy
  7.   end
  8.  
  9.   def Suolis()
  10.     @x+=rand(-@dx..@dx)
  11.     @y+=rand(-@dy..@dy)
  12.     puts "x = #{@x}, y = #{@y}"
  13.   end
  14. end
  15.  
  16. daleles=Array.new(20) {|i| i=Cdalele.new(50,50,5,5)}
  17. daleles[2].Suolis()
  18. for suolionr in 1..100
  19.   puts "suolio numeris = #{suolionr}"
  20.   for i in 0..19
  21.   puts "i = #{i}"
  22.   daleles[i].Suolis()
  23.   end
  24. end
Add Comment
Please, Sign In to add comment