DOC PREVIEW
TRINITY CSCI 1311 - Arrays
Pages 10

This preview shows page 1-2-3 out of 10 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 10 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 10 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 10 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 10 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Slide 1Slide 2Slide 3Slide 4Slide 5Slide 6Slide 7Slide 8Slide 9Slide 10Arrays10/2/2009Opening Discussion●Do you have any questions about the quiz?●What is the purpose of loops? Lists?●Minute Essay comments–Fun – 15 (sudoku mentioned by name)–Spreadsheet – 5–Text and HTML– 4 each–Optimization – 2–Network and hacking – 1 each–How do they do 3-D graphics/sound?–How do viruses work?Midterm●The midterm is a week from today. We are going to have some review sessions. The extra credit is going to be a set of problems.Objectives●We have some new objectives for this week. The main objective is to get our city scenario working as a valid game.–Have the Lemur move on straight lines all the time. Turn when key is hit.–Have people not return to the same house and do random walks without diagonals when there isn't a house to go to.–Scoring is how many people the Lemur can eat in certain number of calls to update.Arrays●Lists are not the only way of storing multiple values. Arrays are often simpler.●Arrays have a different syntax and can't change size.●Square brackets indicate an array type.–int[] numbers;–String[] words;Making Arrays●Use new to make an array or “shortcut” syntax.–int[] numbers=new int[50];–int[] fewNumbers={34,19,22,21,20,18};●If the array hold primitives the values are 0 or false to start with.●If the array holds objects the values are null to start with.Using Arrays●Instead of calling get, use square brackets.●The following prints the values in an array.–for(int i=0; i<numbers.length; i++) {●System.out.println(numbers[i]);–}Direction Moves as Arrays●Instead of a bunch of if statements, we can use arrays to keep the move information in two arrays.–int[] xoff={0,1,0,-1};–int[] yoff={-1,0,1,0};Code●We want to use this technique for movement in both the Lemur and the Person.●Once we have that we can put in the code so people don't return to the same house.Minute Essay●What questions do you have about our topics


View Full Document

TRINITY CSCI 1311 - Arrays

Course: Csci 1311-
Pages: 10
Documents in this Course
Arrays

Arrays

12 pages

Applets

Applets

5 pages

Arrays

Arrays

8 pages

Methods

Methods

12 pages

Drawing

Drawing

8 pages

Load more
Download Arrays
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Arrays and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Arrays 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?