Alice and Algorithms - World Class Educationamanno/Chapter_01_Intro_to_Alice Part 1.pdf · Alice...

16
Alice and Algorithms Chapter 1 Part 1 1-1

Transcript of Alice and Algorithms - World Class Educationamanno/Chapter_01_Intro_to_Alice Part 1.pdf · Alice...

Page 1: Alice and Algorithms - World Class Educationamanno/Chapter_01_Intro_to_Alice Part 1.pdf · Alice and Algorithms Chapter 1 Part 1 1-1. ... 1-9. Algorithms Algorithm o Set of well-defined

Alice and Algorithms

Chapter 1 Part 1

1-1

Page 2: Alice and Algorithms - World Class Educationamanno/Chapter_01_Intro_to_Alice Part 1.pdf · Alice and Algorithms Chapter 1 Part 1 1-1. ... 1-9. Algorithms Algorithm o Set of well-defined

Reasons to Program

The joy of programming

To create a tool

To use your creativity abilities

For non programmers

o Learn a new way to think

Drawing course does same thing

o Helps problem solving skills

Finding answer to question

Determine how to perform a task

Page 3: Alice and Algorithms - World Class Educationamanno/Chapter_01_Intro_to_Alice Part 1.pdf · Alice and Algorithms Chapter 1 Part 1 1-1. ... 1-9. Algorithms Algorithm o Set of well-defined

Alice

A modern programming tool

o 3-D graphics

o 3-D models of objects

People, animals, fantasy creatures, vehicles and backgrounds

Animation

o Objects can be moved around a 3D virtual world

o Similar to a video game or simulation

CD in book has Alice worlds from chapters

Can download Alice 2.4 from the webwww.alice.org

Page 4: Alice and Algorithms - World Class Educationamanno/Chapter_01_Intro_to_Alice Part 1.pdf · Alice and Algorithms Chapter 1 Part 1 1-1. ... 1-9. Algorithms Algorithm o Set of well-defined

Alice Examples

Example Alice worlds

Demonstration video

1-4

Page 5: Alice and Algorithms - World Class Educationamanno/Chapter_01_Intro_to_Alice Part 1.pdf · Alice and Algorithms Chapter 1 Part 1 1-1. ... 1-9. Algorithms Algorithm o Set of well-defined

Origination of Alice

Named in honor of mathematician Charles Lutwige Dodson

o Was able to do complex math and logic

o Knew he needed to make things simple and fascinating for learner

Pen name was Lewis Carroll who wrote

o Alice in Wonderland

o Through the Looking Glass

Page 6: Alice and Algorithms - World Class Educationamanno/Chapter_01_Intro_to_Alice Part 1.pdf · Alice and Algorithms Chapter 1 Part 1 1-1. ... 1-9. Algorithms Algorithm o Set of well-defined

Alice

Programming in Alice is like being a movie director, puppeteer, or choreographer in a 3D world

You create programs by dragging words and objects to editor with mouse

Page 7: Alice and Algorithms - World Class Educationamanno/Chapter_01_Intro_to_Alice Part 1.pdf · Alice and Algorithms Chapter 1 Part 1 1-1. ... 1-9. Algorithms Algorithm o Set of well-defined

Kinds of Animations

Two kinds of animations

o Movie

Can tell a story

Passively watch animation

o Interactive

Active user clicks on mouse or types on keyboard

User actions are called events

Page 8: Alice and Algorithms - World Class Educationamanno/Chapter_01_Intro_to_Alice Part 1.pdf · Alice and Algorithms Chapter 1 Part 1 1-1. ... 1-9. Algorithms Algorithm o Set of well-defined

Programming Terminology

Algorithm – step by step structure to solve a problem

Program – implementation of algorithm using a programming language

Instruction – an action to be performed

Pseudo code – loose set of instructions not tied to any program environment

o Like algorithm, but more geared toward programming

Page 9: Alice and Algorithms - World Class Educationamanno/Chapter_01_Intro_to_Alice Part 1.pdf · Alice and Algorithms Chapter 1 Part 1 1-1. ... 1-9. Algorithms Algorithm o Set of well-defined

Computer

A device that follows instructions for manipulating and storing data

Computer program – set of instructions that computer follows to perform a task

o Instructions must be carefully written to follow a logical sequence

That is key – you need to think of the logical sequence you want the computer to follow

Running or executing program – when computer is performing instructions

1-9

Page 10: Alice and Algorithms - World Class Educationamanno/Chapter_01_Intro_to_Alice Part 1.pdf · Alice and Algorithms Chapter 1 Part 1 1-1. ... 1-9. Algorithms Algorithm o Set of well-defined

Algorithms

Algorithm

o Set of well-defined logical steps

o Must be performed in order to perform a task

1-10

• Example: Making a cup of instant coffee

– Remove lid from coffee jar

– Put lid down on counter

– Remove 1 tsp of coffee from jar

– Place that coffee in a cup

– Add 8 oz of boiling water to cup

– Use teaspoon to stir water and coffee mixture

– Stir 10 revolutions

– Remove teaspoon from cup and place on counter

Is this adequate?

Is it detailed enough?

Is anything

ambiguous?

Page 11: Alice and Algorithms - World Class Educationamanno/Chapter_01_Intro_to_Alice Part 1.pdf · Alice and Algorithms Chapter 1 Part 1 1-1. ... 1-9. Algorithms Algorithm o Set of well-defined

Algorithms

Algorithms are understandable by humans (natural language)

Computers understand machine language not natural language

1-11

Blah

Blah

Blah

0110001001101100011000010110

1000001000000110001001101100

011000010110100000100000

0110001001101100011000010110

1000

Page 12: Alice and Algorithms - World Class Educationamanno/Chapter_01_Intro_to_Alice Part 1.pdf · Alice and Algorithms Chapter 1 Part 1 1-1. ... 1-9. Algorithms Algorithm o Set of well-defined

Programming Languages

Programming languages are converted to machine language by

o Compiler – Instructions converted before executing program

o Interpreter – Each instruction is individually converted during execution, Ex: Alice

1-12

Starting

…01010011011101000110000101110010011101000110

1001011011100110011100100000

out

…011011110111010101110100

With

…0111011101101001011101000110100000100000

Alice

…0100000101101100011010010110001101100101

Page 13: Alice and Algorithms - World Class Educationamanno/Chapter_01_Intro_to_Alice Part 1.pdf · Alice and Algorithms Chapter 1 Part 1 1-1. ... 1-9. Algorithms Algorithm o Set of well-defined

Programming Languages

Operatorso + - * /

o Perform arithmetic and other functions on data

Syntax

o Set of rules that must be followed

o Similar to the set of rules that are followed when people speak a natural language

Program or code

o Consists of keywords, operators, punctuation arranged in proper logical sequence

o Save, compile, link, executable program is produced

1-13

Page 14: Alice and Algorithms - World Class Educationamanno/Chapter_01_Intro_to_Alice Part 1.pdf · Alice and Algorithms Chapter 1 Part 1 1-1. ... 1-9. Algorithms Algorithm o Set of well-defined

Checkpoint

What is a computer?

What is an algorithm?

What is a program?

What language is an algorithm written in?

What is the only language computers understand?

Why were programming languages invented?

1-14

Page 15: Alice and Algorithms - World Class Educationamanno/Chapter_01_Intro_to_Alice Part 1.pdf · Alice and Algorithms Chapter 1 Part 1 1-1. ... 1-9. Algorithms Algorithm o Set of well-defined

Class Exercise

Write an algorithm that explains how to make a Peanut Butter and Jelly sandwich

Assume the person does not know anything about how to make sandwiches

1-15

Page 16: Alice and Algorithms - World Class Educationamanno/Chapter_01_Intro_to_Alice Part 1.pdf · Alice and Algorithms Chapter 1 Part 1 1-1. ... 1-9. Algorithms Algorithm o Set of well-defined

Class Exercise

Describe the scene of two volleyball players on opposite sides of a volleyball net

Write algorithm to have one player serve the ball to another

Have the other player jump up with arms raised to block the ball

Have the ball fall to the ground across from the net

Make sure you reset the players to the resting position

Reset the server at same time as ball moves

1-16