Unit 3 Essay example

Submitted By yuriapeace
Words: 884
Pages: 4

TASK 2

Turn to p. 82 – 83 and answer questions 1 – 11.

1. What action(s) does as function perform that a method does not? proximity – how close the object is to some other object in the world (such as distance to, distance above)
Size – dimensions such as height, width, and depth, and how these compare to the dimensions of another object in the world
Spatial relation – orientation compared to another object in the world (such as to left of, to right of)
Point of view – position in the world
Other – miscellaneous items such as the name of a subpart of the object

2. What type of value is returned by each of the following built-in functions?
a) distance to – object (e.g., a spiderRobot)
b) is within threshold of – object (e.g., a spiderRobot)
c) is wider than – object (e.g., a spiderRobot)
d) width – number (e.g. 5 or -19.5)

3. What are the four operations that can be used in a math expression in Alice?
The four operations that can be used in a common math expression are add (+), subtract (-), multiply (*), and divide (/).

4. List four different control structures used in creating a program in Alice.
Control structures are programming statements that allow user to control the order in which instructions are executed. The four control structures used in creating a program are Do in order, Do together, conditional execution, and repetition.

5. What type of function value is used to check a condition in an If/Else statement?
Boolean value (true or false) is used to check a condition in an If/Else statement.

6. Describe what happens in an If/Else statement when the instruction in the Else part is Do Nothing?
When the instruction in the Else part is Do nothing, it means that Else is not needed, and the statement would be a single path If/Else statement.

7. The Following relational operation is available in the World’s functions list: a <= b
a) Give an example of what “a” and “b” can represent.
This relational operation (a <= b) means less than or equal. Having a to represent the number 1 and b to represent the number 2 is a possible example.

b) What type of value is obtained when this operation is evaluated?
Number is the type of value that is obtained when this operation is evaluated.

8. What is the purpose of a Loop statement?
The purpose of a Loop statement is to repeat an action a counted number of times.

9. Alice does not have built-in collision detection.
a) What built-in function can be used to detect when one object is too close to another?

b) Give an example of an instruction that uses the function to avoid collision.
One way to avoid collision is to adjust the distance that the object so it doesn’t move the entire distance. Adjusting the distance requires the use of an arithmetic expression to subtract a small value from the distance.

10. Sketch each of the following:
a) A storyboard for exercise 1, below.
b) A flowchart for exercise 1, below.
11. Sketch each of the following:
a) A storyboard for exercise 6, below.
b) A flowchart for exercise 6, below.

TASK 5

Turn to p. 128 and answer questions 1 – 7 and 13 a – b.

1. Alice has hundreds of pre-written classes for instantiating objects in an Alice world. Where, in the Alice interface, can you find these pre-written classes?
In Alice interface, you can