Guest User

Untitled

a guest
Jun 19th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. class Game
  2. attr_reader :secret
  3.  
  4. def initialize
  5. @secret = Secret.new
  6. end
  7.  
  8. def console_play
  9. bulls = -1
  10. while bulls != 4
  11. bulls = 0
  12. cows = 0
  13.  
  14. print "Your guess please: "
  15. guess = gets.chomp.split("").collect { |d| d.to_i }
  16. (bulls,cows) = secret.score(guess)
  17.  
  18. puts "You have #{cows} cows and #{bulls} bulls"
  19. end
  20. end
  21. end
Add Comment
Please, Sign In to add comment