Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Ckambarys
- class Ckolba
- class Cdalele
- def initialize (x,y)
- i=0
- @x=x
- @y=y
- end #defo endas
- def Soulis (temp)
- if temp<10
- @dx=0
- @dy=0
- end #ifo endas
- if ((temp>=10) and (temp<=20))
- @dx=1
- @dy=1
- end #ifoendas
- if temp >20
- @dx=3
- @dy=3
- end#ifo endas
- @x+=rand(-@dx..@dx)
- @y+=rand(-@dy..@dy)
- print "x=",@x," y=",@y,"\n"
- end#defo endas
- end #calses endas
- def initialize()
- @dalele=Cdalele.new(15,2)
- @dalele.Soulis(0)
- end# defo endas
- def Sildimas(temp)
- @temp=temp
- print " temperatura= ", @temp,"\n"
- @dalele.Soulis(@temp)
- end #defo endas
- end #clases endas
- puts "------------------"
- puts "pirmosios kolbos šuoliai: "
- puts "------------------"
- for i in 1..5
- kolba1=Ckolba.new()
- kolba1.Sildimas(20)
- kolba1.Sildimas(300)
- end #foro endas
- puts "------------------"
- puts "antrosios kolbos šuoliai: "
- puts "------------------"
- for i in 1..5
- kolba2=Ckolba.new()
- kolba2.Sildimas(20)
- kolba2.Sildimas(300)
- end #foro endas
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement