Car exit simulator for narrow opening (GenAI)

 PRMOPTs* for GenAI (using CLAUDE.AI)

Build a fully parametric parking-exit driving simulator (single HTML file with canvas + JS) matching this layout: a top-view parking bay 6 m deep × 2.92 m wide, with the front wall fully blocked, a car 4 m × 1.65 m parked left-bottom in the bay with a 0.15 m gap on the left, 0.2 m gap at the back, and 1.8 m clearance to the front wall. The left wall has a 3.15 m opening (positioned at the top) leading out to a 3 m-wide road that runs parallel to the bay's 6 m side, with the parking bay positioned so the opening is centered on the road's centerline.

Requirements:

  • Realistic car physics (bicycle/kinematic model) with arrow-key/WASD manual controls (steer, throttle, reverse, brake) and touch buttons, plus accurate wall collision detection (stop car and flag a crash on contact).
  • Every dimension must be adjustable via both sliders and numeric inputs: bay width, bay depth, car width, car length, left gap, back gap, opening width, road width, wall thickness, and road approach length — with dependent values (e.g. right gap, front gap, max left/back gap, opening min/max) auto-clamped and recalculated live as sliders change.
  • An "Auto Drive" mode that automatically maneuvers the car out of the bay onto the road, or from the road into the bay, using a smooth computed path (e.g. pure-pursuit style controller) with a speed slider to control playback speed so the steps can be watched clearly.
  • Two explicit modes, "Park Out" and "Park In," with mode-specific resets: Park Out resets the car at its current parked position in the bay; Park In resets the car on the road, centered on the road's centerline directly opposite the opening.
  • Completing an auto (or manual) maneuver in one mode should automatically switch to the other mode, so Park Out and Park In alternate/cycle automatically.
  • Include a HUD (speed, gear, mode, collision count), a toggleable dimension-overlay showing live measurements, a reset button, and a live preview of the planned auto-drive path.
  • Deliver as a downloadable HTML artifact/file.
  • Road edge as wall


* The code was generated in steps with lot of prmpts combined and adjusting mannually to obtain the desied outcome!




No comments: