CS Fundamentals

Computer Science Content

Algorithm

An algorithm is a sequence of steps to solve a problem or perform a task. Similar to changing a tire or following a recipe to bake a cake, these actions take a specific step-by-step processes. In Alice, the algorithms we develop help to animate the virtual world.


Examples of Algorithms

  • Following a recipe
  • Following navigation directions
  • Other examples?

Event

How does a computer know when to run an algorithm? In Alice, we will use the command: “When the world starts…” (do the following stuff). Computers “listen” for events to occur, and when they “hear” an event, they run some code.

  • When key pressed…
  • When mouse clicked…
  • When screen touch…

Sequencing

In Alice, code runs sequentially one block after another. Sequencing refers to the order in which things happen in your code.

Linear Sequencing

“When world starts… jump then spin.” The object will jump up, come back down to its original position, and then spin. Spin does not run until after the jump sequence ends.

Parallel Sequencing:

“When world starts… do together{jump then spin}. The object will initiate the jump and spin sequences at the same time. The object will jump up and spin and then come back down.

Objects, Variables & Methods

Object:

What we see displayed or represented on the screen (a figure, a ball, a dog, a horse). Objects have data (properties) and can do things (methods).

Properties

Storage for information about an object. A Horse has a size, color, image, opacity, fill type, texture, etc.

Method

A group of messages/instructions directed at an object to cause it to perform a particular action. A Horse can roll, move, turn, etc.