2 Pages

GameOfLife

Course: CSCI 208, Fall 2009
School: Adams State
Rating:
 
 
 
 
 

Word Count: 527

Document Preview

208 CSCI Assessment Programming Assignment Write a program that implements Conways game of life. The Game of life really isnt a game. It is a cellular automaton. The game is played on a grid. Think of gluing the sides of the grid together so that the squares on the right side are adjacent to squares on the left side. Also, think of gluing the top and bottom sides of the grid together so that squares on the top are...

Register Now

Unformatted Document Excerpt

Coursehero >> Colorado >> Adams State >> CSCI 208

Course Hero has millions of student submitted documents similar to the one
below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.

Course Hero has millions of student submitted documents similar to the one below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.
208 CSCI Assessment Programming Assignment Write a program that implements Conways game of life. The Game of life really isnt a game. It is a cellular automaton. The game is played on a grid. Think of gluing the sides of the grid together so that the squares on the right side are adjacent to squares on the left side. Also, think of gluing the top and bottom sides of the grid together so that squares on the top are adjacent to squares on the bottom. Thus, the grid is not flat, but lies on a torus (donut). When you think about the grid lying on a torus, each square has exactly 8 neighboring squares. Each square in the grid can be alive or dead. In the grid below, the living squares have an X in them. Square with 3 living neighbors X X Square with 8 neighbors X 1 2 3 8 4 7 6 5 X X X X X X Square with 2 living neighbors Square with 3 living neighbors Square with no living neighbors Square with 4 living neighbors X X X X X X Square with 1 living neighbor X X The game is played by applying the following rules on each iteration of the game: 1) If a square has exactly 3 living neighbors if becomes alive. If it is already alive it stays alive. 2) If a square has exactly 2 living neighbors it stays the way it was. That is, if it is dead it stays dead and if it is alive it stays alive. 3) For any other situation the square is set to dead Below is what the grid above will look like after one application of rules X the X X X X X X X X X X X X Programming Requirements The main class of your program should be called GameOfLife. It should provide a constructor taking a boolean argument indicating whether or not the game should provide a user interface. Your program should allow the user to click on a square to flip it from dead to living or living to dead. The main class should also provide the method void setAlive( int column, int row, boolean squareAlive ); to allow the state of a square to be set programmatically. The main class must also implement the method boolean isAlive( int column, int row ); to allow programmatic access to the state of a square. There should be a start button. When the user pushes the start button the program should apply the game rules to the grid at one-second intervals (use a timer) and display each new grid. The...

Find millions of documents on Course Hero - Study Guides, Lecture Notes, Reference Materials, Practice Exams and more. Course Hero has millions of course specific materials providing students with the best way to expand their education.

Below is a small sample set of documents:

Adams State - BUS - 362
Article Review "CEOs held to a High Ethical Standards" by Dick Doe Wall Street Journal February 28,2006Submitted to Professor Julie Campbell in Partial Fulfillment of the Requirements for Human Resource Management BUS 632by Jane Doe Adams State C
Alabama - CS - 325
Lecture 37 Today Building DLLs Project 6 due Friday at 9 pm Announcements Project 5 due tonight at 9 pm Exam #2 tomorrowSummer 2002 CS 325 Class NotesPage 1Building using components Components can mean different things Subprogram Clas
Alabama - CS - 325
Lecture 8 Today Inheritance/Strategy Project 2 discussionSpring 2001 CS 325 Class NotesPage 1Comments from last time Using inheritance with lists Singly-linked (forward-pointing) list Doubly-linked (forward & backward pointing) list Hav
Alabama - CS - 325
Lecture 8 Today Inheritance/Strategy Project 2 discussionSpring 2001 CS 325 Class NotesPage 1Comments from last time Using inheritance with lists Singly-linked (forward-pointing) list Doubly-linked (forward & backward pointing) list Hav
Alabama - CS - 325
Lecture 9 Today Inheritance Project 2 discussion Homework Look over project description by Friday! Understand code in each file. Project 2 due one week from todaySpring 2001 CS 325 Class NotesPage 1Templates and Inheritance Can use in
Alabama - CS - 325
Lecture 34 Today Exam 2 Survey Binary Components Project Questions Assignments Project Five is due tonight ( no late projects ) Announcements No class on Friday (Awards Day) I will be around my office most of that day if you need to stop b
Alabama - CS - 325
Lecture 13 Today Anonymous Class Surveys potential new teams The Visual C+ environmentVisual C+ environment Commercial development environment Editor, compiler, graphical interface, debugger, Comparison to other compilers pcGrasp designed
Alabama - CS - 325
Lecture 6 Today More with Inheritance Announcements Q/A Session Thursday night @ 7:00 EE 119 Project 1Spring 2002 CS 325 Class NotesPage 1Quiz 1) What is a pointer? 2) With the following declaration, assuming the Node class exists
Alabama - CS - 325
Lecture 6 Today InheritanceTutoring If you want to tutor: CTL Athletic Department CS 124 students Announcements COE accounts are ready <f i><li><last4digitsofssn> (userid and password) Example: lb3945 E-mail: lb3945@labs.eng.ua.edu If
Alabama - CS - 325
CS 325 - Class 34 Today, July 24, 2003 Finish exercise with DLLs How to fork a processClass Exercises The files needed to generate an MFC application using DLLs are out on the web DLL part Images.h Images.cpp Announcements Front End Pai
Alabama - EXAM - 325
Lecture 6 Today Iterators in IO Operators Templates and Inheritance Makefiles (how they work)Spring 2003 CS 325 Class NotesPage 1More with iterators Can use iterators to build output operators for a given data structure Don't need to know
Alabama - EXAM - 325
Lecture 7 Today Templates and Inheritance Makefiles (how they work) Reminder Project 1 grades Monday Project2 due Wed, ok, Friday Project 3 will be posted Next Week Simple GameSpring 2003 CS 325 Class Notes Page 1private, public w/ inheri
Adams State - CSCI - 210
StreamsChapter 12Accessing a Disk File Declare a file variable Input ifstream input_data#include <fstream> Output ofstream output_data Input and Output fstream inputOutput_data Open the fileThe open method does not take strings, but
Adams State - CSCI - 209
Lunar LanderFeatures:1) Make a drawing of a lunar landing using the Java2D shapes such as circles, lines, and rectangles. The lunar lander should also have a drawing of a flame that shoots out the bottom with the engines are fired. Keep the drawing
Alabama - CS - 325
Lecture 11 Thursday, July 13TodayFinish controls for the main window Displaying images in the main windowAnnouncements:Project Five is due next Monday (7/18) at 9:30pmQuick controls reviewControls:Are a child window of the main (parent) Prov
Alabama - CS - 325
Lecture 06 Tuesday, September 12TodayClient/server computing The server-side detailsAssignmentsProject Two is due Wednesday at 9:00pm Homework #6 is due Thursday at 9am Exam One is Thursday One page of notes (8.5 x 11 paper)Refresher from la
Alabama - CS - 470
Lecture Notes for CS470 Fall 2005 Part 9 (preliminary draft)Shortest Paths Dijkstras algorithms Imagine that we have a collection of cities and some pairs are connected by a direct road. For each road connecting two cities, say u and v, we have the
Adams State - CSCI - 209
Chapter Nineteen: Files and StreamsFile Constants Handle file and directory names in a platform-dependent way Directory Separatorspublic static final char separatorChar public static final String separator Separates file or directory names in
Adams State - CSCI - 200
11 Boolean Algebra11.3 Logic GatesBasic Types of Gatesxxx Inverter y OR Gate x x+yyxyAND GateProblem 3 Find the output of the given circuitxyzxProblem 6 Construct circuits from inverters, AND gates, and OR gates to produce t
UC Davis - CS - 154
Combinational Logic IVProgrammable Logic DevicesInstructor: Koling Chang email: kchang@cs.ucdavis.eduOutlineProgrammable Logic Device (PLD) ROM PROM/EPROM Programmable Logic Arrays (PLA) Programmable Array of Logic (PAL) Complex PLD (CPLD
Air Force Academy - XUG - 991
This article was downloaded by:[Wunderle, A. L.] On: 22 September 2007 Access Details: [subscription number 782246666] Publisher: Taylor & Francis Informa Ltd Registered in England and Wales Registered Number: 1072954 Registered office: Mortimer Hous
Virginia Tech - AE - 004003
NASA/TM-2000-210333Transverse Magnetic Field Propellant IsolatorJohn E. Foster Glenn Research Center, Cleveland, OhioAugust 2000The NASA STI Program Office . . . in Profile Since its founding, NASA has been dedicated to the advancement of aero
Virginia Tech - AE - 004003
NASA/TM2002-211728IECEC200220038A Systems Model for Power Technology AssessmentDavid J. Hoffman Glenn Research Center, Cleveland, OhioJuly 2002The NASA STI Program Office . . . in Profile Since its founding, NASA has been dedicated to the ad
Virginia Tech - AE - 004003
NASA/TM2000-209635Unsteady Cascade Aerodynamic Response Using a Multiphysics Simulation CodeC. Lawrence Glenn Research Center, Cleveland, Ohio E. Spyropoulos ANSYS, Inc., Sunnyvale, California T.S.R. Reddy Univeristy of Toledo, Toledo, OhioJanua
Virginia Tech - AE - 004003
NASA/TM2000-210526Vibration Testing of an Operating Stirling ConvertorWilliam O. Hughes, Mark E. McNelis, and Thomas W. Goodnight Glenn Research Center, Cleveland, OhioNovember 2000The NASA STI Program Office . . . in Profile Since its foundin
TAMU Commerce - FACULTY - 566
ECE 566 Early Childhood EnvironmentsCourse Description: Develops a process of designing appropriate learning environments for young children. Investigates the relationship between curriculum and design through the exploration of organization, man
TAMU Commerce - FACULTY - 690
Hall, N., Larson, J., & Marsh, J. (2003). Handbook of early childhood literacy. London: Sage Publications. Prepare a reading guide for your appointed section of this text. Plan a 20 30 minute exploration of your section for Thursday, April 4. Sectio
TAMU Commerce - FACULTY - 364
ECE 364 Theories Influencing Child Development Rubric: Philosophy of Education5. Philosophy of education: Develop a philosophy of education. The philosophy must be well written (cite more than three resources), grounded in the historical tradition (
Alabama - PH - 106
UNIVERSITY OF ALABAMA Department of Physics and Astronomy PH 106-4 / LeClair Fall 2008Sample Exam 1 Questions1. A charge of 100 C is at the center of a cube of side 0.8 m. What is the ux through one face of the cube? 1.9 106 N m2 /C 3.7 104 N
Alabama - PH - 102
Cheat SheetConstants: ke0Magnetic elds & forces: |FB | |FB |9 2 2= = = = = =q|v|B| sin vB BIl sin wirecharge q= = = = = =8.98755 10 N m C 8.85 1012| | B B |F12 | lBIAN sin torque current loopC /N m1922e 0 c me mp
Alabama - PH - 102
NameDatePH 102 Final ExamGeneral Rules: You are allowed 2-8.5x11 in sheets of paper for formulas and a calculator.December 10, 2007 P. LeClairPart I: Multiple choice (50%) 1. Answer 16 of the 20 multiple choice problems. 2. No partial credit
Shepherd - ENG - 102
Name: ENG 102 Brief Critical Review Content (35 points) Essay fulfills the requirements of the assignment-it analyzes a critical source and evaluates its argument The essay includes a summary of the critic's argument that is between 1 and 1.5 pages
Alabama - PH - 125
Numbers & units: g = 9.81 m/s2 6Rotation: we use radians Me = 5.96 10 earth24kg earth11s = r2 2 arclength = d dt radialRe = 6.37 10 mG = 6.67 10N m /kgd v = = dt r at = rMath: b2 4ac 2a 1 1 sin sin = 2 sin ( ) cos ( )
Alabama - PH - 125
UNIVERSITY OF ALABAMA Department of Physics and Astronomy PH 125 / LeClair February 18, 2009Quiz 7 Solution1 1. A particle of mass m = 2 kg experiences a spatially varying potential energy U (x) = 2 + x2 , where x x is in meters and U is in Joules
Alabama - PH - 125
NAME & ID UNIVERSITY OF ALABAMA Department of Physics and Astronomy PH 125 / LeClair January 19, 2009Quiz 3: What goes up must come downInstructions: 1. Answer both questions below. Both have equal weight. 2. Express your answer with the appropria
Alabama - PH - 125
Name & IDPH125 Exam IIIInstructions1. Solve 5 of 8 problems below. All problems have equal weight. 2. Show your work for full credit. Significant partial credit will be given. 3. You are allowed 2 sides of an 8.5 x 11 in piece of paper with notes
Alabama - PH - 125
NAME & ID UNIVERSITY OF ALABAMA Department of Physics and Astronomy PH 125 / LeClair February 7, 2009Quiz 6Instructions: 1. Answer both questions below. Both have equal weight. 2. Express your answer with the appropriate units and signicant digits
Alabama - PH - 125
UNIVERSITY OF ALABAMA Department of Physics and Astronomy PH 125 / LeClair Spring 2009Problem Set 4Instructions: 1. Answer all questions below. Follow the problem-solving template provided. 2. Some problems have different due dates! 3. You may col
Alabama - PH - 125
PH 125 Quiz Solution1. Two pulses move in opposite directions on a string and are identical in shape except that one has positive displacements of the elements of the string and the other has negative displacements. At the moment that the two pulses
Alabama - PH - 125
NAME & ID UNIVERSITY OF ALABAMA Department of Physics and Astronomy PH 125 / LeClair January 15, 2009Quiz 2: Vector MadnessInstructions: 1. Answer both questions below. Both have equal weight. 2. Express your answer with the appropriate units and
Alabama - ECE - 493
Application Specific Instructions Bit Shift Instructions Allows for basic shift and rotate operationsProgrammable Logic ControllersApplication Specific Instructions Bit Shift Left (BSL) Bit Shift Right (BSR) Sequencer Instructions Useful f
Alabama - ECE - 493
Programmable Logic ControllersI/O Module TypesElectrical & Computer EngineeringDr. D. J. Jackson Lecture 11-1Basic Module Types Digital (discrete) output modules Optical isolation provided Relay, transistor or triac based Transistor-based
Alabama - ECE - 480
Using a D flip-flop packageLIBRARY ieee ; USE ieee.std_logic_1164.all ; LIBRARY altera ; USE altera.maxplus2.all ;The dff component is only one of several built-in components for storage elements.: IN STD_LOGIC ; : IN STD_LOGIC ; : OUT STD_LOGIC
Alabama - ECE - 482
Image segmentation Segmentation divides an image into its constituent parts or objects Level of subdivision depends on the problem being solved Segmentation stops when objects of interest in an application have been isolated Example: For an air-
Alabama - CS - 150
CS 150Recursion Activity SheetSpring 2009I NTRODUCTIONIn this activity, you are to practice writing recursive functions.R ECURRENCESRecall the factorial function: def fact(n): if n = 1: return 1 else: return n * fact(n - 1) A mathematical w
Alabama - CS - 150
ListsName:E-mail:Section:You can see what kind of thing something is by using thefunction.True or False: In Python, you can store different kinds of items in the same data structure (a data structure is just a collection of items). A coll
Shepherd - ECON - 206
PROBLEM SET 6 Problems for Chapters 10 and 11 1. a. Explain the meaning of a "kinked demand curve" and under what circumstances a firm operating in an oligopoly would have one. b. On the graph below draw a case in which marginal cost changes, but a f
Alabama - CS - 385
CS385 1. formats 2. ClearContents 3. quotes 4. variant 5. EntireColumn.AutoFit 6. underscore 7. Input box 8. message box 9. if 10. overflow 11. FormatNumber 12. FormatCurrency 13. Zero or 0Quiz #2 KeyJanuary 29, 200814. Range("A1 ").Font.Bold =
Alabama - CS - 385
CS385 1. Trapping 2. On Error 3. Branch 4. Err.Number 5. branch 6. On Error 7. Resume 8. Raise 9. Object 10. Runtime 11. Properties 12. Event 13. Text box 14. Label 15. List box 16. Command button 17. frm 18. End 19. SetFocus 20. InitializeQuiz 10
Alabama - CS - 385
CS385 1. Message 2. Concatenation 3. G or George 4. LCase 5. orge 6. 3 7. @ or # 8. ! 9. Len 10. 65 11. CInt, CByte, CStr, or Val 12. 20 13. 12 14. Ubound(Array1) 15. Lbound(Array1) 16. Row 17. Call Analysis(Numbers) 18. (Numbers() As Integer) 19. Co
Alabama - CS - 385
CS 385 Instructor: Office: Office Hours: Text: Prerequisites: or CS313PROGRAMMING IN A VISUAL ENVIRONMENT Dr. Jim Prater 202B Houser Hall Monday-Wednesday: 1:00-3:00 Tuesday-Thursday: 10:00-12:00SPRING 2004Phone: 348-0617 E-Mail: jprater@cs.ua.
Alabama - CS - 385
CS385 1 Call 2 Function 3 5 4 Nesting 5 100 6 solid square 7 11 8 Function 9 BooleanQuiz #3 KeyFebruary 12, 200810 Below the Average 11 Object or 400 12 Private 13 Variant 14 Two or 2 15 Invocation or call 16 100 17 20 and 100 18 Round or Int 1
Alabama - CS - 385
CS 385 Instructor: Office: Office Hours: Text:PROGRAMMING IN A VISUAL ENVIRONMENT Dr. Jim Prater 202 Houser Hall TBASummer 2006Phone: 348-0617 E-Mail: jprater@cs.ua.eduVBA for Modelers Developing Decision Support Systems with Microsoft Excel
Shepherd - SUENG - 101
ENG 101-Baker Argument Assignment 15% Course Grade-1000 Words-Due December 8th by NOON, to my mailbox (2nd floor Knutti) Background / Context: Although 27 states have passed legislation adopting English as their official language and resolutions have
Alabama - ME - 416
SYLLABUS ME416/516EnergyConservationandManagementSpring2008 ClassMeetings: Text: Instructor: Prerequisites: Grading: 2Quizzes20%each EnergySystemDesign Homework FinalExam TechnicalPaper TentativeSchedule*Week 2 3 4 5 6 7 8 9 10 11 12
Alabama - ME - 416
ME416InClassExerciseBillingrates Giventhefollowingresidentialbillinghistory(AlabamaPowerCoFD): Mon-Yr kWh amt Dec-07 1557 $150.76 Jan-08 2282 $226.90 Feb-08 217 $32.44 Mar-08 270 $37.94 Apr-08 1942 $196.33 May-08 1557 $161.28 Jun-08 2180 $248.03 Ju
Alabama - ME - 416
Alabama - ME - 416
Alabama - ME - 577
LTI Form of State EquationsStability - 2-& x(t ) = A x(t ) + Bu (t ) y (t ) = C x(t ) + Du (t )Linear, time invariant state & output equations Initial conditionsx(0 ) = x0Jordan Form for Repeated Eigenvalues Energy-based Methods Lyapunov F
Alabama - ME - 577
Stability Classical Control Systems (i.e., Transfer Functions)In order for a system to be stable (_ _) All poles of the transfer function must have _Negative real roots+ Imaginary- Real-r2-r1+ RealRecall that poles of the transfer func
Alabama - ME - 577
Concept of StateThe state of a dynamic system at time t 0 is the complete set of knowledge or information that is required to uniquely determine the output of theChapter 1 - Introductionsystem,y [ t 0 , )given the input to the system,u[ t