Guest User

Untitled

a guest
May 27th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.24 KB | None | 0 0
  1. # Pair Programming Lab - Pub or Snowman!
  2.  
  3. Choose a brief that you and your pair programming partner is going to build!
  4.  
  5. Work one one laptop and Git commit regularly!
  6.  
  7. Remember to use TDD.
  8.  
  9. ## Pub
  10.  
  11. In pairs, plan and create an object oriented model of a Pub, with Drinks and Customers!
  12.  
  13. MVP:
  14. - A `Pub` should have a `name`, a `till`, and a collection of `drinks`
  15. - A `Drink` should have a `name`, and a `price`
  16. - A `Customer` should have a `name`, and a `wallet`
  17. - A `Customer` should be able to buy a `Drink` from the `Pub`, reducing the money in its `wallet` and increasing the money in the `Pub`'s `till`
  18.  
  19. Extensions:
  20. - Add an `age` to the `Customer`. Make sure the `Pub` checks the `age` before serving the `Customer`.
  21. - Add `alcohol_level` to the Drink, and a `drunkenness` level to the `Customer`. Every time a `Customer` buys a drink, the `drunkenness` level should go up by the `alcohol_level`.
  22. - `Pub` should refuse service above a certain level of `drunkenness`!
  23.  
  24. Advanced extensions:
  25. - Create a `Food` class, that has a `name`, `price` and `rejuvenation_level`. Each time a `Customer` buys `Food`, their `drunkenness` should go down by the `rejuvenation_level`
  26. - Pub can have a `stock` (maybe a Hash?) to keep track the amount of `drinks` available (Hard! Might need to change the drinks array to a drinks hash)
  27. - Pub can have a `stock_value` method to check the total value of its `drinks`
  28.  
  29.  
  30. ## Snowman
  31.  
  32. In pairs, plan out, build and test an object oriented implementation of the word guessing game Snowman.
  33.  
  34. - A player has 6 chances to guess a hidden word.
  35. - Each incorrect guess will melt part of the snowman. A player wins when they guess the word and lose when they run out of lives and the snowman melts.
  36.  
  37. ## MVP
  38.  
  39. * A `Game` will have properties for a `Player` object, a `HiddenWord` object, and an array of `guessed_letters`
  40. * A `Player` will have a `name` and number of `lives`
  41. * A `HiddenWord` will be initialised with a `word` string, but will only `display` letters which have been correctly guessed, replacing the rest with the `*` character
  42. * The `HiddenWord` should also be able to report `true` or `false` if a letter appears in the `word`
  43.  
  44. ## Extension - `Game` logic
  45.  
  46. * The `Game` should be able to pass a single letter to a `HiddenWord` as a guess
  47. * It should store these single letters in its `guessed_letters` array
  48. * It should be able to subtract a life from a `Player` if the guess is incorrect
  49. * It should be able to tell whether the game `is_won?` or `is_lost?`
  50.  
  51. ## Advanced Extension
  52.  
  53. * Make a `Runner` file to run the game in Terminal:
  54. * Ask a user to input a secret word
  55. * Hide the secret word from the player <- *Hint: research how to clear the Terminal screen in Ruby*
  56. * Play the game! Collect guesses typed in by the player, process guesses with your `Game` methods, and display appropriate messages to turn your classes into a working game!
  57.  
  58. ## Rules of Snowman
  59.  
  60. A user enters a word or phrase:
  61.  
  62. ```
  63. wheel of fortune
  64. ```
  65.  
  66. This is then hidden or obscured, and presented to the player:
  67.  
  68. ```
  69. ***** ** *******
  70. ```
  71.  
  72. The player guesses "e", and the letter is revealed:
  73.  
  74. ```
  75. **ee* ** ******e
  76. ```
  77.  
  78. The player guesses "x" and loses a life.
  79.  
  80. The player guesses "f" and its position is revealed, along with the "e" previously guessed:
  81.  
  82. ```
  83. **ee* *f f*****e
Add Comment
Please, Sign In to add comment