Presentation is loading. Please wait.

Presentation is loading. Please wait.

Computer Science 1 Week 14. CSc 1, Sacramento State This Week... QBasic Arrays QBasic Arrays Computer History Computer History  Computer revolution 

Similar presentations


Presentation on theme: "Computer Science 1 Week 14. CSc 1, Sacramento State This Week... QBasic Arrays QBasic Arrays Computer History Computer History  Computer revolution "— Presentation transcript:

1 Computer Science 1 Week 14

2 CSc 1, Sacramento State This Week... QBasic Arrays QBasic Arrays Computer History Computer History  Computer revolution  Video games

3 CSc 1, Sacramento State

4 QBasic Arrays Storing data in a list

5 CSc 1, Sacramento State QBasic Variables Review a variable is a location in memory a variable is a location in memory  it can store a single piece of data  e.g. string or a number Think of it as a box Think of it as a box  information can be placed in it ... and removed when necessary

6 CSc 1, Sacramento State 95 b a Variable Review a = 100 b = 95 100

7 CSc 1, Sacramento State b Variable Review a = 100 b = 95 95 100 a

8 CSc 1, Sacramento State Variable Review a = 100 b = 95 95 b 100 a

9 CSc 1, Sacramento State What is an Array? An array is a group of variables that has multiple locations An array is a group of variables that has multiple locations Each array element has a location in memory Each array element has a location in memory  contain a different piece of data  referenced with a unique number ... this is called a subscript (a.k.a. index)

10 CSc 1, Sacramento State What is an Array? Think of an array as a set of mailboxes (CSCMailBoxes) Think of an array as a set of mailboxes (CSCMailBoxes) Each mailbox belongs to the same array (CSCMailBoxes) Each mailbox belongs to the same array (CSCMailBoxes) Each mailbox has a unique location (index) Each mailbox has a unique location (index)

11 CSc 1, Sacramento State What is an Array?... or think of an array as a group of boxes... or think of an array as a group of boxes Each box belongs to the same array Each box belongs to the same array Each box has a unique location (index) Each box has a unique location (index)

12 CSc 1, Sacramento State Example Array Name is "Project" Name is "Project" There are 3 elements There are 3 elements  subscripts are 1, 2, and 3  each belongs to the same array 1 2 Project 3

13 CSc 1, Sacramento State Dim Statement Used to dimensionalize a variable Used to dimensionalize a variable  can create multiple elements for an array  can also create multiple elements for an array  you will use it to create arrays Must be done before using the array Must be done before using the array  QBasic needs to create the array elements before you attempt to use them

14 CSc 1, Sacramento State DIM Name (First TO Last) Dim Statement Syntax Variable Name First Subscript Last Subscript

15 CSc 1, Sacramento State DIM Name ( First TO Last ) AS STRING Dim Statement Syntax Variable Name index Type of Data

16 CSc 1, Sacramento State Array Declarations DIM a(1 TO 3) 1 2 a 3 Array Name Array Index

17 CSc 1, Sacramento State Array declaration for CSCMailBoxes DIM CSCMB(1 TO 5, 1 TO 4) Array Name Array Index

18 CSc 1, Sacramento State Array declaration for stack of boxes DIM Boxes(1 TO 5) Array Name Array Index

19 CSc 1, Sacramento State Name (subscript) How You Access an Array Element Variable Name The "box" number

20 CSc 1, Sacramento State CSCMB(2,3) How You Access a Mailbox in CSCMB Array Name The “mailbox" number

21 CSc 1, Sacramento State Boxes(4) How You Access a Box in Dolly Array Name The “box" number

22 CSc 1, Sacramento State SacState Total_Cost Test(4) Name(2) Example Variables Normal variables Array variables

23 CSc 1, Sacramento State DIM Test(1 TO 2) LET Test(1) = 75 LET Test(2) = 95 PRINT Test(1); Test(2) Array Example

24 CSc 1, Sacramento State Array Example – What Happens? DIM Test(1 TO 2) Test(1) = 75 Test(2) = 95 1 2 Test

25 CSc 1, Sacramento State 1 2 Test 75 Array Example – What Happens? DIM Test(1 TO 2) Test(1) = 75 Test(2) = 95

26 CSc 1, Sacramento State 75 1 2 Test 95 Array Example – What Happens? DIM Test(1 TO 2) Test(1) = 75 Test(2) = 95

27 CSc 1, Sacramento State Array Example – What Happens? DIM Test(1 TO 2) Test(1) = 75 Test(2) = 95 75 1 95 2 Test

28 CSc 1, Sacramento State DIM Test(1 TO 2) Test(1) = 75 Test(2) = 95 PRINT Test(1); Test(2) Array Example

29 CSc 1, Sacramento State 75 95 Array Example 1 Output

30 CSc 1, Sacramento State DIM Score(1 TO 3) FOR n = 1 TO 3 INPUT "Test: "; Score(n) NEXT PRINT "Second test is"; Score(2) Array Example 2 Subscript can be a variable

31 CSc 1, Sacramento State Test: 74 Test: 65 Test: 49 Second test is 65 Array Example 2 Output

32 CSc 1, Sacramento State DIM Greek(1 TO 4) AS STRING LET Greek(1) = "Tappa Kegga Bru" LET Greek(2) = "Cuppa Kappa Chino" LET Greek(3) = "Hu Delta Phart" LET Greek(4) = "Eta Lotta Pi" FOR n = 1 TO 4 PRINT n, Greek(n) NEXT Variable

33 CSc 1, Sacramento State 1 Tappa Kegga Bru 2 Cuppa Kappa Chino 3 Hu Delta Phart 4 Eta Lotta Pi Array Example 3 Output

34 CSc 1, Sacramento State LET Score(1) = 85 LET Score(2) = 98 LET Score(3) = 61 FOR n = 1 TO 3 IF Score(n) >= 70 THEN PRINT Score(n) ; "passes" ELSE PRINT Score(n) ; "fails" END IF NEXT

35 CSc 1, Sacramento State 85 passes 98 passes 61 fails Array Example 4 Output

36 QBasic Lab Arrays – Hokey Pokey Dance-a-rama

37 CSc 1, Sacramento State Lab: Hokey-Pokey Dance-a-rama Overview: Overview:  you are involved with a dance contest  sadly, it is the Hokey Pokey  your program processes input scores  determine who qualifies Objectives: Objectives:  use QBasic arrays

38 CSc 1, Sacramento State Remember... Turn your program & your output Turn your program & your output  to Lab12 in SacCT You must do your own work You must do your own work If you do not turn in your program, you will not get credit! If you do not turn in your program, you will not get credit!

39 CSc 1, Sacramento State

40 Video Game History The History of Fun

41 CSc 1, Sacramento State Tennis for Two First computer game ever! First computer game ever! Created in 1958 Created in 1958  invented by William Higinbotham  show visitors to the Brookhaven National Laboratory  not well known publicly until 1981 Technology Technology  used an analog oscilloscope  players used controllers which used transistors

42 CSc 1, Sacramento State

43 SpaceWar! First digital computer game First digital computer game Finished in 1962 Finished in 1962  invented by Steve Russell at MIT  space battle simulation between two ships Technology Technology  used an PDP-1 mainframe  ships controlled using switches on the mainframe Revolutionary new idea: computers can be fun! Revolutionary new idea: computers can be fun!

44 CSc 1, Sacramento State SpaceWar! Game play Game play  ships can fire missiles, turn, thrust, and randomly warp to a new location  center screen has a star with large gravity well  die if hit with a missile or collide with the star Other features Other features  the background stars are accurate!  specialized controllers were built

45 CSc 1, Sacramento State Spacewar!

46 CSc 1, Sacramento State Magnavox Odyssey Released 1972 Released 1972 First video game console First video game console Though, it is not a computer Though, it is not a computer  analog with some digital components  does not contain a processor

47 CSc 1, Sacramento State Magnavox Odyssey Features Features  had "overlays" for your T.V. screen  had a light gun Used "cards" for games Used "cards" for games  these turned features on/off  but, these were variations of the same game  as a result, limited to original architecture

48 CSc 1, Sacramento State Controllers Cards

49 CSc 1, Sacramento State

50 Pong Created in 1972 Created in 1972 Based on ping-pong (table tennis) Based on ping-pong (table tennis) First used in a tavern in Sunnyvale, CA First used in a tavern in Sunnyvale, CA  next day, there was a line to play the game  the game had broken the night before – too many quarters jammed the machine!

51 CSc 1, Sacramento State

52

53 Pong Runaway success Runaway success  new form of entertainment  T.V. versions sold incredibly well  beginning of the arcade game era Hundreds of "pong" games appeared Hundreds of "pong" games appeared

54 CSc 1, Sacramento State

55

56

57 Pac-Man Released in 1980 Released in 1980 Originally called "Puck-Man" Originally called "Puck-Man"  name change to avoid obvious vandalism  still called by its original name in Japan Features Features  had vibrant colors – quite new then  it was something different than pong!

58 CSc 1, Sacramento State Pac-Man Huge cultural hit Huge cultural hit  music, cartoons, furniture, clothing, food, etc...  the phenomena was called Pacmania  video games were now part of U.S. culture Result: Result:  game consoles sales jumped  tons of video games were created

59 CSc 1, Sacramento State Pac-Man

60 CSc 1, Sacramento State

61 Atari 2600 Released in 1977 Released in 1977 Designed to be a universal game system Designed to be a universal game system  over 100 million spent in development!  used the 6502 microprocessor from MOS technology  games were put on cartridges  several input devices – joystick, paddle

62 CSc 1, Sacramento State Atari 2600 Features Features  128 bytes of RAM  no video memory - too expensive Huge success Huge success  over 900 games created  produced until 1992 – 15 years!  "Atari" became synonymous with games

63 CSc 1, Sacramento State

64 Combat

65 CSc 1, Sacramento State Pac-Man

66 CSc 1, Sacramento State Break-Out

67 CSc 1, Sacramento State Freeway

68 CSc 1, Sacramento State River Raid

69 CSc 1, Sacramento State Atlantis

70 CSc 1, Sacramento State

71 Windows vs. Macintosh A Tale of Two Operating Systems

72 CSc 1, Sacramento State The Apple Coup Power struggle within Apple Power struggle within Apple  Jobs was known as hot-tempered and erratic  executives strip Jobs of all power  same time the Macintosh is released Jobs forced out of Apple Jobs forced out of Apple  he founds NeXT computers  Apple is now without its major visionary

73 CSc 1, Sacramento State The 1990’s and the Decline of Apple Apple Apple  continued to create better Macs  but, continued to lose market share Microsoft Microsoft  continued to enhance the PC's OS  developing better version of Windows  released Windows 95 in 1995

74 CSc 1, Sacramento State Rebirth of Apple Steve Jobs returned to Apple in 1997 Steve Jobs returned to Apple in 1997  began work on saving the company  stopped doomed projects Apple develops the iMac Apple develops the iMac  embraces the USB port  embraces the PC hard drive

75 CSc 1, Sacramento State Doomed Project: Apple eMate Laptop designed for kids Laptop designed for kids It was basically a PDA It was basically a PDA  black and white display  used a pen  used handheld software  … but had a full keyboard Cost $ 599 Cost $ 599

76 CSc 1, Sacramento State A Shift in Apple The Intel Macintosh The Intel Macintosh  this Macintosh uses the Intel processor  prior Macs used the PowerPC  it is, basically, a "PC-compatible" You can now run Windows on it You can now run Windows on it

77 CSc 1, Sacramento State The Future of Apple What Apple offers now What Apple offers now  iPad  iPhone  iPod  iMac  MacBook  Mac Pro  iTunes You can count on innovation from Apple You can count on innovation from Apple

78 CSc 1, Sacramento State

79 Modern Times Computer History

80 CSc 1, Sacramento State Measuring Platform Popularity Market Share Market Share  number of computers sold each year  measures the popularity at a moment Installed Base Installed Base  number of computers in use  difficult to measure

81 CSc 1, Sacramento State Measuring Platform Popularity Internet Market Share Internet Market Share  measures the computers on the Internet  assumes that all computer users use the Internet about the same  gives a somewhat accurate picture of the Installed Base

82 CSc 1, Sacramento State Internet Market Share March 2009 4.0%2.2%Linux 5.9%1.8%Macintosh 89.7%93.2%Windows March '08 March '03 Other2.8%0.4%

83 CSc 1, Sacramento State

84 Internet Market Share March 2011 5.1%4.0%Linux 8.0%5.9%Macintosh 85.8%89.7%Windows March ‘11 March '08 Other0.4%1.1%

85 Platform Market Share March 2011 http://www.w3schools.com/browsers/browsers_os.asp

86 CSc 1, Sacramento State Platform Wars: UNIX vs. Windows Windows family Windows family UNIX family UNIX family  Redhat Linux  Mac-OS X  etc....


Download ppt "Computer Science 1 Week 14. CSc 1, Sacramento State This Week... QBasic Arrays QBasic Arrays Computer History Computer History  Computer revolution "

Similar presentations


Ads by Google