refactor number-guesser.rb code