```#- - - - - - - - - - - - - -##                           ##    a bit about bouncing   ##       by: evan            ##                           ##- - - - - - - - - - - - - -#module Bouncing# first of all:def it_is_ok#   ok?          "ok."end# but:#   when a thingdef   hits_the_ground_from the_height#       if we can assume that the            remaining_energy = the_height#   then we can say       if remaining_energy          that_the "thing uses some of the #{remaining_energy} to bounce"#            and            rises_to the_next_peak_from(the_height)       else#     the thing just      rests#     and that is the      end # of itend# it should be noted that:#    in order to determine thedef    the_next_peak_from the_old_height;         unless the_old_height < an_observable_bounce#           we assume that       new_height = the_old_height * the_bounciness         else#          the thing is no longer bouncing#             percievable to this observer, anyway...  endend# also, #    when a thing#      is droppeddef     from a_height # it               hits_the_ground_from a_heightend# likewise,#    when a thingdef   rises_to a_new_height#       then it will fall          from a_new_heightend#                 but...# and most importantly.#           when the time is just right,#        the thing justdef          rests;                  and_we_know it_is_ok                       #the                       end#----------------------------------------------#                        alias :and_we_know :puts                        alias :that_the    :putsdef the_bounciness;       @bounciness       enddef an_observable_bounce                          @minimum_bounce   enddef bounciness=(amnt)   @bounciness = amnt  enddef minimum_bounce=(amnt)                    @minimum_bounce = amnt  endend## and a thingclass Thing  include Bouncing  def self.with_bounciness(bounce)    thing = new    thing.bounciness = bounce    thing  end  def dropped_from height    yield(self)    hits_the_ground_from height  endend## and then you run it...Thing.with_bounciness(0.5).dropped_from(50) { |set|  set.minimum_bounce  = 0.01}## and it says:thing uses some of the 50 to bouncething uses some of the 25.0 to bouncething uses some of the 12.5 to bouncething uses some of the 6.25 to bouncething uses some of the 3.125 to bouncething uses some of the 1.5625 to bouncething uses some of the 0.78125 to bouncething uses some of the 0.390625 to bouncething uses some of the 0.1953125 to bouncething uses some of the 0.09765625 to bouncething uses some of the 0.048828125 to bouncething uses some of the 0.0244140625 to bouncething uses some of the 0.01220703125 to bouncething uses some of the 0.006103515625 to bounceok.
```