The Lightning Algorithm - Numberphile

539,214
0
Published 2021-08-24
Matt Henderson is making lightning in mazes.
Check out www.kiwico.com/Numberphile and get 50% off your first month of any subscription.
More links & stuff in full description below ↓↓↓

More videos with Matt: bit.ly/MattHendersonPlaylist

Follow his work on Twitter at: twitter.com/matthen2

Maze solving on our sister channel, Computerphile:    • Maze Solving - Computerphile  

Numberphile is supported by the Mathematical Sciences Research Institute (MSRI): bit.ly/MSRINumberphile

We are also supported by Science Sandbox, a Simons Foundation initiative dedicated to engaging everyone with the process of science. www.simonsfoundation.org/outreach/science-sandbox/

And support from Math For America - www.mathforamerica.org/

NUMBERPHILE
Website: www.numberphile.com/
Numberphile on Facebook: www.facebook.com/numberphile
Numberphile tweets: twitter.com/numberphile
Subscribe: bit.ly/Numberphile_Sub

Videos by Brady Haran

Patreon: www.patreon.com/numberphile

Numberphile T-Shirts and Merch: teespring.com/stores/numberphile

Brady's videos subreddit: www.reddit.com/r/BradyHaran/

Brady's latest videos across all channels: www.bradyharanblog.com/

Sign up for (occasional) emails: eepurl.com/YdjL9

All Comments (21)
  • @Pulsar77
    Back in the day when we needed screen savers, this would've been really nice.
  • @onion013
    "This was done in Mathematica" - I was half-expecting the code to be something like PlotLightning2D[100, 100] given how extensive Mathematica's libraries are :)
  • @hawsroy
    this looks like it should be in a science museum somewhere in high detail on a huge wall, accompanied by huge flashes. i’d pay to see that
  • @Arctic_Narwhal
    Animations of search algorithms are always so fun to watch
  • @florianlipp5452
    the effect of different values for p and q would have been interesting. Higher q values in particular might lead to more twisted paths, detours (going back up for some time) etc.
  • @greatquux
    Perhaps a “tie” in the real world leads to forked lightning
  • @chris9012
    I'd love to see a version with hexagon-tiling.
  • @penny3577
    I can only assume CGP is somewhere screaming: "make them hexagons, not squares!"
  • @TheOcram2000
    I'm a chemist and this is fairly accurate actually. The electrical charge has to pick the oxygen molecules with the proper alignment of their double bonds (pi orbital) to create ozone and still reach the ground ASAP
  • They could have called this the "Following the Droplet Down the Car Window as a Child" Algorithm, but I guess it doesn't have the same ring to it.
  • @PW_Thorn
    To improve this algorithm (generating random map), instead of generating randomly a new map in case it is not solvable, you can just add holes, level by level, randomly. It will then end solvable in a deterministic way instead of crossing finger to avoid that bad luck appears continuously. And we can notice that a randomly generated map with random holes added is still a random map !
  • @elraviv
    there is an algorithm to generate solvable mazes. you add random length lines one by one vertically and horizontally, but they can connect to other lines only at one point. so basically there are no blocking lines but the way around them can be long.
  • @ciscoortega9789
    This looks amazing! Such simple ideas but the combination of them together is absolutely brilliant!
  • @sunongral5605
    I can't hardly explain how satisfying I find the animation! With that little sound! I'm a simple person, I see lighting and I'm hooked for as long as physically possible.
  • I'm surprised there was no mention of how A* (The king of pathfinding) basically combines naiive breadth-first with an arbitrary "fitness metric" (just like you used here to color the wavefront) to guide the selection of which border nodes to search next.
  • @reedplaysgames
    I could watch a bunch of these mazes for hours and not get bored
  • @mceajc
    Brady, I didn't even know how much I was missing hearing you speak to experts in their field until this moment. Thank you!