Control Flow
Variables
Loops
Functions
comments
100

Why do we use if statements in Javascript?

To do something only if a condition is true. 

100

// There are many color constants. You can set an objects color like

obj.setColor(color);

100

Example: call moveBall every 40 Milliseconds

function moveBall() {ball.move(x, y);}

100

How many times should start function be defined?

1

100

In the first game, players had to adhere to a strict "stop" condition. Which coding concept best resembles this, where a certain condition must be met before proceeding?

conditional statements (like if/else)

200

Why do we use if/else statements?

To either do something if a condition is true or do something else.

200

Assign to an existing variable 

myVarName = 10 

200

//This moves Karel to a wall/

var height = getheight(); while(frontisclear()){move();}

200

Why do we use functions in coding?

Break down program into smaller parts, avoid repeating code and make program more readable.

200

The Dalgona candy challenge presented players with a complex shape to carve. In coding, how would you represent this complex shape, perhaps using a 2D array?

Data structures (like arrays or matrices) to represent the shape's coordinates and patterns.

300

What must be true before the function is called?

what is precondition

300

What does the following mean:  for(var i = 0; i < 10; i ++){putball();

/ This puts down 10 balls /

300

What does this mean: for (ar i = 0; i , 10; i++) {move();}

loop move 10 times

300

A way to define a new command in a program

Function 

300

The Glass Bridge game involved a 50/50 chance of stepping on safe or breaking glass. How could you simulate this random outcome in a coding program?

Random number generation or probability functions.

400

Let us do one thing if a condition is true, and something else otherwise 

If/else statement 

400

What does the term mean: txt.move(dx, dy)

Var color = new color(255, 24, 180);

400

for(var i = 0; i <arr.length; i++){var cur = arr[i];

looping over an array

400

What is a function?

A way to define a new command in a program 

400

The Tug-of-war game required players to work together strategically. In a multi-agent system, how would you model the cooperation and competition dynamics between the players?

Game theory, multi-agent systems, or distributed algorithms.

500

Why do we use // to write in the code 

to make it clear of what is going on in the code


500

The values are between 0-255 for each component.

car color = new Color(128, 128, 128);

500

Allows you to repeat a section of code a fixed number of times

For loop

500

A way to break down a program into smaller, more manageable parts

function!

500

What is the name of the game where players must form teams to play tug-of-war on a moving platform?

Tug-of-war