Warning: I apologize for making it quite computationally demanding, so if you'll run the project on a less powerful laptop, or on a tablet (notebook) or a phone, it is going to be maddeningly slow, so better run it on a (powerful) desktop computer.
a maze and a car image, designed by fridolinux in his autorennen 2.0 project,
nested to it are the 'stick-like' sprites ('lasers') which are sensing the distances between a wall/obstacle, on one hand, and the car, on the other hand, in the directions of the sticks, which is achieved by percentually adjusting their sticks sizes until the stick touches the wall (or an obstacle),
higher order functions, such as KEEP, MAP, and COMBINE are used to get lists of front lasers and back ones, their lengths, and then the longest front laser's direction is used to steer the car (or, when it is shorter than some value, the longest among the back laser's direction is used instead).
When the mouse-pointer is touching the car, the lasers are shown more visibly (i. e. with a lesser ghost effect).
Ideas to spice up the project:
I have been thinking about adding a small-range rotations to the individual lasers in order to find the best possible direction at each step, but that would make the simulation really slow, I guess.
If that was not the case, I would like to add maybe passengers or other cars that the self-driving car would have to avoid.
When I have tried running it on the community site (in "my projects", visible only to me), well, it was too slow. It seems that the embedding makes projects quite slower. Since it is already slow, I prefer it is not run in any embedded form, that is why I decided to not publish it.
Hopefully I am keeping my ability to ask beginners (and stupid) questions - it keeps one's mind open - as my little superpower.
Besides, I still don't understand bunch of things, so be prepared to be asked very stupid questions in the coming 2021; ha ha ha
That sounds great! But meanwhile we can't put it in Featured Projects if you don't publish it. You could put in the project notes that people should click "view code" and run it in the editor instead of directly on the site.
What about publishing a "pointer" project containing no code, except a write block, saying what you said above (invite viewers to open an url of the actual project)?
Ummm sort of... In the new (7.0) version, the libraries work again, but you have to reload the dev version of the library. This is going to be a big pain in the neck for everyone, we know; we wish there were a way we could avoid it. So...