MAKECODE SKILLS #1
DEVELOP A COMPUTER PROGRAM
Writing code for a program that performs a specified task using a programming language
SPECIFIED TASK
A task defined by the programmer (what it should do and why), performed by a program that meets a set of specifications.
The program you code must build a structure using an Agent (MakeCode) in Minecraft.
For example: a petting zoo, a swimming complex, a viewing platform, etc.
SPECIFICATION
These specifications include (for achieved grade):
<>Using variables (at least two) storing at least two types of data (e.g. numeric, text, Boolean)
<>Using sequence, selection and iteration control structures e.g. a logical well written program, and an if structure, and a loop
<>Using input from a user, sensors or another external source e.g. passing a parameter to the chat block, and/or using sensing to determine information about the environment (such as agent detect block)
<>Using one or more of: data stored in collections (e.g. an array), or a user-defined functions
<>Setting out the program code clearly
<>Documenting the program with comments
<>Testing and debugging the program to ensure that it works on a sample of expected cases
TASK
Complete this Terminology research task to help your understanding of the terms used in this assessment.
FOR HIGHER GRADES REFER TO THE ASSESSMENT SCHEDULE Computer Science Intro Learning Resource
If you aren't familiar with the concepts of computer programming or using the Code Connection to program in Minecraft this resource will help a lot.
VARIABLES
Variables are used in computer programming to store specific values within a program. They are assigned both a data type as well as a value. There are three types of variables (two different types must be used): numeric, text, boolean – true or false.
Using Variables including:
1. Setting (or assigning) a variable to a value of certain data type
2. Changing the value of a variable
3. Using variables in blocks of code
TASKS
1. Read about variables in MakeCode minecraft.makecode.com/blocks/variables/var
2. Read about assigning a value to a variable minecraft.makecode.com/blocks/variables/assign
3. Read about changing a variable's value minecraft.makecode.com/blocks/variables/change
4. Try to implement these examples in MakeCode of using the three different types of variables.
DECLARATION OF & USE OF VARIABLES
The set block for declaring a variable and assigning it a value should be put before the code using the variable occurs. If this is not done, an error message will happen. It also makes it easier to understand the program as this habit allows programmers to know what variables are being used, their datatype and the values they are initially given. It is good practice to use variable names that describe what the variable is being used for e.g. dist could the name of a numeric variable that measures a distance.
THE ORDER (OR SEQUENCE) OF CODE
The sequence of the block changes the way the code works. If the code breaks, a rule like not declaring a variable an error message is sent from the interpreter. If the code does not break a rule but is not logically correct (semantically) then it will not do what you want.
Sequential execution: all programming languages run from top to bottom, one block of code after the other.
IF STATEMENTS
Selection: a conditional statement has a condition, and when the condition becomes true, the statement is executed. A conditional statement has the form of “if <condition> then statement” or “if <condition> then statement/s else statement/s”. If or ‘conditional statements’ can be used to stop a loop that goes on and on.
TASKS
1. Do this CS Intro conditionals activity 1 https://minecraft.makecode.com/courses/csintro/conditionals/activity-1
2. Activity 2 minecraft.makecode.com/courses/csintro/conditionals/activity-2
LOOPS
Iteration: this repetition. A loop that repeats something until a condition is met. There are three types of loops (and two variations of the For loop):
1. For
a. For element … of …
b. For … from 0 to …
2. While
3. Repeat
TASKS
a. Go to minecraft.makecode.com/blocks/loops to see the MakeCode for each type of loop.
b. You should have completed the Agent Moves tutorial, if not try minecraft.makecode.com/courses/csintro/iteration/activity-1
c. Complete the Dance dance agent activity minecraft.makecode.com/courses/csintro/iteration/activity-2
d. Complete the Help agent farmer activity minecraft.makecode.com/courses/csintro/iteration/activity-3
Minecraft MakeCode tutorial by M.Williams & G.Smirk 2018