Update logic.rb

added distance class