introduction to csci 1

56
Introduction to CSCI 1

Upload: zazu

Post on 06-Jan-2016

20 views

Category:

Documents


0 download

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 Presentation

TRANSCRIPT

Page 1: Introduction to CSCI 1

Introduction to CSCI 1

Page 2: Introduction to CSCI 1

How this class will workhttp://users.drew.edu/sbradsha/CSCI1-Spring2007/

Page 3: Introduction to CSCI 1

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)

Page 4: Introduction to CSCI 1

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

Page 5: Introduction to CSCI 1

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

Page 6: Introduction to CSCI 1

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

Page 7: Introduction to CSCI 1

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

Page 8: Introduction to CSCI 1

Alice concepts

Page 9: Introduction to CSCI 1

Concept: Virtual world

Video game or simulation implemented in 3D

2D vs. 3D

Page 10: Introduction to CSCI 1

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.

Page 11: Introduction to CSCI 1

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

Page 12: Introduction to CSCI 1

Object Parts

Objects may be composed of parts

Page 13: Introduction to CSCI 1

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

Page 14: Introduction to CSCI 1

Concept: 3 Dimensions, 6 Directions

A 3D object has 3 dimensions

height, width, depth

6 degrees of freedom (directions of movement)

Page 15: Introduction to CSCI 1

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

Page 16: Introduction to CSCI 1

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

Page 17: Introduction to CSCI 1

Appendix A: Exploring Alice

World 1:Open World…Week1AppendixA_FirstWorld.a2w

Play

Page 18: Introduction to CSCI 1

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.

Page 19: Introduction to CSCI 1

Object Parts: A closer look

Page 20: Introduction to CSCI 1

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

Page 21: Introduction to CSCI 1

Modifying code

Let's change the movement to go left and right instead of forward and backward.

PLAY

Page 22: Introduction to CSCI 1

Modifying code

Let’s make the RIGHT ear move.

Page 23: Introduction to CSCI 1

Modifying code

FinallyLet's change this one last time so that the RIGHT ear moves forward and back.

PLAY

Page 24: Introduction to CSCI 1

Interactive World

Open New WorldOpen AppendixA_DancingBee.a2w

PlayPress Up-Arrow key

Press space bar

Page 25: Introduction to CSCI 1

Two types of worlds

Movie Worldmovie runs from beginning to end

Interactive Worldyou choose how animation runs (events)

Page 26: Introduction to CSCI 1

Creating your own world

File menuNew Worldgrass template

Save World As MyFirstTryNavigate to the appropriate folder

Page 27: Introduction to CSCI 1

Creating your own world

Add Objects

Search Gallery allows you to choose objects

Click Folder

Page 28: Introduction to CSCI 1

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

Page 29: Introduction to CSCI 1

Galleries

Classes (3D models) are found in the galleries Local gallery (installed with the software)

Minimum or complete options

Web gallery

Page 30: Introduction to CSCI 1

Choose Local Gallery

PeopleAddsnowMan (2 ways to add to world)

Drag snowman to world

Click and Add Instance to world

snowWoman

Page 31: Introduction to CSCI 1

Controls

Click on snowman and experiment with controls.

Click on snowWoman and check "affectparts"

delete her hat.

Page 32: Introduction to CSCI 1

Controls

Page 33: Introduction to CSCI 1

Controls

Camera

Top

Side

Front

Page 34: Introduction to CSCI 1

More controls

Moving the camerachanges the view of the world

Go slowly.

Page 35: Introduction to CSCI 1

New worlds

Add all objects when you create the world.

Use mouse and camera controls to arrange objects at the scene.

Page 36: Introduction to CSCI 1

Assignment

Read (before the next class session)

Chapter 1 Section 1, Introduction to Alice

Section 2, Alice Concepts

Tips & Techniques 1, Special Effects

Page 37: Introduction to CSCI 1

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

Page 38: Introduction to CSCI 1

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

Page 39: Introduction to CSCI 1

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

Page 40: Introduction to CSCI 1

Welcome to Alice! dialog

Page 41: Introduction to CSCI 1

Tutorials tab

Page 42: Introduction to CSCI 1

Recent worlds tab

Page 43: Introduction to CSCI 1

Examples tab

Page 44: Introduction to CSCI 1

Open a world tab

Navigation

Folders

Files

Controls

Page 45: Introduction to CSCI 1

Object Tree

Details Area

World WindowEvents Area

Editor Area

Page 46: Introduction to CSCI 1

Object Tree

Page 47: Introduction to CSCI 1

Details Area

Page 48: Introduction to CSCI 1

Editor Area

Page 49: Introduction to CSCI 1

Events Area

Page 50: Introduction to CSCI 1

event trigger

event handler

event handler

event handler

Page 51: Introduction to CSCI 1

World Window

Page 52: Introduction to CSCI 1
Page 53: Introduction to CSCI 1
Page 54: Introduction to CSCI 1

Trashcan and Clipboard

Page 55: Introduction to CSCI 1

Menus

Page 56: Introduction to CSCI 1

In-class exercise 1

On the course web site under week 1