I created this website to document the use of Minecraft in the Alfriston College Digital Technology curriculum 2011-2021
The Alfriston College Minecraft Code World version 3 was custom built by learners; Akhil, Patrick, Matthew, Hayden, Zeljko & Kreesan for learning about the principles of Computer Science. Learners would write code using Lua to program commands that included Loops, While Loops, If Statements, Variables, Functions & Arrays for a Minecraft Turtle to complete tasks. When Microsoft purchased Minecraft the platform changed to MakeCode so this webpage is a retrospective of coding at Alfriston College from 2014-2016.
BASIC CODE
LOOPS
TASK: Place your turtle on the starting point and program using loops (similar code merged together and repeated) to reach the end of the path, while building a small bridge. DEFINITION: Simplified lines of code that completes a much greater task. If the turtle had to move forward 100 spaces, instead of writing 100 lines of turtle.forward() code you only need 3 lines of code. This makes coding quicker, more efficient & less opportunity for mistakes.
Example code: for a = 1 , 4 do (new line) turtle.placeDown() (new line) end
“for a = 1 , 4 do” means the code that follows will be repeated 4 times and must follow with an end. So if you use turtle.foward() instead the turtle would move forward 4 times instead of rewriting turtle.forward() 4 times on its own.
WHILE LOOPS
TASK: Place your turtle on the starting point and program using while loops (similar code merged together and repeated) to reach the end of the path while destroying obstacles and building a larger bridge.
DEFINITION: Extremely similar to “loops” but instead of telling the turtle to do an action a specific number of times it continues to complete the action while something is either in its way or isn’t. For this we use either “detect() = false” meaning nothing is in the turtle’s way or “detect() = true” if something is in the turtle’s way.
Example code: while turtle.detect() = false do (new line) turtle.dig() (new line) turtle.forward() (new line) end.
This code means that while something is in the turtle’s way it will dig the obstacle in it’s way then move forward. This is code for the obstacle, you must create the code for building the bridge & to make it through the path as well.
IF STATEMENTS
TASK: Place your turtle on the starting point and program it to reach the end of the path while destroying obstacles, avoiding obstacles both basic & challenging & also building small bridges
DESCRIPTION:“If Statements” are a single line of code which help your turtle overcome possible situations that they may encounter where normal code won’t work. A prime example of this is the fact that not even turtles can dig through bedrock so you would use the following code.
Example code: if turtle.dig() = false then turtle.up() turtle.forward() turtle.forward() turtle.down() end
This code will cause the turtle to go around the unmineable object, which in this case is bedrock. Using this line of code & previous loops complete the course.
VARIABLES
TASK: Place your turtle on the starting point and program your turtle to reach the end of the path destroying obstacles and creating bridges while using variables to do so.
DEFINITION: A variable in computer programming is a letter based file which stores information for the user to retrieve at any given moment to simplify the code being used. If you refer to “loops” the basis of the code was “for 1 , num do”. Variables are extremely similar and are like so...
Example code: “for a = 1 , num do”. “a =” means that the numbers that follow will be known simply as “a” and can be called whenever they’re needed.
Try to include variables into your “loops” and “if statements” to complete the course.
FUNCTIONS
TASK: Place your turtle on the starting point and program it to reach the end of the path while destroying obstacles, avoiding obstacles (both basic and challenging) and finally building small bridges.
DESCRIPTION: Functions involve storing numerous lines of code into word based shortcuts that you can call at anytime. This decreasing the amount of code required, making your code more efficient and easier to understand/complete.
Example code: function avoidbedrock() if turtle.dig() = false do turtle.up() turtle.forward() turtle.forward() turtle.down() end end
Now instead of writing this complicated code numerous times you can just write avoidbedrock() as if it was a normal line of code such as turtle.forward(). The new object (orange stained glass) will be placed both in your inventory and on the course. Just like bedrock it is also undigable so you will need to avoid it. For this we will compare whats in your inventory with the object in front of your turtle and if they match the code will continue like so;
Example code: function avoidstainedglass() if turtle.compare(1) = true then turtle.up() turtle.forward() turtle.forward() turtle.down() end end
Using this and other lines of code you have learn’t to complete the course.
ARRAYS
TASK: Place your turtle on the starting point and program it to reach the end of the path while destroying obstacles, avoiding obstacles (both basic and challenging) and finally building small bridges.
DESCRIPTION: Functions involve storing numerous lines of code into word based shortcuts that you can call at anytime. This decreasing the amount of code required, making your code more efficient and easier to understand.
Example code: function avoidbedrock() if turtle.dig() = false do turtle.up() turtle.forward() turtle.forward() turtle.down() end end
Now instead of writing this complicated code numerous times you can just write avoidbedrock() as if it was a normal line of code such as turtle.forward(). The new object (orange stained glass) will be placed both in your inventory and on the course. Just like bedrock it is also undigable so you will need to avoid it. For this we will compare whats in your inventory with the object in front of your turtle and if they match the code will continue like so;
Example code: function avoidstainedglass() if turtle.compare(1) = true then turtle.up() turtle.forward() turtle.forward() turtle.down() end end Using this & other lines of code you have learn’t to complete the course.