CPlusOOP
SiteMap
Reusable Software
Structured Programming
Eco Simulation
«Prev
Reusable Code
Polymorphism Concept
Comparing Conversion Operators
ADT Conversion
Conversion Member Functions
Signature Matching Algorithm
Operator Overloading
Unary Binary Overloading
friend Function Usage
friend Function - Quiz
Overloading Operators
Pure Polymorphism
Define Class Inheritance
Pure Polymorphism
Derived Class
Public Inheritance
public Inheritance - Quiz
Constructors Base
Reference Typing Conversions
print member-function
Virtual Functions
Guidelines Virtual Functions
Virtual Function - Selection
Virtual Function - Exercise
Abstract Classes
Reinterpret const cast
Dynamic cast Operator
RTTI
typeid Operator
throw C++ Exception
Pure Polymorphism Conclusion
Ecological Simulation
Writing your Own Simulation - Exercise
Writing your own simulation
Objective:
Write a more robust ecological simulation program.
Instructions
Use the basic components of the simple ecological simulation program presented in this module to design and code your own version.
The exact specifications of the program are up to you, but there are a few minimum specifications beyond what you have examined and written so far in this module:
Add the ability for users to determine the size of the world and the number of cycles.
Create more complex interactions between your lifeforms.
Provide each lifeform with a display character so users can tell the lifeforms apart when the world is displayed.
Automatically end the simulation whenever all squares are empty.
Provide clear, well-commented code so it is very clear what enhancements you are making to the simulation.
All the code you have examined for the ecological simulation program is also available in the following files, which can be found in the compressed course download file available on the Resources page:
worldmain.cpp
living.cpp
worldactions.cpp
The course tutor will be choosing the best student submissions for the course project and posting the code in the Course Project Discussion area.
Paste your code below and click the
Submit
button when you are ready to submit this exercise.
Submit