overview

An interactive simulation game that models carbon emissions across five Boston neighborhoods. Players race against time to reduce CO2 levels by planting eelgrass and converting car commuters to public transit. The game visualizes how policy decisions and environmental interventions can impact urban carbon footprints, with neighborhoods changing color based on their emission levels.

how to play

goal: Reduce any neighborhood's carbon emissions to zero (turns white) within 15 seconds to win. If time runs out, global warming wins.
spacebar: Increases emissions by 750 tonnes per neighborhood. Use this to demo how colors change as pollution rises.
any other key: Plants eelgrass, removing 750 tonnes of carbon from each neighborhood instantly.
mouse click: Converts 300 car commuters to public transit AND removes 750 tonnes of carbon. A double benefit!
time pressure: Every 4 seconds, one year passes and emissions accumulate based on how many people still drive in each neighborhood.

visuals

Each neighborhood is color-coded based on its current carbon emission level, creating an intuitive heat map of Boston's environmental health:

white (0 tonnes): Carbon neutral — you've saved this neighborhood!
blue (<1000 tonnes): Low emissions, doing well.
green (<1500 tonnes): Moderate emissions, room for improvement.
yellow (<2000 tonnes): Elevated emissions, take action soon.
orange (<3000 tonnes): High emissions, intervention needed.
red (3000+ tonnes): Critical levels, immediate action required.
Lose screen

neighborhoods

The simulation features five real Boston neighborhoods, positioned according to their approximate geographic locations. Each has different commuter populations based on actual census data:

Mission Hill: West-central Boston. 7,819 total commuters, 2,645 using public transit.
North End: Northeast, by the harbor. 8,004 total commuters, 4,438 using public transit.
Roxbury: Central-south Boston. 22,969 total commuters, 18,083 using public transit.
Roslindale: Southwest Boston. 18,007 total commuters, 9,343 using public transit.
South Boston Waterfront: East, seaport area. 3,459 total commuters, only 366 using public transit — the hardest to save!

background

The eelgrass mechanic is based on real research into Blue Carbon ecosystems. Coastal ecosystems like eelgrass beds sequester significant amounts of CO2. According to MIT Sea Grant research, Massachusetts' 218,222 acres of coastal ecosystems sequester approximately 7.5 million metric tonnes of carbon — roughly 34 tonnes per acre.

The emission calculations assume that non-public-transit commuters drive cars, each producing approximately 2.9 tonnes of CO2 annually (based on average commute distances and vehicle efficiency). While simplified, this model demonstrates the real tension between transportation choices and environmental impact.

construction

Racket ISL+ big-bang 2htdp/image 2htdp/universe

Built in Racket using the Intermediate Student Language with Lambda (ISL+), this project uses the big-bang framework for reactive game programming. The game state is a struct containing the list of neighborhoods and elapsed time, updated through pure functional transformations on each tick, key press, or mouse click.

Key technical elements:

functional state management: The world state is immutable — each handler returns a new state rather than mutating the old one.
map/filter abstractions: List operations like map and ormap apply transformations across all neighborhoods efficiently.
image composition: Neighborhoods are drawn using place-image and foldr, layering each onto a base canvas.
event-driven architecture: Separate handlers for on-tick, on-key, and on-mouse keep concerns cleanly separated.

game loop

World State Event Handler New State Draw

The big-bang loop follows a simple cycle: the current world state (neighborhoods + timer) passes through event handlers (tick/key/mouse), which return a new state. The draw function renders this state to the screen. The stop-when clause checks for win (any neighborhood at 0 carbon) or lose (15+ seconds elapsed) conditions after each update.

Source? This was built as part of Northeastern's Fundamentals of Computer Science I (CS 2500) course. The full Racket source demonstrates functional programming principles applied to interactive simulation.