In the last video I used template blending to pretty quickly come up with
the solve function. What I didn't do in that video was to
write out the two wish list entries for the function we came up with.
And that's what I'm going to do now. We ended up right here, and the two
functions that we wished for but didn't define are solved and next boards.
So let's go ahead and do wish list entries for those.
Let's see. Solved, we give it a board, and we
want to know, is this board a final solution.
That's a yes. No question.
So it's going to produce a Boolean and it's produce true if board is solved.
Now what does solved mean? Well the way we generate the tree we only
put into the tree valid boards. So actually if we have a board that's
full. If we have a board that has no empty
space in it, then it's solved. So we could just note, assume board is
valid, so it is solved if it is full. This is a wish list entry, so we'll mark
that. And we'll do a stub.
So that's the wish list entry for solved. The other function that we named in
solved but we didn't do a wish list for, it doesn't exist yet, is next-boards.
See next-boards is right here. And what does next-boards do?
Well, next-boards consumes a board and it has to produce a list of board and, what
does it need to do? It needs to produce list of valid [SOUND]
next boards, from board. [BLANK_AUDIO] Here's a case, this
function's a little bit complicated now. Maybe we're going to want to expand on
our 78 character rule. Then you might want to say a bit more
about what it does. What it basically does is finds first
empty square, fills it with [1, 9] and it keeps only the valid boards.
And maybe I'll just make it more clear that's natural 1 to 9.
And this is also wish list entry. Bang, bang, bang.
And there's the stub. From here on out, this is a series of how
to design function problems. What I'm going to do is provide video
lectures for some of them. But they're really good practice, so you
might want to try some of them on your own.
I will say this. As you design these function you're
going to end up using a number of helper functions.
You'll end up using a number of the helper function rules that we've used.
So, there is a little bit of work, to do here.
All of it in some sense is review, although a couple of the functions are a
bit tricky. So what you might want to do is start
working on them. Look at the video solution.
Go back and forth. Anyways, I'll end this video here with
the wish list entries, and we'll pick up later with the solution to some of these.
[BLANK_AUDIO]