CHAPTER 1 WHAT IS CODE A soccer player kicks the ball It soars past the goalie and into the net The crowd shouts and cheers The player off balance falls onto the field But no one is hurt The soccer player isn’t human It’s a robot In fact all the players are robots They run kick and pass the ball Code controls a robot’s actions It tells this robot how to move its arms and legs 5
The robots seem to do these things without anyone controlling them Yet all robots are controlled by something Each robot has a small computer inside it The computer is like a brain for the robot A brain controls a person’s body In a robot the computer tells the robot’s body what to do Unlike a person’s brain a robot’s computer cannot think for itself It must be told what to do That is what code is for Code is a set of instructions that tells a computer what to do It can be used for simple actions such as moving forward It can also be used for complicated actions such as passing a soccer ball 6
The computer inside a robot is also called the controller Code breaks each action down into simple steps It tells the computer what to do for each step The computer follows the steps to complete the action Together all these steps make up the robot’s program 7