Share your repls and programming experiences

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

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!

Voters
DecentCoder1
MasonHopson
loolagefuf
world345
HenryZelonka1
AutomationKing
weemac
JSDRAGONCODER
TheTrueGod
NotRandomPerson
Comments
hotnewtop
BillNyeScience

Mobile game ads be like

i cAnT beAt tHiS leVeL

fuzzyastrocat
FlaminHotValdez

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

JWZ6
GhostKing007

@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
FlipLeigion
SudhanshuMishra

@FlaminHotValdez yeah it sucks 🤬

FlaminHotValdez

@SudhanshuMishra

yt:buy yt premium for no ads

me: I'll make you a deal.

$1 million for no hero war ads

SudhanshuMishra

@FlaminHotValdez XD good one

Blackout4344
GhostKing007

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

Whippingdot

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

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

imagine not having adblocker @FlaminHotValdez

LaneMartin
LaneMartin

@Blackout4344 I'LL BUY THAT

PyCoder01
angrydoge

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

BillNyeScience
Blackout4344
jihhyuu202

yeah imagine @adsarebbbad

VinhBach1

@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 :)

Jasperscode
jihhyuu202

those levels are literally counting and they still are like "oH yEaH 8 is gReAtEr ThAn 893"
@FlaminHotValdez

Whippingdot

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

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

Haha, yeah I guess they do!

GhostKing007

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

[deleted]

@Whippingdot my bigest is 1920

SudhanshuMishra

@Whippingdot lol .. true

SirBoom

@Whippingdot Yeah, for me it's 1366.

Whippingdot

O big boi @poetaetoes

Whippingdot

noice noice @SirBoom

Whippingdot
Whippingdot

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

GhostKing007

@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.

Whippingdot
WILLIAMBAEWER

maze, anyone?

fuzzyastrocat

@WILLIAMBAEWER Yesssss, now solve it xD

cuber1515

That's scary

FlipLeigion

lol it looks like a broken tv screen @WILLIAMBAEWER

JWZ6

i aM gOD:

fuzzyastrocat

@JWZ6 Hehe

JWZ6
Minelelol

@JWZ6 Mad man what have you done?!

JWZ6

@Minelelol I aM gOd HaCkS*

JadenTang1


what happens when you choose 0.08 or less

fuzzyastrocat

@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

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

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

nameless12321

a
the power of paint.net

Jessica0519

The person who made this game is really a genius.

fuzzyastrocat

@Jessica0519 Thank you :)

SilvermoonCat

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

fuzzyastrocat

@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

@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

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

fuzzyastrocat

@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

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

SwayamPatil

good

seanlnge

CONGRATS ON CODING WIZARD AWARD!

fuzzyastrocat

@SpicedSpices Oh thanks! I totally didn't forget about that entirely

AstrumDeorum

boom, size 100

fuzzyastrocat

@AstrumDeorum Nicely done!

FrancisPan


OH NO!!!!!1

JSDRAGONCODER

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

JadenTang1

@JSDRAGONCODER you basically have to do 5 or higher

fuzzyastrocat

@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)

JadenTang1

Nice one.

fuzzyastrocat

@JadenTang1 Thanks!

nameless12321

A little help?

fuzzyastrocat

@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

Deserves an upvote! Amazing work!

fuzzyastrocat

@tussiez Thanks! Glad you feel that way!

EllieBrown123

yessssssssssssssssss

NothingMuchMuch


Hold up

fuzzyastrocat

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

JadenTang1

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

fuzzyastrocat

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

ThanhTails

EAZY!

Great job game.

fuzzyastrocat

@ThanhTails Thanks!

Jessica0519

The easiest level is level 12, lol.

tankerguy1917

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

fuzzyastrocat

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

tankerguy1917

@fuzzyastrocat yeah, probably

Maxb0tbeep

smort'nt

fuzzyastrocat
Maxb0tbeep

man this is too hard for me!

SirBilby

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

fuzzyastrocat

@SirBilby Whoaaa, nice job!

SirBilby

@fuzzyastrocat Well thank you!

CuriousMonkey

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

(open in new tab)

fuzzyastrocat

@CuriousMonkey Hehe yeah it's interesting how that happens

Warhawk947

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

fuzzyastrocat

@Warhawk947 I solved it!

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

Warhawk947

@fuzzyastrocat ok here is your nothing:

EpicRaisin

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

fuzzyastrocat

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

EpicRaisin

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

fuzzyastrocat

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

RhinoRunner

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

fuzzyastrocat

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