Kaceka2016/ruby_part/intelligence_test.rb

15 lines
446 B
Ruby

#require_relative 'crane_class'
require 'json'
def introduce
puts "Hello, sir. I'm Roman the Crane."
end
file = File.read('test.json')
words = JSON.parse(file)
file2 = File.read('past_forms.json')
past_formes = JSON.parse(file2)
puts (if words.values.any? { |e| words.key(e).eql? "movement" } && words.length > 1 then "I #{past_formes[words["movement"]] + ' ' + words["directions"]}" else "Ooops" end)
puts words["directions"]