Guest User

Untitled

a guest
Jul 16th, 2018
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. # Write a program that plays duck duck goose. Allow the user to enter the player's number they want to call goose on, and then say "duck" for each player before the "goose", then say "goose" for the chosen player.
  2.  
  3. # Which player do you want to Goose? 5
  4.  
  5. # Player 1: Duck
  6. # Player 2: Duck
  7. # Player 3: Duck
  8. # Player 4: Duck
  9. # Player 5: Goose
  10.  
  11. puts "Let's Play Duck Duck Goose"
  12. puts "Which player do you want to Goose: "
  13. input = gets.chomp.to_i
  14. player = 1
  15.  
  16. while input != player do
  17. puts "Player # #{player}: Duck"
  18. player = player + 1
  19. end
  20.  
  21. puts "Player # #{player}: Goose"
Add Comment
Please, Sign In to add comment