In a previous lab, we used a
repeat block to avoid
duplicating code. Similarly, we can use a custom block to
avoid duplicating code.
Below is some code to draw a tic-tac-toe board.
Your goal is to create blocks that make this code simpler.
Some things to remember:
- As a first step, break up this
drawing task into meaningful sub-tasks. We suggest doing this
working with pen and paper, not while looking at the code!
Give your new blocks
appropriate names. You want to make it easy to read the
code—at its best, like natural, english sentences—
and understand what it does.
It may make sense to "split" some blocks up into different
custom blocks. For instance, a single
might be better performed as a
in one custom block followed by a
Use this Snap! project, duplicate of the image above,
to get started.