Lecture 13

This is a lecture record from your database.

Title
Negative numbers in Minecraft
Description
Learn to spot negative numbers in Minecraft
Grade level
Private
false
Model creativity
0.5
Lesson plan
Imagine you are trying to find your friend in Minecraft. They tell you their coordinates, something like (-321, 64, 201). What does "-" in 321 mean? You are currently on (100, 24, -234). What direction should you go to get to your friend? To get started, lets consider a simplified model. Instead of 3d minecraft, imagine a 2d minecraft. There are only 2 dimensions, up/down and left/right. Assuming your friend is on the surface, we can ignore the up/down dimension and that leaves us with just the left/right. Question to ask: ``` Imagine a 2D Minecraft world, just left and right. Your friend is somewhere to the left or right. Let's say, your friend's location is 5 blocks to the right of spawn, and you are 2 blocks to the right of spawn. Which way do you need to go to find your friend? ``` So, if you were designing such a game, you can number block locations by 1,2,3,4,5, ... going from spawn to the right. But what if you wanted the world to go in both directions? Left and right from the spawn? One approach is to have to sequences of numbers 1,2,3, ..., one going right and another going left. Ok, but say now you place a bed and your spawn point moves to some other location. Now all numbers are wrong. How would we adjust them? If bed is at 4, then we need to crop right sequence to start from 5, and add numbers to the left sequence to start from 3. So we get: Before: ``` 5 4 3 2 1 <- left sequence 0 <- Current position 1 2 3 4 5 <- right sequence ``` After: ``` 5 4 3 2 1 0 1 2 3 <- left sequence 4 <- Current position 5 6 7 <- right sequence ``` Do you see why this is cumbersome? Let's simplify this! First, we need some imagination. Let's add labels to each number, so right numbers would be 1R, 2R, 3R, ... and left numbers would be 1L, 2L, 3L, ... Note that it doesn't matter what symbols we use for L and R. We might as well use happy and sad smiley faces. Let's also define some rules for shifting the numbers. Can you think of an analogy? Say you wanted to shift sequence 1, 2, 3, 4, by 2 to the right? What would you do? Right, add 2 to each number to get 3, 4, 5, 6. So, how do we shift left? Naturally, why don't we try subtracting? Since that's reverse of adding. Then if we have 3, 4, 5, 6, and we want to shift it to the left by 2, we subtract 2 from each number to get back to the original sequence. Now, what is 5R + 2L? So, you walk 5 steps to the right and 2 steps to the left. What is your current position? Correct, 3R. So, you see how we can use "left numbers" to replace subtraction by addition? 5R - 2R = 5R + 2L. Now we can write all our block coordinates as a single sequence ..., 5L, 4L, 3L, 2L, 1L, 0, 1R, 2R, 3R, 4R, 5R, ... And if we want to shift it to the right, we add for example 2R to each number. And if we want to shift it to the left, we add for example 2L to each number. Do you get it? Now, the common convention in mathematics is not to write R and instead of 2L, we just write -2. This is not "subtract 2", but "negative 2".
Version
1
Teacher language
Student language