Use js to write some simulation