CS 371p: Object-Oriented Programming



Project #5: Life


  • Due: Wed, 2 Dec, 11:59 pm
  • Write a program, ideally with a partner, to solve Life [C++23 (g++ 14.2.0, 2 sec, 512 MB, source 50 KB)].
  • You may not use new, delete, malloc() or free().
  • You may use the STL.
  • Inheritance is not needed for this project.

Specification


  • Write a program, ideally with a partner, to solve Life [C++23 (g++ 14.2.0, 2 sec, 512 MB, source 50 KB)]
  • Life is a simple simulation of cell automata.
  • Life contains a two-dimensional grid of cells. A cell can only be in one of two states: alive or dead. There are two kinds of cells: ConwayCells and FredkinCells.
  • Once the grid is manually populated with live and/or dead cells, the grid represents the 0th generation of Life. After that, everything is automatic, and Life evolves from the 1st to the Nth generation. A generation is simply the state of the grid (i.e. the layout of the live and dead cells).
  • Live ConwayCells are denoted with an asterisk, "*", and dead cells are denoted with a period, ".". A ConwayCell has 8 neighbors, if it's an interior cell, 5 neighbors, if it's an edge cell, and 3 neighbors, if it's a corner cell. The example below is of 1 ConwayCell that is alive surrounded by 8 ConwayCells that are dead:
    ...
    .*.
    ...
			
  • ConwayCells do not have the notion of age, FredkinCells do. A FredkinCell's age is initially zero and only increments by one if the cell is alive and stays alive. Its age never goes down.
  • Live FredkinCells are denoted with their age, if their age is less than 10, otherwise denoted with a plus, "+", and dead cells are denoted with a minus, "-". A FredkinCell has 4 neighbors, if it's an interior cell, 3 neighbors, if it's an edge cell, and 2 neighbors, if it's a corner cell. The example below is of 1 FredkinCell that is alive and of age 5 surrounded by 4 FredkinCells that are dead:
      -
    - 5 -
      -
			
  • The rules for going from one generation to the next for ConwayCells are:
  • a dead cell becomes a live cell, if exactly 3 neighbors are alive
  • a live cell becomes a dead cell, if less than 2 or more than 3 neighbors are alive
  • The rules for going from one generation to the next for FredkinCells are:
  • a dead cell becomes a live cell, if 1 or 3 neighbors are alive
  • a live cell becomes a dead cell, if 0, 2, or 4 neighbors are alive
  • You will define the following classes:
  • AbstractCell, an abstract class that is the base class of class ConwayCell and class FredkinCell
  • Cell, a handle class that manages derived class objects of class AbstractCell
  • ConwayCell, a concrete class
  • FredkinCell, a concrete class
  • Life<T>, a concrete class
  • Life will be instantiated with either ConwayCell, FredkinCell, or Cell.
  • If Life is instantiated with Cell, then when a FredkinCell's age is to become 2, and only then, it becomes a live ConwayCell instead.
  • Create a good object-oriented design with no getters and setters by writing well-defined classes that are responsible for a specific and modular part of the solution:
  • Read Getters and Setters and More on Getters and Setters
  • Create a UML diagram to represent the design. Use any UML editor that you like. The diagram needs to show data members, methods, associations and multiplicity between the classes.
  • Use Gliffy, PlantUML, yUML, or something else.
  • You may not use new, delete, malloc(), free(), or allocator. You may use the STL.
  • An exception is that you can use new/delete to construct ConwayCell and FredkinCell objects when you construct Cell objects and in clone and mutate.

Rubrics


Name Description Points
Estimation
  • estimate and track time to completion
GitLab
  • create a private code repo (https://gitlab.com/GitLab-ID/cs371p-life/)
  • give the TAs Developer access
1. GitLab Issues
  • enable issues here: Settings -> General -> Visibility, project features, permissions -> Work Items
  • create the following issue labels here: Manage -> Labels (labels are case sensitive):
    • build_files (Blue-gray)
    • unit_tests (Green-cyan)
    • run (Crimson)
    • acceptance_tests (Dark sea green)
    • hackerrank (Titanium Yellow)
    • continuous_integration (Carrot orange)
    • documentation (Lavender)
    • ai_design (Dark coral)
    • ai_criteria (Dark coral)
  • create at least 30 issues with the above labels from these rubrics
  • create at least 5 more issues for bugs and optimizations
  • close all issues as you develop, debug, and optimize the solution
5
2. Build Files
  • .gitignore, ignore everything but the files listed in these rubrics
  • .gitlab-ci.yml
  • Makefile
  • README.md
5
3. Unit Tests
  • LifeTest.cpp
  • create at least 15 Google Tests
  • run astyle, a code formatter
  • run cppcheck, a static analyzer
  • run gcov, a coverage tool
  • run Valgrind, a memory checker
15
4. Run
  • LifeConway.cpp
  • LifeFredkin.cpp
  • LifeCell.cpp
  • add assertions for pre/post conditions, invariants, etc.
  • run astyle, a code formatter
  • run cppcheck, a static analyzer
  • do not run gcov
  • do not run valgrind
15
5. Acceptance Tests 15
6. HackerRank
  • submit LifeConway.cpp to HackerRank
  • pass at least 3 of the 4 tests to be eligible for partial credit
  • submit LifeFredkin.cpp to HackerRank
  • pass at least 3 of the 4 tests to be eligible for partial credit
  • submit LifeCell.cpp to HackerRank
  • pass at least 3 of the 4 tests to be eligible for partial credit
15
7. Continuous Integration
  • show a clean build in https://gitlab.com/gpdowning-ut/cs371p-life/-/pipelines/ to be eligible for partial credit
  • change gpdowning to your GitLab-ID
5
8. Documentation
  • create inline comments in LifeConway.cpp
  • create inline comments in LifeFredkin.cpp
  • create inline comments in LifeCell.cpp
  • specify the complexity of every function/method and the entire program in LifeConway.cpp
  • specify the complexity of every function/method and the entire program in LifeFredkin.cpp
  • specify the complexity of every function/method and the entire program in LifeCell.cpp
  • run doxygen on LifeConway.cpp to produce html
  • run doxygen on LifeFredkin.cpp to produce html
  • run doxygen on LifeCell.cpp to produce html
  • create LifeConway.uml
  • create LifeFredkin.uml
  • create LifeCell.uml
  • run PlantUML to produce LifeConway.svg
  • run PlantUML to produce LifeFredkin.svg
  • run PlantUML to produce LifeCell.svg
  • run git log to produce Life.log.txt
  • run git rev-parse HEAD to produce a Git SHA
  • README.md
    • Full Name
    • EID
    • GitLab ID
    • GitLab URL
    • GitLab Pipeline
    • Git SHA
    • HackerRank ID
    • Estimated completion time
    • Actual completion time
    • Comments
5
9. AI Design
  • read Elephants, Goldfish and the New Golden Age of Software Engineering
  • create DESIGN.md:
    • The Problem
    • The Technical Plan
    • Alternatives
    • Detailed Implementation
  • A Goldfish must be able to create LifeConway.cpp from only DESIGN.md.
  • A Goldfish must be able to create LifeFredkin.cpp from only DESIGN.md.
  • A Goldfish must be able to create LifeCell.cpp from only DESIGN.md.
10
10. AI Criteria
  • create CRITERIA.md
  • Criteria should lead to specific tests.
  • A Goldfish must be able to create the tests from only DESIGN.md and CRITERIA.md.
10
Submission
  • create a single PDF of README.md, DESIGN.md, and CRITERIA.md
  • submit that PDF to Canvas

Copyright © cs371p, 1995-2026
Updated 19 Nov 2026