Simulation CS Thinking Example 2

Follow the full solution, then compare it with the other examples linked below.

Example 2

medium
A traffic simulation models cars on a road. Each car has a speed and position. Every second, each car moves forward by its speed, unless the car ahead is too close (then it slows down). What simplifications (abstractions) does this simulation make?

Solution

  1. 1
    Step 1: Cars are simplified to points with just speed and position โ€” ignoring size, colour, fuel level, driver behaviour, etc.
  2. 2
    Step 2: The road is simplified to a single lane (no turning, overtaking, or intersections).
  3. 3
    Step 3: Time moves in fixed 1-second steps rather than continuously. These simplifications make the model tractable while capturing the core behaviour (traffic flow and congestion).

Answer

Abstractions: cars as points, single lane, discrete time steps, simplified braking rules. These capture core traffic behaviour while making computation feasible.
Every simulation involves trade-offs between accuracy and complexity. Identifying which details to include and which to abstract away is a key skill in computational thinking.

About Simulation

Using a computer program to model and experiment with a real-world system or process. Simulations represent key variables and their relationships mathematically, allowing you to test scenarios, make predictions, and explore outcomes without real-world cost or risk.

Learn more about Simulation โ†’

More Simulation Examples