Simulation of Sleeping Barber problem in a browser