CPlusOOP
SiteMap
Reusable Software
Structured Programming
Eco Simulation
«Prev
Reusable Code
Polymorphism Concept
Define Polymorphism Concept
Difference Conversion Overloading
ADT Conversion
Conversion Member Functions
Comparing Conversion Operators
Compiler Selects Overloaded Function
Signature Matching Algorithm
Selection Algorithm Function Overloading
Overloaded Function Example
Using Polymorphism Conclusion
Operator Overloading
Overload Operators
Overloadable Operator Types
Declare Friend Function
friend Function Usage
Operator Keyword
Unary Binary Operator Overloading
Overloading Unary Operators
Overloading Binary Operators
Overloading Assignment Operator
Input Output Operators
Overloading Output Operator
Overloading Input Operator
Overloading Pointer Operator
Overloading New Delete
Operator Overloading Guidelines
Overloading Operators Summary
friend Function - Quiz
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