Data & Systems60 minutes

Charging Bay Controller

Build a charging controller for a bus depot from a one-page spec.

Python

Task

An electric bus depot has a few charging bays. Buses ask for a charge with the energy they need and the minute they depart. When every bay is busy they wait in a queue. Time moves in ticks. The repository has a one-page spec and a stub. Build the controller from the spec, starting with a small working core.

Requirements

  1. simulate(config, events) runs the events in order on a new depot and returns one result per event. config is {bays, rate}: the number of bays, and the kWh one bay delivers each minute. Both are whole numbers of 1 or more (ValueError containing bays or rate otherwise). Time starts at minute 0. Do not change the arguments.
  2. {op: "request", bus, kwh, departure} asks for a charge. The bus takes the free bay with the lowest number, and the result is {bus, state: "charging", bay}. With no free bay it joins the queue, and the result is {bus, state: "queued", position}. The queue is ordered by earliest departure, and equal departures keep their request order. A charging bus is never moved out of its bay. A bus that is charging or queued cannot ask again (ValueError containing already); a bus that has finished can.
  3. {op: "tick", minutes} moves time forward. In each minute every charging bus receives rate kWh, or what it still needs if that is less. A bus that reaches zero is finished at the end of that minute and leaves. The first bus in the queue takes its bay and charges from the next minute. The result is {time, finished}: the new time, and the buses that finished during the tick, in the order they finished and by bay number within one minute.
  4. {op: "status"} returns {time, bays, queue, late}. bays lists every bay in order as {bay, bus, remaining}, with bus null and remaining 0 for a free bay. queue is the waiting bus IDs in order. late is the sorted IDs of the buses, charging or queued, that will finish after their departure if no new request arrives. Finishing exactly at the departure minute is on time.
  5. Validation: bus is a non-empty string, kwh is a whole number of 1 or more, departure is a whole number of 0 or more, and minutes is a whole number of 1 or more. Each raises ValueError containing the name of the field. Any other op raises ValueError containing op.
How you are graded
  • Decomposition 15%
  • Prompting the assistant 15%
  • Verification 20%
  • Judgment about AI output 15%
  • Correctness 25%
  • Communication 10%

Scores use evidence from your session. A short or incomplete session may not provide enough evidence for every skill. See a sample scorecard

Interview guidance

Build a controller for an electric bus depot with a few charging bays. Buses request a charge with the energy they need and a departure time, and time moves through ticks. The spec is one page. Start with a working core and grow it. Use the AI assistant however you like, and tell me your data model before you ask it for code.

  • AI is allowed and expected: your own Claude, OpenAI or Gemini key, or the free in-browser model.
  • You are graded on how you drive and check the AI, not on how much you prompt.
  • Run the checks; read what fails.
  • A new requirement will arrive partway through.
  • Too little AI use is reported as “not enough to grade”, never as a fail.
You will answer 8 debrief questions at the end
  • What did you delegate to the AI, and why?
  • Name one AI suggestion you rejected or changed, and why.
  • Choose one block the AI helped write. Explain what each line does and which test verifies it.
  • What is still risky, and what would you test or ship next?
  • What was your core, and how long did it take to get its first check passing?
  • What is your data model, and what did you decide yourself before asking the assistant?
  • Which edge case did you test that the assistant's first version got wrong?
  • What did you leave out, and what would you build next?