Where to find Boolean practice in the game:
Learners are introduced to the concept of Booleans in the Asteroid Belt.
Definition:
A Boolean is a type of data that has only two possible values: true or false. You can think of a boolean like the answer to a yes or no question. If the answer is yes, the Boolean value is true. If the answer is no, the boolean value is false.
Example:
If you've ever answered a True or False question, then you've used a Boolean value before! For example, take a look at the image below. Based on the picture is this statement true or false: The tunnel door is OPEN.
Based on this image, is the tunnel door open? Yes! so the Boolean value is True. But what if there was a way I could click a button and shut the tunnel door. Now, the situation has changed - is the door open? No, It's not, so the Boolean is false. Notice how the statement, or question, stays the same - but the Boolean result can change based on the situation.
When programming, it is often necessary to establish if something in true or false, so a computer can make decisions about what to do next.
Application
In Kodable, we want our fuzz to roll to the end of the maze. In Boolean practice levels, there will be a tunnel blocking the pathway! We need to find a way to get our fuzz through this tunnel.
First, check to see if the tunnel is open or closed. There is a statement above the tunnel that reads "door.open == FALSE". You might recognize that the value "false" is a Boolean! The Boolean is false when the tunnel is NOT open. We can change the Boolean value to TRUE if we can open the tunnel door.
Try coding the fuzz to roll over that button that matches the tunnel. When the fuzz jumps on the button, the tunnel door opens and the Boolean value switches to be "door.open == TRUE. Now the fuzz can roll on through.