Group Members: Aseel Shaheen, Kyilee Bell, Ronald Perez, Marcelo Gonzalez
NOTE: If the .o and simulation files are there, please run rm *.o ./simulation
in Linux and/or CSE Machines to ensure makefile works correctly. If using powershell terminal, use del instead of rm. Additionally, if using Mingw64 and Visual Studio Code, use mingw32-make
to build, and mingw32-make run
to run the program.
- Type
make
in the terminial to make sure all files are updated. - Use
make run
to run the simulation. - Once ran, use
make clean
to remove the .o and simulation files for cleanliness.
Alternatively, you can run g++ *.cpp -o simulation
to compile the program, then run ./simulation
. Though makefile is suggested.
Additionally, we implemented the bonus aswell.
SimCity is a city simulation project that models the behavior and interactions of various urban zones—Residential, Commercial, and Industrial—within an evolving city environment.
- Residential Zones: Simulate population growth and contribute workers to other zones.
- Commercial Zones: Simulate economic activity, requiring workers and goods to grow.
- Industrial Zones: Simulate production by creating goods and spreading pollution while consuming workers.
- Tracks available workers and goods, updating based on zone growth.
- Zones can grow only when sufficient resources are available.
- Zones influence one another based on adjacency (e.g., powerlines enable growth, populated cells contribute to growth conditions).
- Industrial zones spread pollution that impacts nearby zones.
- Simulation parameters (region layout, time limit, and refresh rate) are defined in configuration files.
- Allows for simulating specific areas independently.
main.cpp
: Initializes the simulation, parses configurations, and runs the simulation loop.Config.cpp
andConfig.h
: Handles parsing configuration files for region layout, time limits, and refresh rates.Region.cpp
andRegion.h
: Manages the city grid, zone interactions, and simulation logic.Residential.cpp
andResidential.h
: Models Residential zone behavior and growth rules.Commercial.cpp
andCommercial.h
: Models Commercial zone behavior and growth rules.Industrial.cpp
andIndustrial.h
: Models Industrial zone behavior, growth rules, and pollution management.OtherRegion.h
: Class to handle other regions.
-
config1.txt
- Defines the simulation settings:
- Region Layout: Path to the CSV file defining the initial city grid.
- Time Limit: Maximum time steps for the simulation.
- Refresh Rate: Interval for printing the simulation state.
- Defines the simulation settings:
-
region1.csv
- Contains the initial grid layout, specifying zone types and placements.
R
= Residential zone.C
= Commercial zone.I
= Industrial zone.T
= Powerline.#
= Powerline over road.P
= Power plant.-
= Road.
- Contains the initial grid layout, specifying zone types and placements.
- Reads configuration from
config1.txt
to set up the simulation. - Loads the city layout from
region1.csv
.
- Zones attempt to grow based on:
- Available resources.
- Adjacency conditions.
- Growth rules.
- Pollution spreads from Industrial zones, influencing adjacent cells.
- At specified refresh intervals, the current city state is printed.
- Growth is contingent on resources like workers and goods.
- Residential zones produce workers, which Commercial and Industrial zones consume.
- Adjacent populated cells and proximity to powerlines influence growth rates.
- Displays city population statistics, pollution levels, and the overall layout at various time steps.
- Users can select a sub-region to simulate independently, allowing for targeted analysis.