Walk or run in the rain - Build a simulator using AI

Today's post is very unusual. This is something I have been thinking about for a while. When it is raining, what should you do to get the least wet, walk or run?

At the beginning I thought of using Scratch but Artificial intelligence is getting more powerful, and it allows us nowadays to write code very easily. In my case I decided to use Gemini, but you can use ChatGPT or any other AI you have access to. You can use the same prompt I used and it will generate an HTML page that allows you to run your own simulations.

This is my prompt:

I would like to find out whether a person gets more wet in the rain whether they are running or walking. So I want you to help me create a single HTML web application with CSS and JavaScript as required, where I can simulate a person traveling at different speeds. We have to have controls for the person's speed, the speed of the rain falling at, and also the wind speed. Do some research to make sure the range of the sliders has realistic values.

You can further tweak the simulator by prompting the model multiple times. Once you're done, all you have to do is save the HTML file to your computer, and double-click on the file so that it opens in a web browser. You can then play with all the different settings and see what works best.

This is what my simulator looked like:


I played with all the settings of speed, wind direction, etc , and in all cases the graph looked the same. You get less wet the faster you go. As you can see in the graph there is big drop at the beginning and from 5m/s onwards it doesn't drop as fast. So, the one thing that you should avoid at all costs is to walk very, very slowly. It looks like I have been doing it correctly all these years.


Comments