Write down instructions to walk around the edge of the room.
Pseudocode (noun) Simplified instructions that can be turned into code.
Remember the 🍞 PB&J?
Pseudocode will go in our
// comments and are helpful for reminders from our past self to our future self.
Let’s write out pseudocode for the four conditionals needed to make a path around the screen.
Pseudocode Practice Make Pseudoperfect
Pretend you’re talking to the emoji:
“Go to the right until you hit the edge of the screen”
Now, we’re going to see if we can be more specific in our pseudocode, by starting to add variables.
In your code, you will have some variables for the
y position of the emoji. You also have the built-in variables of
windowHeight to know where the edges of the screen are.
Underneath you pseudocode, write comments for how to go from pseudocode to p5 code.
|“Go to the right until you hit the edge of the screen”|
// if y <= 32, x = x + 1 // if x >= windowWidth - 10, y = y + 1 // if y >= windowHeight - 32, x = x - 1 // if x <= 32, y = y - 1