Finding Triples (Continued)

Before we make substitute triples, let's see if we can make substitute triple, a block that takes a single triple (a list of three numbers, one of the winning combinations) and a position as its inputs, and returns the transformed version of that triple.

We're making this abstraction because we realize that in substitute triples, we're going to need to substitute lots of individual triples. A great situation for a new block.

output from substitute triple

another example

For You To Do:

Write the above substitute triple block.

You can now use substitute triple to make the find triples block.

For You To Do:

Write the find triples block. It takes one input, a position, and returns the list of triples that we wanted. Here's a reminder of what the output looks like:

find triples result

This output is hard to read, isn't it? Fortunately, we have provided a block that helps you read the list, so you can see your results faster and easier. We wrote this block for you, but make sure you know how it works!

triples converter script

triples converter result

Note: triples-converter is used only to help you read the list while debugging; don't use it in the program itself.