introduction to csci 1
DESCRIPTION
Introduction to CSCI 1. How this class will work. http://users.drew.edu/sbradsha/CSCI1-Spring2007/. Alice. A modern programming tool 3-D graphics 3-D models of objects Animation Objects can be made to move around the virtual world (a video game or simulation implemented in 3-D). - PowerPoint PPT PresentationTRANSCRIPT
Introduction to CSCI 1
How this class will workhttp://users.drew.edu/sbradsha/CSCI1-Spring2007/
Alice
A modern programming tool 3-D graphics
3-D models of objects
Animation Objects can be made to move around the virtual world (a video game or simulation implemented in 3-D)
The basics of programming
A computer program is a set of instructions that tell the computer what to doIt is important to write your programs in an “elegant” fashion.Huh? Two primary functions:
To tell the computer what to doTo tell other humans what you want the computer to do
Elegant programs
A program is elegant if other humans can easily understand and appreciate the intentions of the original programmer.
Your goal should be to make your program easy to read, even by someone not a programmer
Should not require any head scratching
Programs composed from simple ideas
A list of instructions like a recipe
Ifs (e.g., if it is raining, take an umbrella)
Repeating behavior (e.g., while there are cookies on your plate, keeping eating cookies) usually called looping or iteration
Breaking things up into smaller pieces
Compute a result
Simple ideas, cont’d
Programming is just using these ideas in various combinations
Most computers understand only about 100 distinct instructions
The millions of programs that run on a computer use these instructions in different orders and combinations
Like chess in this way
Alice concepts
Concept: Virtual world
Video game or simulation implemented in 3D
2D vs. 3D
Virtual world, cont’d
Virtual worlds provide an environment that allow us to simulate the type of interactions with which we are familiar in the real world.
Concept: ObjectAn "object" is
any thing that can be identified as unique from other things
How is an object unique? has a name has properties:
width, height, color, location
can perform actions (methods):associated actions it can performtasks it can carry out
Object Parts
Objects may be composed of parts
3D models
In Alice, nearly all objects are represented by 3D models
These are the animals, people, cars, anvils, etc. that you add to a world
3D models are found in the Alice galleries
Alice is not a 3D graphics drawing program
With the exception of he-builder and she-builder we use pre-defined models
Concept: 3 Dimensions, 6 Directions
A 3D object has 3 dimensions
height, width, depth
6 degrees of freedom (directions of movement)
Concept: Center of an object
At the center of mass
Where it stands on the ground
Where it is held
Distance between objects is measured from their centers
An object’s position in the world is given by its center
ClassObjects are categorized into classes
Each object is an instance of the class.
All objects in a class have similar properties and generally can perform the same tasks.
Person
Dogs
peter
mary
paul
spike
scottie
fluffy
Appendix A: Exploring Alice
World 1:Open World…Week1AppendixA_FirstWorld.a2w
Play
Appendix A: exploring Alice
Notice the Object Tree contains all of the objects in the world.
The camera and the
light are in every
Alice word.
Object Parts: A closer look
Introduction to the "code"
Look at Hare in the Object treeExpand to find the hare's ears
Notice that the hare's left ear moves forward and back in this animation.
Let's modify this animation
Modifying code
Let's change the movement to go left and right instead of forward and backward.
PLAY
Modifying code
Let’s make the RIGHT ear move.
Modifying code
FinallyLet's change this one last time so that the RIGHT ear moves forward and back.
PLAY
Interactive World
Open New WorldOpen AppendixA_DancingBee.a2w
PlayPress Up-Arrow key
Press space bar
Two types of worlds
Movie Worldmovie runs from beginning to end
Interactive Worldyou choose how animation runs (events)
Creating your own world
File menuNew Worldgrass template
Save World As MyFirstTryNavigate to the appropriate folder
Creating your own world
Add Objects
Search Gallery allows you to choose objects
Click Folder
Objects
An "object" is any thing that can be identified as unique from other things
How is an object unique? has a name
has properties: width, height, color, location
can perform actions (methods):associated actions it can perform
tasks it can carry out
Galleries
Classes (3D models) are found in the galleries Local gallery (installed with the software)
Minimum or complete options
Web gallery
Choose Local Gallery
PeopleAddsnowMan (2 ways to add to world)
Drag snowman to world
Click and Add Instance to world
snowWoman
Controls
Click on snowman and experiment with controls.
Click on snowWoman and check "affectparts"
delete her hat.
Controls
Controls
Camera
Top
Side
Front
More controls
Moving the camerachanges the view of the world
Go slowly.
New worlds
Add all objects when you create the world.
Use mouse and camera controls to arrange objects at the scene.
Assignment
Read (before the next class session)
Chapter 1 Section 1, Introduction to Alice
Section 2, Alice Concepts
Tips & Techniques 1, Special Effects
Object-oriented programming and Alice
In designing modern software we work from an algorithm.
An algorithm is a plan for solving a problem by following a sequence of steps
To help manage the growing complexity of software, computer scientists introduced the concept of OOP some time ago
OOP
An object can be something in the physical world or just an abstract ideaAirplane (auto-pilot program)A bank transaction (ATM software)The code that manipulate the properties of an object are called the object’s methodsWe can think of an object as a collection of its properties and methodsThe values stored in the properties of an object are called collectively know as the object’s stateOOP algorithms define interactions between objectsAn OO program uses objects as tools to do its work
Exploring the Alice Interface
Alice is an example of an Integrated Development Environment (IDE)
An IDE is a computer program used to write other computer programs
The Alice IDE is often called the Alice interface
Welcome to Alice! dialog
Tutorials tab
Recent worlds tab
Examples tab
Open a world tab
Navigation
Folders
Files
Controls
Object Tree
Details Area
World WindowEvents Area
Editor Area
Object Tree
Details Area
Editor Area
Events Area
event trigger
event handler
event handler
event handler
World Window
Trashcan and Clipboard
Menus
In-class exercise 1
On the course web site under week 1