- We're writing programs! Each time we solve a level we're providing a recipe of steps that are executed.
The outcome is an exact sequence of steps with consistent, repeatable behaviour.
- The methods f1 and f2 (he calls them functions) allows us to group a number of light-Bot
instructions together, and to use the method name as a kind of shorthand
for executing all of them. This organization and grouping of steps that logically belong together
is a skill we use at every level of Computer Science thinking.
We call it abstraction, because once we have the method steps defined we can
temporarily forget about its internal detail, and just use the method by its name.
Can you create the steps for function f2 so that when you use f2, light-Bot walks in a clockwise square, and ends up exactly back where it started?
- The light-Bot game has some state associated with it.
- At any time we're on a specific level.
- Part of the state is that the sound is either on or off.
- When we are programming light-Bot we drag the steps into the instruction slots,
and we're in the Programming state. Clicking the GO! button puts us into a Running state.
(It also changes the text on the button to say STOP. This is our feedback that helps us keep track of the
different states.)
- Our external actions, or events, control the state of the system.
We have two buttons when the programm is running: we can either STOP the program, or RESET the level. They do different things.
Learn to think about and understand systems like this in terms of their states, and what events trigger the state changes.
- When we've learnt about state diagrams in the course, we can come back to light-Bot and draw its state diagram to help understand this aspect of light-Bot's internal workings.
- You'll probably find yourself programming some steps that only partially solve a particular level, and then trying them out,
refining or adjusting them, and adding more steps. This exploratory approach is a good way to proceed.
The key thinking message is that sometimes you cannot see the whole picture.
But that shouldn't stop you from making a start. As you firm up the bits and try different things you deepen
your understanding of the problem, and you will start to get insights that were not available when you started.
- Some of the advanced levels of light-Bot are really very tough, and foxed your lecturers! Congratulations if you cracked them.
If you search the Internet, there are pages with hints and solutions to the various levels,
so you can find some answers. But if you do that, be sure that you've really given the problem your best shot first.
Then ask the question "What thinking would I have needed in order to see that solution?"
Remember, this activity is about building your Computational Thinking skills:
it is not just here to teach you how to solve the levels of light-Bot! So have fun solving the levels, but
while you do this, stay alert to how your thinking process are working.