CS152, Fall 2020
Computer Programming Fundamentals
Home
Schedule
Syllabus
Style Guidelines
Assignment 8: Cellular Automata in Java
Due: Monday 11/9 by 9:30am
Description
Create two 2D Cellular Automata. 1) The famous Game of Life. You can find a description along with a nice history here. This posting also includes several known formations that you can use to
make sure your code is working as intended. We will work through coding this in class, so if you come to lecture, this part of the assignment should be easy. 2) An original Cellular Automaton (CA) that you create. You can choose your own states and rules. This CA should be significantly different from the Game of Life. That is, don't just make a trivial change to the Game of Life rule to fulfill this requirement. Your CA should exhibit some interesting emergent behavior. Once you've written the code, you should spend some time playing with both of the different systems to discover interesting patterns and behavior. Along with your code, you will turn in screenshots that document at least two noteworthy patterns or behaviors you have observed in each Cellular Automaton.
The sample code in Assignment8.java, along with the examples we work through in class should give you the tools you need to complete this assignment. Your program must be based on the sample code. You may be tempted to copy and paste some Game of Life or other Cellular Automata code you find on the internet. Just don't do this. Reach out for help instead!
Here is a screen shot showing the Game of Life. Purple cells are "alive" and white cells are "dead". You can also see and experiment with an animated version here.
Requirements
Your project should include all of the elements below.
- Your program should include a method that computes the Game of Life rules.
- Your program should include a method that computes the rules for the CA you develop.
- I should be able to change one line of code in your program to change which CA is shown on the screen.
- You should write code in the paint method that displays the CA on the screen.
- The program should generate an animation of the CA running. The animation should show each execution of the CA rule.
- Include the appropriate source code header, which is included in the sample code.
- Carefully read and follow the course Style Guidelines.
- Extra credit (5 points): Create a 3rd CA that models the spread of the coronavirus. You should include a 3rd method in your code that computes these coronavirus rules. Here is a blog post that might help you get
started. Try building something like the examples under Simulation Version 2. Don't worry about simulating people moving around at first, just see if you can model disease spread with stationary "people". Then, try running your simulation with different numbers of sick people distributed through the grid. You may also want to experiment with slightly different rules, or parameters for your rules. Note: this is hard. Get the core assignment done before you attempt it!
What to Hand in:
- Your .java program file.
- A collection of screen shot images. You should document at least two noteworthy patterns from each CA: the Game of Life, and your own Cellular Automaton. The images you upload should clearly communicate these patterns.
- A paragraph about your project. Submit a paragraph about your program, focusing on the Cellular Automaton you designed. Include links and citations for any materials you used to design and code your CA. Include descriptions of the patterns you identified and the images you've uploaded to document them. Include a brief discussion about your experience working on this assignment. What challenges did you encounter? How did you address them? What did you learn?
- Extra credit: In addition to implementing the coronavirus CA, you should write an additional paragraph that describes this CA,
how you created it, and what you learned through this process.