- You're writing programs! Each time you solve a level you're providing a recipe of steps that are executed. The outcome is an exact sequence of steps with consistent, repeatable behaviour.
- The functions f1 and f2 allow you to group a number of light-Bot instructions together, and to use the function name as a kind of shorthand for executing all of them. This organization and grouping of steps that logically belong together is a skill you'll use at every level of Computer Science and Information Systems thinking. We call it abstraction, because once we have the function steps defined we can temporarily forget about its internal detail, and just use the function 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?
- light-Bot has some state associated with it.
- At any time you're on a specific level.
- Part of the state is that the sound is either on or off.
- When you are programming light-Bot you drag the steps into the memory, and you're in the Programming state. Clicking the GO! button puts you into a Running state. (It also changes the label of the button to say STOP which is your feedback that helps you keep track of the different states.)
- Your external actions control the state of the system. You 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 you've learnt about state diagrams in the course, come back to light-Bot and draw its state diagram to help understand this aspect of light-Bot's internal workings.
- You probably found yourself programming some steps that only partially solved a particular level, and then trying them out, refining or adjusting them, and adding more steps. This exploratory approach to tackling tough problems underlies almost all the experimental disciplines, and is now in favour with many software developers. 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, you will start to get insights that were not available at the outset.
- 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 to be able 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 level 12 of light-Bot!