hungry for some challenge and fun, so let's do that :)
662
This is a "problem" that I made up, inspired by interval scheduling but it went in a different direction very quickly. I really like making generators, and this one is special because it also models a real life thing, fireworks! Here is the summary:
Given a larger start and ending range, create some kind of fireworks display so that they come on gradually, and climax and then the show ends. We want events with a staggered start, something that looks like:
(s=start,e=end, and the number indicates the firework number!)
[start] [s1] [s2] [s3] [s4] [s5][s6][sN] [end]
We are going to do the following:
I had originally created an event loop so the fireworks went off at the same time, but it looks much nicer to run in serial (so the more techy cool thing doesn't look better in this case!)
If you want to see this post in action:
docker run -it vanessa/algorithms:fireworks
or forget an entire show, just generate one random "boum"
docker run -it vanessa/algorithms:fireworks --boum
That will automatically select between complex and simple designs. To force a simple or a complex design:
docker run -it vanessa/algorithms:fireworks --boum --simple
docker run -it vanessa/algorithms:fireworks --boum --complex
You can also control the firework size:
docker run -it vanessa/algorithms:fireworks --boum --simple --size 5
Or the specific kind of --complex design (try a random integer!):
docker run -it vanessa/algorithms:fireworks --boum --complex --design 5
or generate an entire fireworks show with one kind of complex design:
docker run -it vanessa/algorithms:fireworks --complex --design 5
Read more about the algorithm or watch shows here
Content type
Image
Digest
Size
176 MB
Last updated
over 8 years ago
docker pull vanessa/algorithms:fireworks