Share your repls and programming experiences

← Back to all posts
[GAME] Hyperfast Maze Generator — Make HUGE Mazes In Seconds And Solve!
fuzzyastrocat (1843)

I don't usually do things like this, but I saw a maze generator post on here and that reminded me about my foray into maze generation algorithms. So, I revived an old project which, thanks to set theory, is able to generate massive mazes in mere seconds.

The algorithm used is called Eller's algorithm, and while it's probably the hardest to understand out of all the maze generation algorithms it is certainly the fastest because it can generate entire mazes while only looking at a single row at a time. But, the mazes it generates are essentially unbiased and are great fun!

Just hit run and a new maze will be generated in real-time, based on your input size. Then, use WASD or the arrow keys to move the player (red square) to the end (green square), or hit P to save an image to print!

If you want to test my claim that this is fast, try inputting a huge maze size like 500!

EDIT: But don't go too huge, or else the maze paths will be smaller than a pixel and it won't be able to render!

Have fun!

Comments
hotnewtop
BillNyeScience (96)

Mobile game ads be like

i cAnT beAt tHiS leVeL

FlaminHotValdez (694)

@BillNyeScience does anybody really hate that hero wars game ad? they're stupid enough to not beat the easiest level

GhostKing007 (139)

@FlaminHotValdez That ad is a nightmare. Watch one hour of youtube, and you'll have watched 30 mins worth of hero wars being played at 0.01x speed.

FlaminHotValdez (694)

@SudhanshuMishra

yt:buy yt premium for no ads

me: I'll make you a deal.

$1 million for no hero war ads

GhostKing007 (139)

@FlaminHotValdez That's the best deal of this century!

Whippingdot (660)

gud jub i have yt premium (i think my dad bought it for my bro, himself, and my mom and i use my brother's account so...) @FlaminHotValdez

AntonioOng (0)

I just watch youtube at 1.5x speed to get the most content without having to watch ads lol. Most of the time tho, i can skip after 5 sec. But one time, i was watching youtube for school, but i got a 50 minute ad! lmao rotf! Luckily, i was able to skip it

adsarebbbad (216)

imagine not having adblocker @FlaminHotValdez

angrydoge (481)

@BillNyeScience
them seeing someone beat a level like that be like:

VinhBach1 (0)

@FlaminHotValdez i agree with you, its so dumb to see that ad popping around, but the real game wasnt bad at all. I really liked it and i think they made the dumb ad just for testing people :)

Whippingdot (660)

The biggest maze size is 1872 I think (it difers based on pc pixel size I'm pretty sure). Also it looks like this

Do TVs switch to your maze generator when they don't get signal?

fuzzyastrocat (1843)

@Whippingdot Yeah, it does differ depending on retina display pixel density and things like that.

Haha, yeah I guess they do!

GhostKing007 (139)

@Whippingdot If they do switch to the maze generator, I'd rather they used maze size 1, not 1872 lol

SirBoom (0)

@Whippingdot Yeah, for me it's 1366.

Whippingdot (660)

no i mean like if a TV doesn't get signal, it will show static, which looks like his maze @GhostKing007

GhostKing007 (139)

@Whippingdot Ikwym, I just said it would be better if they used maze size 1 for the static because the static is an eyesore. U didn't get the joke.

FlipLeigion (4)

lol it looks like a broken tv screen @WILLIAMBAEWER

JadenTang1 (1)


what happens when you choose 0.08 or less

fuzzyastrocat (1843)

@JadenTang1 Heh yeah that's making a maze where each hallway is larger than the screen size, and I didn't implement an edge case for that

TheAcorn123 (12)

Wow. The creator is right... it loads super fast

'EDIT: But don't go too huge, or else the maze paths will be smaller than a pixel and it won't be able to render!'
Well... I Might have gone overboard... 1500 isnt too bad...

fuzzyastrocat (1843)

@TheAcorn123 Thanks! Hehe, yeah it depends on your screen size (obviously a larger screen can render at better resolutions).

nameless12321 (13)

a
the power of paint.net

Jessica0519 (1)

The person who made this game is really a genius.

SilvermoonCat (437)

it doesn’t work... it goes too fast so I can’t get through cracks and I can cut right through some things

fuzzyastrocat (1843)

@SilvermoonCat This seems to be a weird error on some people's systems, I'm really not sure what to do since I'm not using anything non-standard and thus it should work fine on all systems.

tankerguy1917 (178)

@SilvermoonCat if you hold down one key (i.e. left) and then hold down another (i.e. down), when you get to a turn (i.e. from going left to going down) it will move the square in that direction
Sorry if that's confusing, couldn't think of a better way to word it.

PyCoder01 (56)

It's broken, It won't let me through.

fuzzyastrocat (1843)

@PyCoder01 This sees to be a weird incompatibility issue on some systems. Not sure what to say here, as it works perfectly on my system and I'm only using standard p5js APIs.

PyCoder01 (56)

@fuzzyastrocat I'm on my school chromebook (core i5 10th gen + gtx 1650). It works on my gaming pc.

JSDRAGONCODER (10)

wait if i do 1 its just all red.
then i have red srceen :)

JadenTang1 (1)

@JSDRAGONCODER you basically have to do 5 or higher

fuzzyastrocat (1843)

@JSDRAGONCODER @JadenTan1 By doing "1", you're saying "each hallway will take up [the screen size divided by 1]" — in other words, the whole screen. The player is a red square, thus at a size of 1 the player will fill the entire screen as well and make the screen red.

Basically, lower numbers = smaller maze = displayed larger (to fill the screen)

fuzzyastrocat (1843)

@nameless12321 Easy! Lemme show you:

1. Go down

2. Right

3. Up

4. Right

5. Down

6. Right

7. Right

8. Down
9. Right

...

tussiez (1669)

Deserves an upvote! Amazing work!

fuzzyastrocat (1843)

@tussiez Thanks! Glad you feel that way!

EllieBrown123 (6)

yessssssssssssssssss

fuzzyastrocat (1843)

@NothingMuchMuch I don't see anything wrong with this picture... am I missing something obvious?

JadenTang1 (1)

@fuzzyastrocat seems like he just cropped part of the image. Pretty obvious when you look at the right side

fuzzyastrocat (1843)

@JadenTang1 That has absolutely no relation to any of the comments though.

Jessica0519 (1)

The easiest level is level 12, lol.

tankerguy1917 (178)

Pretty sweet. It doesn't like 1-3 or 1000 lol

fuzzyastrocat (1843)

@tankerguy1917 Thanks! Probably because those numbers are so out of the ordinary :)

Maxb0tbeep (2)

man this is too hard for me!

SirBilby (9)

Cool! Also, very pleased with myself. I spent hours trying to figure this one out!

CuriousMonkey (48)

I asked my brother what this was and he thought it was flashing old television screen thingamabob

(open in new tab)

fuzzyastrocat (1843)

@CuriousMonkey Hehe yeah it's interesting how that happens

Warhawk947 (524)

guys i'll give the first person to solve this maze absolutely nothing :D

fuzzyastrocat (1843)

@Warhawk947 I solved it!

Oh, you want what? Proof? But I just closed the tab! I promise you though, I did solve it. :)

EpicRaisin (262)

I think you should add a "Generating Maze" text somewhere to show that the maze is being made

fuzzyastrocat (1843)

@EpicRaisin I would think it's pretty obvious that the maze is being made when it's actively growing larger?

EpicRaisin (262)

@fuzzyastrocat For me, the screen is staying white until the whole maze is created.

fuzzyastrocat (1843)

@EpicRaisin Uhh, that's weird, that doesn't happen with anyone else. Not sure what to say.

RhinoRunner (866)

I put maze code 999, and I can see the individual pixels, but i cannot move the red square for some reason.

fuzzyastrocat (1843)

@RhinoRunner This is a known incompatibility issue, sorry :(

iocoder (162)

@fuzzyastrocat write into the alert 0.1

run into problems straight away unless u close the tab lol
SirBilby (9)

@iocoder I tried this and yes it lagged out quite a bit!

JonathanLabasze (0)

i tryed doing a 60 and the code let me go through the wall but nowhere near the end.

fuzzyastrocat (1843)

@JonathanLabasze This is a known incompatibility issue with certain systems.