YouTube

Got a YouTube account?

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

English subtitles

← 06-31 Horizontal Plays

Get Embed Code
1 Language

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

  1. Now let's do a little bit of planning. We did row plays. What is row play return?

  2. Well, it's a set of plays where each play is an i-word pair, where i is the index
  3. into the row where the word starts. We eventually want to get all plays.
  4. Before we can get there, I'm going to introduce another function called horizontal plays,
  5. which does row plays across all the possible rows,
  6. but only going in the across direction not in the down direction.
  7. That'll take a hand and a board as input. A board is just a list of rows.
  8. It'll return a set of plays where a play, like in a row play, is the position in the word
  9. except now the position is not going just to be i, the position is an i-j pair.
  10. It's going to be at this column in this row along with the word.
  11. It's a set of tuples that look like that. Let's define horizontal plays.
  12. Well, you know the drill by know--familiar structure. We start out with an empty set of results.
  13. We're going to build them up somehow and then get the results.
  14. Now, how are we going to do that? Let's enumerate over all the rows in the board.
  15. We just want the good ones--the one from 1 to -1.
  16. We don't want the rows at the top and the bottom, which are off the board or the border squares.
  17. For each good row, I'm going to write a function called set_anchors which takes the row
  18. and modifies that row and mutates the row to have all the anchors in it.
  19. Remember before when I called row plays I passed in manually all the anchors.
  20. Here, I'm going to have the program do it for me.
  21. Now, for each word, I want to find all the plays within that row
  22. and properly add them in to results.
  23. I want to do something with the row plays of hand within that row.
  24. And I want you to tell me what code should go here.
  25. It could be a single line or it could be a loop over the results that come back from row plays.
  26. Figure out what goes here so that it can return the proper results.