1 / 9

Data Representation and Manipulation in Computing

Learn about representing and manipulating data using lists and arrays. Explore concepts such as two-dimensional arrays, referencing elements, and calculating averages. Implement Tic Tac Toe game logic and explore advanced tasks like identifying ties and duplicating sprites.

josephinem
Download Presentation

Data Representation and Manipulation in Computing

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CSC 170 Computing: Science and Creativity Big IDEAs: Data and Information, Algorithms, PROGRAMMINGLIST OF LISTS Institute for Personal Robots in Education (IPRE)‏

  2. Data in rows and columns • Data is sometimes conveniently viewed as rows and columns Test# 1 2 3 4 a 82 73 67 81 b 99 86 72 87 c 100 91 83 92 d 72 76 52 78 e 54 43 0 0 f 86 85 84 83

  3. Declaring Two-Dimensional Arrays • Data like this can be represented by a list of lists • the 1st list represents student a’s four test scores • Section1 is list of 6 lists of student’s tests

  4. Referencing individual elements • Reference to 1 item in a list of lists requires two item ? of’s • This is the “upper left”, the first item in the first list of lists • This is the “lower right”, the last item in the last list of lists

  5. Show TEST average for each student • Outer loop shows each student’s test average • Inner loop sums all tests See ListOfLIsts.xml

  6. MODEL a Tic tac TOE board • Three lists representing a row of 3 blanks, Xs, or Os.

  7. LAB TODAY: Task 1 • 1) Implement has ? won to return true of X or O has won

  8. LAB TODAY: Task 2 • 2) Implement ends with a tie when all 9 items are either X or O and X has not won and O has not won

  9. LAB TODAY: Task 3 • 3) Duplicate Sprite 1 7 times and make the appropriate changes • Change the argument to contains • Add sprite number to selected squares • Change the replace item and item of arguments 1 2 3 4 5 6 7 8 9

More Related