Lesson Preview

Teach Syntax and Customization
with Switch & Glitch

This is a printable preview of one of our lessons. Subscribe to gain access to this and 180+ other lessons using 35+ games, and track your students' progression in real time! Learn More

This is a printable preview of one of our lessons. Subscribe for more great content! Learn More

Theory

Syntax

“Computers. the grammatical rules and structural patterns governing the ordered use of appropriate words and symbols for issuing commands, writing code, etc., in a particular software application or programming language.”

-Dictionary.com

Syntax error.

Teacher Resources

Tell the students, in your own words, that a computer needs a specific type of syntax to function:

  • A computer receives scripts
  • These scripts must follow a certain grammar, known as “syntax”
  • The grammar depends on the programming language. C++ and Java-languages, for example, utilize a different kind of syntax.
  • If the syntax is wrong, the program will not function as desired and/or produce error messages, such as “Syntax Error”.
  • A parser is a small program that interprets the input of the user, but even it cannot function if the commands do not adhere to the syntax.

Discuss with the students:

“Does it sometimes occur that another person doesn’t understand what you’re telling them? Does it matter how you say things when you are trying to be understood? What happens if you try to speak English to a Frenchman? Will he understand? Which languages do computers speak? And do you any names of these programming languages?”

Most important observations for learning:

  • Commands given to computers must follow a strict syntax.
  • Computers are incapable of human interpretation, and only complete direct orders.
  • If a command is not written the right way, the computer will not be able to fulfill it.

READ:

Image Source: Syntaks error, Wikimedia Commons.

Play

Lesson Goal

Play through the Switch & Glitch Single Player Jungle Levels 1-5.

Afterwards you get to customize your robot!

Gameplay screenshot.

Teacher Resources

Tell the players to complete the Jungle levels 1-5 and afterwards to return to the main menu. In the Space Hopper spaceship, there is a 3D printing room where you can customize your own robot

  • Most Switch & Glitch levels have the goal of reaching the purple end zone.
  • You can find Metagel in the levels, which you can collect by walking on the same square that they occupy.
  • You attain stars in the levels by completing them as efficiently as possible (by using the fewest number of moves).

Customize

Customize.

Teacher Resources

Once everyone has completed the first levels of the game, suggest them to return to the main screen and select the room (on the left) that is marked by the brush symbol.

You can reach the customization room in the game’s starting room: turn the view left and touch the doorway of the 3D room. You get more Metagel by playing the single player levels or by watching advertisements (the movie theater room on the right in the main screen).

Share & Discuss

Share & Discuss

  • Did somebody attain 3 stars in the missions?
  • How many commands did you use?
  • How hard is it to give the right syntax (= the right commands)? How many times did the robots crash into walls?

Tasks after Playing

  • What kind of programming errors did you make during play?
  • What would happen if computer program wouldn’t work in real life?
  • What do you think programmers should take account when they design programs?

Teacher Resources

You can give the students time to consider these questions. They can answer them as pairs, as small groups, or individually, whichever way you prefer. These tasks function as control questions and help students demonstrate their learning which will help your assessment.

DISCUSS: You should point out that running to the wall is indeed an error. Programs that work in a way they were not intended are flawed. If the computer directing traffic lights would crash or show two green lights at the same time, the results could be horrible. How ‘good’ the programs should depend on how important their task is. For instance, computer programs that run nuclear power plants should never crash.

Optionally

You can tell students the story of Apollo 11 moon landing and how it was saved because software was coded to work even when guidance computer’s memory was filled because of faulty radar.

READ: