YouTube

Got a YouTube account?

New: enable viewer-created translations and captions on your YouTube channel!

English subtitles

← 06-39 Making The Board

Get Embed Code
1 Language

Showing Revision 1 created 06/29/2012 by Amara Bot.

  1. Now all that's left is to set up this matrix bonus, say where the double and triple bonuses are.
  2. Here's what I've done. I've just drawn a picture of the bonus and I called it the bonus_template.
  3. But I only drew one quadrant, one quarter of the board, because I noticed that they were all
  4. symmetric and so this function bonus_template takes a quadrant in terms of a string,
  5. mirrors each rows and then mirrors each set of rows,
  6. where mirror of a sequence is just sequence plus the rest of the sequence
  7. except for the last one, so there's going to be a middle piece that we'll reflect it around.
  8. I made one template for the Scrabble game and one for the Words With Friends game,
  9. and then you choose which bonus you want to use, and then I defined these constants for
  10. double words, triple words, double letters, and triple letters, and I wasn't quite sure what to use.
  11. I know I didn't want to use letters like d and t because I'd get confused with the letters in the hand.
  12. I used 2 and 3 for double and triple words, a colon because it has 2 dots for double letters,
  13. and a semicolon because it's a little bit bigger than a colon for triple letters.
  14. Even though we're so close to the end, it's still good hygiene to write tests,
  15. so I took some time to write some, ran them, all the tests pass.
  16. You can see here's a tiny little bonus template--a quarter of an array, which looks like that.
  17. When you apply bonus_template to it, you get this nice symmetric array.
  18. Now what I'd like you to do is modify the show(board) function so that it prints out
  19. these bonus entries so that if there's no letter over this 3 in the corner
  20. it should print the 3 rather than just printing a dot.