cs320n – elements of visual programming
DESCRIPTION
CS320n – Elements of Visual Programming. Introduction to Alice Mike Scott (Slides 1-1). What We Will Do Today. look at the Alice programming environment create some simple programs in Alice. What is Alice?. Named in honor of Lewis Carroll’s (pen name) Alice in Wonderland - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: CS320n – Elements of Visual Programming](https://reader030.vdocument.in/reader030/viewer/2022033106/56812ba0550346895d8fc880/html5/thumbnails/1.jpg)
CS320n – Elements of Visual Programming
Introduction to Alice
Mike Scott
(Slides 1-1)
![Page 2: CS320n – Elements of Visual Programming](https://reader030.vdocument.in/reader030/viewer/2022033106/56812ba0550346895d8fc880/html5/thumbnails/2.jpg)
Visual Programming Introduction to Alice 2
What We Will Do Today• look at the Alice programming
environment
• create some simple programs in Alice
![Page 3: CS320n – Elements of Visual Programming](https://reader030.vdocument.in/reader030/viewer/2022033106/56812ba0550346895d8fc880/html5/thumbnails/3.jpg)
Visual Programming Introduction to Alice 3
What is Alice?• Named in honor of Lewis Carroll’s (pen
name) Alice in Wonderland– Charles Lutwidge Dodgson was also a
mathematician and logician• A modern programming tool
– purpose of tool, learn how to program, write algorithms
– 3-D graphics– 3-D models of objects
• Animation– Objects can be made to move around virtual
world (a simulation or a video game. Simple Pixar.)
![Page 4: CS320n – Elements of Visual Programming](https://reader030.vdocument.in/reader030/viewer/2022033106/56812ba0550346895d8fc880/html5/thumbnails/4.jpg)
Visual Programming Introduction to Alice 4
Computer Programs• General purpose programming languages
can be used for almost any task
• Alice is not a general purpose programming language. – It is an application specific language– designed for a specific task, creating 3D
animations– lots of application specific languages.
Example: language for working with DNA data
![Page 5: CS320n – Elements of Visual Programming](https://reader030.vdocument.in/reader030/viewer/2022033106/56812ba0550346895d8fc880/html5/thumbnails/5.jpg)
Visual Programming Introduction to Alice 5
Fundamental Tools• All languages contain these elements
1. list of instructions – “Pack lunch, pack snack, put homework in backpack.”
2. decision making – “If I didn’t shave yesterday, shave today.”
3. repetition of behavior – “Do a load of laundry until there is no more dirty laundry.”
4. modularization. Big rocks into little rocks. “To do a load of laundry: gather clothes, get clothes right-side out, put clothes of similar color into washing machine…”
5. Generalization: Solve many different problems with one set of instructions
6. Compute a result – “How much is it going to cost to fill up my car with gas?”
![Page 6: CS320n – Elements of Visual Programming](https://reader030.vdocument.in/reader030/viewer/2022033106/56812ba0550346895d8fc880/html5/thumbnails/6.jpg)
Visual Programming Introduction to Alice 6
What does Alice run on?• Alice is free.
• Alice is written in Java– only working versions are for PCs and Macs
with OSX 10.3 or higher (relatively new, may still have bugs)
– Sorry, no Linux, yet– the book comes with a copy of Alice for
Windows machines– www.alice.org– also on the computers in the CS Elements lab
![Page 7: CS320n – Elements of Visual Programming](https://reader030.vdocument.in/reader030/viewer/2022033106/56812ba0550346895d8fc880/html5/thumbnails/7.jpg)
Visual Programming Introduction to Alice 7
Fast Start Up • Can quickly learn to create
– a simple animation in a matter of minutes– a non-trivial animation in a few class periods
• Can learn to use the Alice interface in a few class periods if you do a couple of exercises at home
![Page 8: CS320n – Elements of Visual Programming](https://reader030.vdocument.in/reader030/viewer/2022033106/56812ba0550346895d8fc880/html5/thumbnails/8.jpg)
Visual Programming Introduction to Alice 8
Installing Alice• If you want to install Alice on you computer at home
– use the CD that comes with the textbook• CD installation is straightforward
– download Alice from the web• http://www.alice.org/downloads/authoringtool/• file format is .zip• must “unzip” file using a program such as winzip
• problems? post to newsgroup
![Page 9: CS320n – Elements of Visual Programming](https://reader030.vdocument.in/reader030/viewer/2022033106/56812ba0550346895d8fc880/html5/thumbnails/9.jpg)
Visual Programming Introduction to Alice 9
Memory Management• Alice automatically manages memory• But, writing and testing an animation is an
intense load on the computing system – a crash can occur.
• Best solution: • Alice (the program) reminds you every so often
so save your work• save your programs often!• if working in lab when you logout the computer is
wiped -> save to your account or to a backup system such as a memory stick
![Page 10: CS320n – Elements of Visual Programming](https://reader030.vdocument.in/reader030/viewer/2022033106/56812ba0550346895d8fc880/html5/thumbnails/10.jpg)
Visual Programming Introduction to Alice 10
The Power of Alice• Automatically keeps track of 3-D objects
– what objects are in the virtual world– types of objects– positions of objects in the world
![Page 11: CS320n – Elements of Visual Programming](https://reader030.vdocument.in/reader030/viewer/2022033106/56812ba0550346895d8fc880/html5/thumbnails/11.jpg)
Visual Programming Introduction to Alice 11
Demo• Starting Alice
• Loading a World
• Running A World
• Saving a World
• How to Exit
![Page 12: CS320n – Elements of Visual Programming](https://reader030.vdocument.in/reader030/viewer/2022033106/56812ba0550346895d8fc880/html5/thumbnails/12.jpg)
Visual Programming Introduction to Alice 12
The World• Alice Programs / Movies take place in a
virtual world
• When you start a new world in Alice you select the background
•The world consistsof a sky and the ground•Can’t be changed aftercreating the world•the world is not infiniteDEMO(I don’t like roller coasters any more)
![Page 13: CS320n – Elements of Visual Programming](https://reader030.vdocument.in/reader030/viewer/2022033106/56812ba0550346895d8fc880/html5/thumbnails/13.jpg)
Visual Programming Introduction to Alice 13
Objects in Alice• Objects already exist. Hundreds of them
![Page 14: CS320n – Elements of Visual Programming](https://reader030.vdocument.in/reader030/viewer/2022033106/56812ba0550346895d8fc880/html5/thumbnails/14.jpg)
Visual Programming Introduction to Alice 14
Program an Object
![Page 15: CS320n – Elements of Visual Programming](https://reader030.vdocument.in/reader030/viewer/2022033106/56812ba0550346895d8fc880/html5/thumbnails/15.jpg)
Visual Programming Introduction to Alice 15
Where Do Objects Come From?• They are pre built
– creating 3D objects is another area of computing and graphic design
• Sources of 3D objects – the local gallery that comes with the software
– Alice web gallery
• How are objects added to the world?
![Page 16: CS320n – Elements of Visual Programming](https://reader030.vdocument.in/reader030/viewer/2022033106/56812ba0550346895d8fc880/html5/thumbnails/16.jpg)
Visual Programming Introduction to Alice 16
Adding Objects• Click on the green “Add Objects” button
• World expands and local gallery displayed
![Page 17: CS320n – Elements of Visual Programming](https://reader030.vdocument.in/reader030/viewer/2022033106/56812ba0550346895d8fc880/html5/thumbnails/17.jpg)
Visual Programming Introduction to Alice 17
Adding Objects• Local gallery divided into a directory based
on subject
• add instances of objects to world by – dragging and dropping or – click on object and select add instance option
![Page 18: CS320n – Elements of Visual Programming](https://reader030.vdocument.in/reader030/viewer/2022033106/56812ba0550346895d8fc880/html5/thumbnails/18.jpg)
Visual Programming Introduction to Alice 18
Objects in the World• Can have multiple instances of objects
from the same class in the World– class: like a cookie cutter– objects: like the cookies
star cookie cutterstar cookie class
star cookiesstar cookie objects
![Page 19: CS320n – Elements of Visual Programming](https://reader030.vdocument.in/reader030/viewer/2022033106/56812ba0550346895d8fc880/html5/thumbnails/19.jpg)
Visual Programming Introduction to Alice 19
Objects in the World
penguin class penguin objects in a virtual world
![Page 20: CS320n – Elements of Visual Programming](https://reader030.vdocument.in/reader030/viewer/2022033106/56812ba0550346895d8fc880/html5/thumbnails/20.jpg)
Visual Programming Introduction to Alice 20
Objects in the World• The Objects that are present in the current
world are listed in the Object Tree
• The top left panel in the Alice programming environment
• Every world comes with a light, a camera (point of view for the movie whenplayed), and the ground
![Page 21: CS320n – Elements of Visual Programming](https://reader030.vdocument.in/reader030/viewer/2022033106/56812ba0550346895d8fc880/html5/thumbnails/21.jpg)
Visual Programming Introduction to Alice 21
Object Dimensions• Objects in Alice worlds are 3 dimensional
height width depth
![Page 22: CS320n – Elements of Visual Programming](https://reader030.vdocument.in/reader030/viewer/2022033106/56812ba0550346895d8fc880/html5/thumbnails/22.jpg)
Visual Programming Introduction to Alice 22
Object Position
• Objects – are positioned in 3-D space– Have six degrees of freedom (directions of movement)
![Page 23: CS320n – Elements of Visual Programming](https://reader030.vdocument.in/reader030/viewer/2022033106/56812ba0550346895d8fc880/html5/thumbnails/23.jpg)
Visual Programming Introduction to Alice 23
Objects “Know” Relative Directions• Yellow box around
penguin is itsbounding box
• light blue line isup/down
• pink line is left/right
• dark blue line isforward backward
• DEMO
![Page 24: CS320n – Elements of Visual Programming](https://reader030.vdocument.in/reader030/viewer/2022033106/56812ba0550346895d8fc880/html5/thumbnails/24.jpg)
Visual Programming Introduction to Alice 24
Exercises
• if you want to work at home, install Alice on your computer
• Complete Appendix A, Part 1, using Alice– a walkthrough of using Alice
• Complete the tutorials that come with Alice
![Page 25: CS320n – Elements of Visual Programming](https://reader030.vdocument.in/reader030/viewer/2022033106/56812ba0550346895d8fc880/html5/thumbnails/25.jpg)
Visual Programming Introduction to Alice 25
Starting Tutorials