Robot charging controller with exclusive stations
A fleet of robots shares a small number of charging stations. A robot whose battery drops below 50% should go to a free station, and a robot charging above 95% may leave and go back to work; a station holds one robot at a time. Write the controller that is called repeatedly: each time it checks the robots' battery levels and decides who goes to which station and who leaves. Make sure two robots never get the same station and that repeated polling does not send the same robot twice.
No answer yet. Write the first one; the best answer gets endorsed.
