Programming Mazes

  Рет қаралды 193,200

javidx9

javidx9

Күн бұрын

Пікірлер: 356
@H2CO3Szifon
@H2CO3Szifon 6 жыл бұрын
This video is a mazing.
@Erebus2075
@Erebus2075 5 жыл бұрын
haha such dad humor :P
@christophergeorgi6419
@christophergeorgi6419 4 жыл бұрын
This video is indeed a maze thing.
@TheRealTrimBrady
@TheRealTrimBrady 4 жыл бұрын
You little...
@skipfred
@skipfred 3 жыл бұрын
☹️
@greenkerbal632
@greenkerbal632 2 жыл бұрын
Listen here you little sh..
@Jetpans
@Jetpans 3 жыл бұрын
Now the man makes an algorithm to solve your maze in under 1 minute. The everlasting competition of coders.
@emjizone
@emjizone Жыл бұрын
If you are in a hurry and like to clone code, you can use almost *the same algorithm* as this generator, and *replace the random direction part with exploration test.* But you'd better use *_double-ends-A_** algorithm instead. Feel free to prove me wrong, or to call me to work together on *amazing* 2D, 3D, nD maze generators and solvers.
@marksandles259
@marksandles259 7 жыл бұрын
just discovered your channel today... Don't normally write in comments sections... but.. really enjoying your videos. please continue the good work.
@javidx9
@javidx9 7 жыл бұрын
Hey thanks Mark. Comments like that make it worthwhile.
@Noone-rc9wf
@Noone-rc9wf 5 жыл бұрын
You cannot tell me this isn't the same guy talking to himself
@qoobes
@qoobes 4 жыл бұрын
About two years later, I discovered it today. Same impression, love it.
@Richard_is_cool
@Richard_is_cool 4 жыл бұрын
Very true. This is, for example, the first time I saw a comment of yours.
@marksandles259
@marksandles259 4 жыл бұрын
@@Noone-rc9wf I can tell you it isn't the same guy... My coding sucks ass.... if I make a asterisk bounce round the screen I start dancing around the room.... I'm just a nice person giving someone positive feedback...
@sebe3243
@sebe3243 Жыл бұрын
I found a new use for this algorithm! It's really good at generating oceans/continents. Visited cells are water cells, unvisited are land cells. If the algorithm stops after visiting about 60% of the cells you can get smaller and larger islands, continents, even some rivers! Really cool stuff 👍
@daskonstrukt8392
@daskonstrukt8392 7 жыл бұрын
As always, i cant believe this video has "only" 300 views. Keep up the awesome work!
@javidx9
@javidx9 7 жыл бұрын
Cheers Konstrukt! I'm not very good at promoting the channel. Sure I'd love more views, but I'm not monetising so there's little incentive for KZbin to promote the channel either. As long as people engage with the content - I'm happy! No "Hey Guys! What is up?" dodgy thumbnail click-bait rubbish from me..
@javidx9
@javidx9 7 жыл бұрын
Thanks Riptide! :")
@FredM80
@FredM80 6 жыл бұрын
Too few people like programming and understanding old algorithms. Actually, many programmers like "not to re-invent the wheel". sad...
@tahwnikcufos
@tahwnikcufos 6 жыл бұрын
2,810 views... this is a good "code along" video.
@81gamer81
@81gamer81 6 жыл бұрын
Great videos indeed. wish yt suggested the channel sooner
@Drogba402
@Drogba402 6 жыл бұрын
This channel deserves more subscribers
@javidx9
@javidx9 6 жыл бұрын
Giant Panda Thanks!
@AndreiNeacsu
@AndreiNeacsu 5 жыл бұрын
While I agree that this channel should have more than 10 million subscribers, I realize that maybe there are simply not that many smart people in the whole world. It would require something like more than 10 mega smart people.
@nadiequintero9981
@nadiequintero9981 4 жыл бұрын
I absolutely love your coding style! So clean and understandable, without unnecessary complications. I'll try to learn from you, thank you for all your content!
@nailbomb420
@nailbomb420 6 жыл бұрын
great video, just going through you're stuff at random - it's a treasure trove! You have a great sense of humour, and manage to choose the most interesting topics :)
@javidx9
@javidx9 6 жыл бұрын
Thanks CodeyThings!
@ravensncrows
@ravensncrows 2 жыл бұрын
Boo gplv3 boooo
@oliverdacracker
@oliverdacracker 4 жыл бұрын
This is the greatest KZbin channel that I have had the pleasure to stumble upon.
@udoc.7528
@udoc.7528 4 жыл бұрын
I found this channel while I was looking for how a game coder works - not a video with visual impressive graphical presentation, but the "ugly" unspectacular hard part of coding thousends of lines and how it is possible to keep an overview. Then stuck to your channel because the quality of your videos especially the content (programs and explanations) is excellent and I learned much here (for example the use of the modulo operator and many other "tricks") I like how you concentrate on what matters - the ideas and algorithms and how smart you code. Today I finished my own (primitive) maze program with the 15 unicode chars 0x2554, 0x2557 and so on, without using one of your game engines but with parts of your code and ideas. It creates the maze in one tick so it is not as good for visualisation as yours but it shows me that I really understood your code. To repeat all calculations in every single frame (OnUserUpdate function) is very time consuming and only possible in that ultrafast C/C++ language (or maybe assembler if one is capable of coding in this). Greetings from Germany and I wish you many good ideas for more programs to show.
@haltarys
@haltarys 5 жыл бұрын
"Two minutes to create a maze that would take one minutes to solve" ? That's a line from Inception !
@TheAngelOfDeath01
@TheAngelOfDeath01 3 жыл бұрын
Yes.
@didaloca
@didaloca 3 жыл бұрын
I read an article a while back where someone created a similar maze using only template meta programming, which was randomised each time it was re-compiled. Pretty mind blowing really.
@weisjerry
@weisjerry 2 жыл бұрын
Excellent explanation! I like how you went over the algorithm first before dropping into code. I’ve always marveled how the best algorithms are often the most clean and simple.
@iMamoMC
@iMamoMC 5 жыл бұрын
I just discovered your channel, and I must say that you're doing a great job at explaining. I especially love how you always take a simple, effective approach (I especially appreciated the method you used for rotation in Tetris). Keep it up! ^^
@FinBoyXD
@FinBoyXD 5 жыл бұрын
I dont believe you did that in two minutes.
@konstantinrebrov675
@konstantinrebrov675 4 жыл бұрын
The algorithm runs in two minutes and creates the maze for you.
@Freakhealer
@Freakhealer 4 жыл бұрын
Of course he did, then he slow down to explain it to us mortals
@matschbirne5363
@matschbirne5363 3 жыл бұрын
Salu omnidentidade The only thing limiting him is the speed of light lol.
@johnpenner5182
@johnpenner5182 2 жыл бұрын
using the stack to pop back the path, whilst keeping tracking of total visited cells is a very nice elegant algorithm. thanks for this! 🙏🏻
@javidx9
@javidx9 2 жыл бұрын
Yeah it is. Breadth First Searches like this are a staple computer algorithm that have been around since the dawn of programming. By eliminating the need to recurse, it also removes all the problems associated with recursion too.
@AcceleratingUniverse
@AcceleratingUniverse 5 жыл бұрын
this was our final project for "introduction to computer science 2" in college; we used both a dfs/stack and bfs/queue (and we had to make the stack and queue). we also had to find the shortest path from the entrance to the exit. ours used ncurses in a gnu/linux terminal! if you have been programming for a couple months, i'd strongly recommend trying that out, it taught me a ton about a programming.
@T3RRY_T3RR0R
@T3RRY_T3RR0R 3 жыл бұрын
Never ceases to impress me how you can take a advanced concept and break it down to very simple terminology. In just the first five minutes you've broken the method by which the algorithm operates down enough for me to understand how to implement it programmaticly.
@altheahicks9574
@altheahicks9574 4 жыл бұрын
Hey, just want to say thanks! I've learned so much from your videos, and continue to learn more.
@Codejoy
@Codejoy 6 жыл бұрын
One of my more favorite videos I have seen. Subscribed a while ago, just a really enjoyable view, everyone of these !
@javidx9
@javidx9 6 жыл бұрын
Hey thanks Shane!
@vascoalmeida4839
@vascoalmeida4839 4 жыл бұрын
A couple of years ago, this video of yours inspired me to writing my first Python/Tkinter application: my idea of coding something useful for practice and keeping my grandchildren quietly entertained. Little did I know that after all this time, a discussion in redditt's r/learnpython thread led me to tell the world about it. The response was amazing, and I have felt compelled to use Github for the first time to make available my first clumsy effort. The code starts with a couple of sentences where I told this story and show my indebtedness to your original presentation; coupled with a proviso that you are not responsible for the 'quality' of the coding. Thank you so much.
@javidx9
@javidx9 4 жыл бұрын
Hey that's great Vasco, well done!
@EmanueleMicciulla
@EmanueleMicciulla 3 жыл бұрын
I learned this from the same magazine! In italy it was distributed by De Agostini with the name "Input"
@EmajlPL
@EmajlPL 7 жыл бұрын
Damm why this channel has so little subs and views. Good work man!
@javidx9
@javidx9 7 жыл бұрын
Hey thanks Emajl, glad you find some of it interesting! You've stumbled across our secret society. Welcome to the club!
@stichtingyimak9695
@stichtingyimak9695 4 жыл бұрын
1:57 into this video and im already convinced that this is awesome.
@100Amida
@100Amida 5 жыл бұрын
Just something small I noticed. You don't need to keep a count of the number of cells visited. If you reach the bottom of the stack and there are no neighbors, then you know the maze is done. Upon further reflection, I think reaching the bottom of the stack will always leave you with no neighbors. Say everywhere in the maze is filled in, except one cell directly neighboring the start cell. As the stack pops, it will encounter a different neighbor of that cell before returning to the start cell, and this different neighbor will generate the path instead. Similarly for any larger empty region, we must fill it in before we can pop the stack to the bottom.
@Xymarue
@Xymarue 5 жыл бұрын
If you got a stack of 2000 cells, you repeat the same code till your stack is empty, using a count variable would automatically stop the algorithm when it's done
@erichenriquez3641
@erichenriquez3641 4 жыл бұрын
I'm really enjoying your videos, took me a long time to discover this channel, hope you keep making this.
@javidx9
@javidx9 4 жыл бұрын
Thanks Eric, will do!
@scottcooper3107
@scottcooper3107 4 ай бұрын
Thanks. Really good information. I don't understand some of the newer C++ syntax, but that's ok. I understand the algorithm, thanks to your video. I decided to make this algorithm work on the old color computer from Radio Shack in basic with 64k. But only 32k is available. I wanted to make a maze of grid size 127x95 in a resolution of 256x192. I needed a array of 12065 bytes to hold the grid. Then another 24k for the stack. That is roughly 36K. Way over the amount I have to work with. I came up with a different way to save space .So instead of using a stack to hold x and y locations of cell, I decided to use 2 bits in the cell array data to hold a number between 0-3. Those numbers would represent the direction that the cell came from. Now, each byte in cell array has 4 bits for the walls, 1 bit for visited or not.1 bit for backtrack or not and 2 bits for direction cell came from. Some crazy reason, it worked. :) Anyway, I thought I would share my algorithm modification info in case anyone else ran into memory constraints on old retro computers. I was able to cut memory usage from 36K to 12K.
@shadowdragon7362
@shadowdragon7362 3 ай бұрын
Personally I also did this but instead of keeping which direction each cell came from I actually while generating the maze have all walls built, meaning it's just a grid of squares and each time I move to a cell I break the wall in the direction I went, that way I do not need to store any direction but instead just perform it instantly.
@kevnar
@kevnar 5 жыл бұрын
I once made a 4D maze. At every location of the maze, you could go up, down, left, right, backward, or forward, but you could also warp to an alternate maze and continue from there. Very easy to design with this algorithm, but very confusing to solve, especially since the display was only 2D.
@javidx9
@javidx9 5 жыл бұрын
Errrrr. Yeah now my brain hurts. Thanks! XD
@johnvonhorn2942
@johnvonhorn2942 5 жыл бұрын
Hahaha, you strike me as an evil genius. You're operating on a higher plane #GodLike
@BichaelStevens
@BichaelStevens 2 жыл бұрын
But can you create your own kernel from scratch?
@sergiojimenez3445
@sergiojimenez3445 7 жыл бұрын
you should have more views, I feel lucky to find this channel
@javidx9
@javidx9 7 жыл бұрын
Hi Sergio, thanks for the compliment. I agree, more views would be nice, and I think finding quality, hidden youtube channels is rewarding too.
@code-dredd
@code-dredd 5 жыл бұрын
Great video. I wrote a sudoku solver using a backtracking algorithm as well, but instead of using a stack object, I relied on the function stack frames by using a recursive backtracking approach. I like that the solving function looks simpler when using recursion :D
@truthteller4689
@truthteller4689 5 жыл бұрын
I like your setup. It looks like the Matrix.
@overratedprogrammer
@overratedprogrammer Жыл бұрын
This video was so helpful and inspiring. I came here for a maze for my genetic algorithm but also got inspiration for a mining tunnel game. Everytime I think of mazes I will think of this video for the rest of my life
@dorjderemnamsraijav5182
@dorjderemnamsraijav5182 4 жыл бұрын
This is the greatest channel i have ever seen on youtube! All of your contents are amazing. Can you show us how to make fluid simulation in c++?
@killermonkey1392
@killermonkey1392 4 жыл бұрын
The way you‘re using bitwise operations has somewhat opened my eyes. I knew about bitwise operations and I also knew about using sums of powers of 2 to store information (e.g. in chmod commands), but I never thought about using it to essentially store several booleans in a single value. Thank you for this video!
@DFPercush
@DFPercush 4 жыл бұрын
Yep, bit flags are very useful, especially for passing a single argument to a function that toggles several different modes of operation. Modern C++ also has bit fields: struct something { int a:1; int b:2; int c:3;} etc. a is basically a boolean, but c:3 could have a value from 0-7. If you need very small integer values you can pack them into a single byte or the smallest integer type that will fit them all. You can't pass pointers or references to them though, only by value.
@botsjeh
@botsjeh 3 жыл бұрын
@@DFPercush bit fields aren't modern C++, bit fields existed in C since it was created in the 70's
@vadimdidenko1443
@vadimdidenko1443 2 жыл бұрын
thanks to this video I learned bitwise operations and better understood hex numbers, thank you!) First two days I only understood the general operation of the code while struggling to figure out what |= and & means in the particular case but on the third day I finally figured out everything Had to spend some time with pen and notebook studying code symbol by symbol. I am very grateful for your videos and the fealing of satisfaction after understanding everything!
@scififan698
@scififan698 3 жыл бұрын
ah, such fun! I coded something very similar when I was a little kid, and I still like to watch you make algorithms like this. more, we want more! ;-) subscribed.
@javidx9
@javidx9 3 жыл бұрын
Glad you enjoyed it, thanks!
@amancalledbob
@amancalledbob 7 жыл бұрын
Really enjoying these videos. Time to dust of my programming head and have a play.
@javidx9
@javidx9 7 жыл бұрын
Hi Bob. Thanks for the great response. Comments like that make it all worth while!
@likeyou3317
@likeyou3317 5 жыл бұрын
Good ol' mazes, happy to see ur channel grow :)
@javidx9
@javidx9 5 жыл бұрын
lol yeah, the oldies are the best ones. Thanks man!
@Rx7man
@Rx7man Жыл бұрын
aMAZEing.. I did a similar thing for solving an arbitrary maze.. this inspired me to go look at that again and make it make a maze
@thesanctuary225
@thesanctuary225 5 жыл бұрын
You are a Wizard of C++.
@gregorymeadows3572
@gregorymeadows3572 5 жыл бұрын
Really good explanation. I recently converted the example code on the Wikipedia page from c to C++ to use in my game. I could follow the code alright, but this was a nice explanation of the stack and how that can make it a bit easier to follow. Stack is still there in mine, just implemented differently.
@javidx9
@javidx9 5 жыл бұрын
Thanks Gregory! There are "stackless" implementations also, but they just emulate a stack with numbers and offsets anyway :D
@fzac
@fzac 4 жыл бұрын
This video is incredible. Thank you.
@BluesManPeich
@BluesManPeich 4 жыл бұрын
"rarely the programs did actually work" - can confirm this. Good times!
@MuratMaman
@MuratMaman 2 жыл бұрын
This is a amazing video, it has been a while since I was looking for. Thank you for your great work.
@FrankWilleke
@FrankWilleke Жыл бұрын
What a fun algorithm! Really simple to implement, and it also provides the solution route for the maze, if the goal position is known upfront. I couldn’t find a clever way of multithreading it yet, though.
@22rw
@22rw 3 жыл бұрын
wow, this video helped me out so much, thank you!
@levchyk10
@levchyk10 6 жыл бұрын
Thank you for making such good videos and motivating others to make their own! Keep on :)
@javidx9
@javidx9 6 жыл бұрын
My Mykola, thank you very much for watching and enjoying them! I will!
@TheDyingFox
@TheDyingFox 4 жыл бұрын
16:19 when loops look like that (with math indexed arrays) is usually when I get lost xD 20:10 that's a new one (to me, a lot has happen apparently since I programmed), a function inside a function... Funception!
@Queer_Nerd_For_Human_Justice
@Queer_Nerd_For_Human_Justice Жыл бұрын
This was a very friendly and helpful video, thank you very much ^^
@MrSinedddd
@MrSinedddd 3 жыл бұрын
This guy is the greates teacher I have ever met.
@jensBendig
@jensBendig 4 жыл бұрын
Good explained!
@QouteOfTheDay
@QouteOfTheDay 5 жыл бұрын
Thank you for this wonderful video.
@javidx9
@javidx9 5 жыл бұрын
Hey Thanks First Mill, my pleasure!
@emjizone
@emjizone Жыл бұрын
*Stacks of tiles are fun* because they make generating mazes look like solving mazes, but otherwise I don't see the point of *wasting computation time and energy* using them for maze generation. 1. You could link new tiles to the existing graph in *any fucking (or even non-fucking) arbitrary order,* including random and discontinuous, as long as you *mark each tile's branch* well, which can be done in a single step each time a tile is added. 2. Even if you want to go through the graph in a particular order for whatever reason of controlling the maze's properties (e.g. limiting the length of straight corridors, or the number of consecutive turns on the same side, or the distance between two branches, etc.), backtracking is *extremely quicker from one **_branching_** node to the next, than from any one tile to the next.* Feel free to prove me wrong, or to call me to work together on *amazing* 2D, 3D, nD maze generators and solvers.
@alexnovik6223
@alexnovik6223 2 жыл бұрын
It's a real appreciate video!!! Excellent explanation !!!
@alfiewhitson7726
@alfiewhitson7726 5 жыл бұрын
this video was a maze-ing
@javidx9
@javidx9 5 жыл бұрын
Ba boom tish!
@professorracc.9780
@professorracc.9780 2 жыл бұрын
that algorithm is pretty ingenious
@skyhorn9070
@skyhorn9070 7 жыл бұрын
So good and calm explanation! I personally think, that it would be awesome that you break down those long lines of code into separate functions and teach people how not to make a blob! :D But overall, its great man
@javidx9
@javidx9 7 жыл бұрын
Thanks Skyhorn! I try to avoid excessive encapsulation where I can as it bloats the code, but it's a difficult balance to get right I agree.
@jonny5_
@jonny5_ 3 жыл бұрын
YES! You DIDN'T use 'system('cls')' to clear your console...thank you, sir!
@jonathanmoore5619
@jonathanmoore5619 4 жыл бұрын
"The old pen and paper"... Like many others before you, your work will only be really appreciated when you stop. Until then. Thanks...
@alastairbowie
@alastairbowie 5 жыл бұрын
This vid was so cool and helpful. Cheers!!
@javidx9
@javidx9 5 жыл бұрын
Hey thanks Alastair!
@neozoan
@neozoan 7 жыл бұрын
Your videos are very well made. Keep it up! :-)
@javidx9
@javidx9 7 жыл бұрын
Thanks Daniel!
@ZaneDragonBorn
@ZaneDragonBorn Ай бұрын
Honestly, love the drawing teaching us how we can visualize this in effect. But as a new game dev to Unity and C#, this guide is quite hard to follow as CPP a quite different and the amount of usage of your engine makes it hard to understand what I am able to use and what I can't. Edit: Well actually this turned out to be quite great! Converted the github to C# using Copilot and with a bit of adjustment on my part. The code makes more sense now! Thx for the tutorial
@Asimov16
@Asimov16 5 жыл бұрын
I remember this algorithm from Sinclair User, and you are correct, it didn't work after 3 pages of typing in the code LOL
@joaocesarlima7339
@joaocesarlima7339 4 жыл бұрын
Great video! Thank you!
@mannyx2796
@mannyx2796 2 жыл бұрын
Very useful video implementing this into my game
@12012004
@12012004 4 жыл бұрын
you are the best!!! Thank you for realeasing such great content
@barmetler
@barmetler 5 жыл бұрын
Absolutely beautiful.
@snork_games
@snork_games 6 жыл бұрын
First video I've seen of yours, sub earned!
@javidx9
@javidx9 6 жыл бұрын
Hey thanks 0x5E! I appreciate that!
@BeerBong97
@BeerBong97 4 жыл бұрын
This is the absolute best channel on the internet
@alexandrelefebvre8627
@alexandrelefebvre8627 4 жыл бұрын
I really like the way you explain things. Always clean and simple (from a programmer perspective, should I say). Have you ever consider teaching ? Good work, by the way.
@javidx9
@javidx9 4 жыл бұрын
Thanks Alexandre! I have taught in the past, but decided to leave academia.
@nicolaibergmann6613
@nicolaibergmann6613 6 жыл бұрын
I just built this in processing and my desktop background is now a maze :D
@javidx9
@javidx9 6 жыл бұрын
Hi thats cool Nicolai, do you get new mazes each time you start up?
@nicolaibergmann6613
@nicolaibergmann6613 6 жыл бұрын
No, but that would be awesome!! I don't know how to do that tho... I just saved a maze as static image and set it as my desktop background... Is there a way to do that automatically?
@DFPercush
@DFPercush 4 жыл бұрын
# include SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, "maze.bmp", 0); Bitmaps are super easy to work with, you can just dump a raw array into a file basically. BITMAPFILEHEADER and BITMAPINFOHEADER are the windows structs for bitmap files, just populate them and dump the memory out to a file, then the pixels, and you're all set. docs.microsoft.com/en-us/windows/win32/gdi/bitmaps
@nicolaibergmann6613
@nicolaibergmann6613 4 жыл бұрын
@@DFPercush Thanks, I might try that!
@olegat
@olegat 4 жыл бұрын
Very cool :-) If I remember correctly I think that you can actually use a queue instead of a stack. Using a queue generates a maze using breath-first traversal, whereas the stack uses depth-first traversal. I would you have liked to see how different the maze looks with a queue instead of a stack :-)
@DFPercush
@DFPercush 4 жыл бұрын
std::list can push and pull from front or back, so you can use it as either a LIFO or a FIFO. Fork the repo and try it out. ;) Although, you might need additional state for each direction on each cell, because the history will be consumed after you take the first branch. I'm sure there are plenty of articles about doing something like that.
@warmdk9536
@warmdk9536 4 жыл бұрын
Thanks for the tips :D Great work!
@sayanghosh6996
@sayanghosh6996 4 жыл бұрын
24:32 "because we're using stack; thats really really complicated................... *one command* - done"😂😂😂
@samuelmaucaille702
@samuelmaucaille702 6 жыл бұрын
Thanks! What a precious video!
@javidx9
@javidx9 6 жыл бұрын
Thanks Samuel, I'm pleased you found it useful!
@ddman12345678910
@ddman12345678910 7 жыл бұрын
loving these videos
@javidx9
@javidx9 7 жыл бұрын
Thanks Revi09!
@skepat9426
@skepat9426 6 жыл бұрын
This is the DFS algorithm :)
@goodboiadvsp3297
@goodboiadvsp3297 4 жыл бұрын
Depth first search for those not binging maze videos rn
@tahwnikcufos
@tahwnikcufos 6 жыл бұрын
Saw 8bits of C++ first, ehh, then this one, subbed... might be a good idea to close any unused toolbox and explorer windows, to get more code on screen, as well as roll back the zoom a bit, and hide the main menu... great video, thanks!
@javidx9
@javidx9 6 жыл бұрын
Cheers, yeah, I was still finding my feet with the whole making videos back then (still am to be fair!) Thanks!
@tahwnikcufos
@tahwnikcufos 6 жыл бұрын
I take that back, 8 bits was second - I watched "What is Assembly Language?" first. Inspired me to start using OneNote again... now that I have a Surface. I gave up on C++ years ago, in favor of VBA, Ruby, and other "scripting" type languages, that satisfied my impatient nature to, "do stuff now", vs getting lost in what seemed to be an endless pit of dependencies, includes, and compiler settings... it was like learning how to build the the tools and the toolbox they go in, when I just wanted to tighten a bolt, but I had to make the bolt too.
@ayushman_sinhaa
@ayushman_sinhaa 3 жыл бұрын
Damn ! You explain things really well..
@tidwellscott
@tidwellscott 5 жыл бұрын
I realized the maze is the same every time. is there any way to fix this?
@javidx9
@javidx9 5 жыл бұрын
Yes Scott, you can seed the random number generator, add something along the lines of srand(time()) to OnUserCreate.
@SourceCodeDeleted
@SourceCodeDeleted 4 жыл бұрын
This is really awesome. Have you looked a the dungeon room generation algorithm in Diablo? I think a video on this would be popular and fun too.
@DarkEgo2468
@DarkEgo2468 3 жыл бұрын
My first maze was done on a RadioShack model 1. I used a string variable as the stack. Back in 1980
@kepeb1
@kepeb1 7 жыл бұрын
Hey, been looking at some of your videos, they are a little beyond me, but I love the detail and explanation. I have been studying C for a couple of months and understand if, while, else, headers, variables, functions, pointers etc. but have not touched any OOP/classes. I understand the ideas, but struggle to remember the syntax, Felt like I needed to move to C++ so I can make some simple games and apps and have been reading a lot. Do you think following along would help or should I continue a more formulaic tutorial type, approach with my beginners books? Many thanks for the videos so far :)
@javidx9
@javidx9 7 жыл бұрын
Hi Turncoat, Thanks for the compliments! These days, knowing OOP in one form or another is a must for most things on user platforms - especially when it comes to user interfaces - that's why I like the console for demonstrating algorithms, it keeps it simple. So you've made the right choice changing to a language that supports it. A good stepping stone is to start using structs first, and getting into the habit of passing structs around and working with fields (you've probably already done this with your C study and pointers). Moving to classes becomes quite natural once those basics are nailed, and it makes sense to have methods as part of the class that do things to the class. Then moving to inheritance starts to feel natural, as you'll want to stop duplicating code everywhere. In my experience, software engineering courses seem to prioritise OOP as the most important part of the engineering discipline, and kick off with UML style diagrams, processes, use cases, actors etc which are so abstract, you're not learning how to code, but how to architect systems, and I believe the two are undeniably linked, but fundamentally different tasks. So this makes answering your question tricky. It sounds like you've an understanding of memory, data, processors and algorithms. There is no limit here to how much you can learn, just how much time you are willing to put in. But, are you finding some of it repetitive? Is your code getting messy with "glue logic"? Do some things just not feel right? If yes to any of those, it's time to start encapsulating and using OOP to keep your code (and mind) under control. So far my videos have not really dealt with "proper" OOP. I aim to get the algorithms across to the viewers in a (hopefully) clear way that negates the need for OOP. This way, I would say yes, the videos should be suitable for following along - and hopefully, your algorithm design, data handling and program flow skills would be enhanced. I started this channel because I feel those skills are often neglected by tutors, and yet are far more critical for a good programmer as they apply in any language, regardless of syntax. That said, if you've found a book that has clicked with you and is in a tone you like, then stick with it even through the boring bits. And nothing says you can't do both, as long as you're coding, you're learning! Good luck!
@kepeb1
@kepeb1 7 жыл бұрын
Wow, Thanks so much for taking the time. Truly, your personal reply is way beyond the cold, directionless C++ 'tutorials' and videos I have been watching so far. It took me a long time to settle on C as a place to start because there are so many opinions and conflicting advice. So it's comforting to have someone reassure me I am going in the right direction by moving to C++. I have gone through everything mentioned as well as booleans, arrays, logical operators and bitwise/binary but have yet to do any real work on structs or classes and don't think I've come across fields yet. But since the direction switch it seems to have gotten suddenly much more complex. It's funny you should mention a book 'clicking'. My move to C++ was prompted by some tutorials which used SDL, but they were mostly using C++ so I have just bought 3 books to look at and I am surprised how different the teaching is in each. The ideas and explanation in one is definitely clicking to an extent, but it's hard to know if i'm on the right track with these 'Essential concepts'. The one I'm focusing on has just started talking about Actors and a bunch of what seems like business strategy and planning ideas... and no coding yet, So feeling anxious about getting lost. I am not on a course and i'm attempting to self teach. You have laid out a great path for me in the first paragraph, and hopefully I can stay the course and push my brain through structs, classes and fields etc :) The Tetris and Outrun style projects look like just the thing to use as milestones and keep up the motivation as soon as I understand these fundamentals a bit better. So, seems I stumbled upon your channel at just the right time. On a side note, I'm not sure why, but the first of your videos I clicked on reminded me of my earliest attempt to understand computers better. I remember at 13, imagining something like your command prompt games. However, I was greeted with shrugs from my family after 5-10 pages of hunt and peck typing resulted in a simple bouncing block (C-64 circa 1993). The language felt alien and I felt incapable so just ended up playing games on it. I regret giving up so easily and wish I would have persevered or tried again at some point since. Hopefully I'm not too late. Thanks so much for the encouragement and advice, I will be checking back frequently.
@javidx9
@javidx9 7 жыл бұрын
No Problem Turncoat, glad it was appreciated. I started on a BBC Micro B+. The games were too expensive for my family so I typed them in from magazines. They never worked first time, and working out why was often more fun than the end result.
@ilug8571
@ilug8571 4 жыл бұрын
@@javidx9 hero o/
@goat5249
@goat5249 4 жыл бұрын
I can't tell if you're faking going outside or being a programmer... Whichever it is, you are a good, my friend.
@QuizzingHobbit
@QuizzingHobbit 5 жыл бұрын
I'm really enjoying following along with your projects, which helps to refresh C++. Quick question about your naming convention: why do you put "m_" in front of your variables? What does it stand for?
@javidx9
@javidx9 5 жыл бұрын
Thanks! I use an old school technique called hungarian notation, where i include type information in the variable name. In this case "m_" means class member variable. I dont always do this, it depends on the size of the project.
@MasterOfMisc
@MasterOfMisc 3 жыл бұрын
2 mins to create a maze that would take him longer than 1 minute to solve. I see your a Christopher Nolan fan. :) Great video and content. I love how you explain these algorithms. I hope you plan on doing more algorithms.
@emjizone
@emjizone Жыл бұрын
2:15 You really *don't need to bother indexing tiles with index tuples* (one per dimension, so here: two). You can just as easily use *a single integer as a tile index*, regardless of the number of dimensions and the shape of the maze, as long as their *order* allows you to simply calculate the neighbor indexes. In general, this *saves unnecessary accesses* and runs faster (depending on your language and compiler).
@shadowdragon7362
@shadowdragon7362 3 ай бұрын
I have implemented this algorithm in x86 assembly in tasm and it works wonderfuly! One problem I was having is that if the tracker runs into a backend and as soon as it is out of it it runs into a new dead end immediatly it will back track to the end of the dead end before it. Now it happens of course because it is the last cell being "discovered" as the last ones were just tracking back. while it does not interrupt the algorithm to make a wonderful maze. It does indeed interrupt other algorithms I would like to use with them. I would be happy for your advice or if I have done something wrong. Thank you!
@Ascendance2001
@Ascendance2001 3 жыл бұрын
Clicking on random videos cool to see this one in my recomended the first one you used OLC on
@cedricfiege7880
@cedricfiege7880 5 жыл бұрын
Your videos are amazing !
@javidx9
@javidx9 5 жыл бұрын
Thanks Cedric!
@Nekonoaijin
@Nekonoaijin 3 жыл бұрын
If anyone runs into an issue with the Windows SDK headers and "byte ambiguity" while attempting to compile this code, or other code that calls on the Windows headers, the issue is that you are using C++17 and the 'std' namespace now defines 'byte', while the Windows headers helpfully also define a symbol called 'byte'. A simple fix that should work for anyone just following along with Javid is to move the 'using namespace std;' statement to be after any '#include' statement that brings in a header that relies on the Windows SDk headers. A more ambitious solution, but potentially problematic, is to "fix" the Windows headers (rename the 'byte' declaration to avoid ambiguity, e.g. BYTE or win_byte, etc). Problematic because they're not your headers, and you're basically creating a non-standard fork of them. And a sidestep to the issue is to make sure you use C++14, instead. This pre-dates the introduction of 'byte' to the 'std' namespace (and is why this issue did not surface earlier). In VS you do this by setting the project properties to the appropriate language variant (and globally defaulting to it, if you like).
@monolyth421
@monolyth421 3 жыл бұрын
I learned about random number generators from a maze generating game on a DOS computer when I was 5
@bobbymarley5111
@bobbymarley5111 Жыл бұрын
Thank you for your fascinating video, it inspired me. 👍😃
@OneSaile
@OneSaile 6 жыл бұрын
this channel will have 70k subscribers by the end of 2018
@javidx9
@javidx9 6 жыл бұрын
Hi OneSaile, i love the optimism, but as long as people find it and the community useful Im happy.
@abandoned7501
@abandoned7501 5 жыл бұрын
@@javidx9 sadly but not =(
@Komagb
@Komagb 4 жыл бұрын
Excellent video, loved it!
@chrisdiphoorn4915
@chrisdiphoorn4915 3 жыл бұрын
How about a 3D version of one of those table top mazes that you have a ball bearing that you need to move through and not allowed to drop in a hole?
@trungthanhbp
@trungthanhbp 6 жыл бұрын
you are awesome xD
@javidx9
@javidx9 6 жыл бұрын
lol thanks ThanhPT!
@helicon2ify
@helicon2ify 6 жыл бұрын
Amazing and well detailed video ! since I found your channel, I start every morning with one of your videos ! Keep up the great work !
@javidx9
@javidx9 6 жыл бұрын
Hi Lukas, thanks, I hope I don't ruin your breakfast!
@nickorsini7239
@nickorsini7239 4 жыл бұрын
Interesting adaptation of depth first search, would think to use it here.
@m4rt_
@m4rt_ Жыл бұрын
22:40 instead of using 0, 1, 2, 3 for the direction use the enum values, and just directly use that value instead of a switch statement
What Is Assembly Language?
24:56
javidx9
Рет қаралды 454 М.
Procedural Generation: Programming The Universe
41:57
javidx9
Рет қаралды 204 М.
У ГОРДЕЯ ПОЖАР в ОФИСЕ!
01:01
Дима Гордей
Рет қаралды 7 МЛН
When you discover a family secret
00:59
im_siowei
Рет қаралды 34 МЛН
АЗАРТНИК 4 |СЕЗОН 2 Серия
31:45
Inter Production
Рет қаралды 875 М.
Blue Food VS Red Food Emoji Mukbang
00:33
MOOMOO STUDIO [무무 스튜디오]
Рет қаралды 34 МЛН
What School Didn't Tell You About Mazes #SoMEpi
12:49
mattbatwings
Рет қаралды 219 М.
A Comparison of Pathfinding Algorithms
7:54
John Song
Рет қаралды 715 М.
Coding Challenge #10.1: Maze Generator with p5.js - Part 1
16:05
The Coding Train
Рет қаралды 396 М.
Line Of Sight or Shadow Casting in 2D
50:23
javidx9
Рет қаралды 143 М.
I tried using AI. It scared me.
15:49
Tom Scott
Рет қаралды 7 МЛН
Code-It-Yourself! Asteroids (Simple C++ and Maths!)
53:11
javidx9
Рет қаралды 170 М.
Maze Solving - Computerphile
17:15
Computerphile
Рет қаралды 1,1 МЛН
The Fastest Maze-Solving Competition On Earth
25:22
Veritasium
Рет қаралды 19 МЛН
Coding Challenge 166: ASCII Text Images
22:42
The Coding Train
Рет қаралды 1,1 МЛН
У ГОРДЕЯ ПОЖАР в ОФИСЕ!
01:01
Дима Гордей
Рет қаралды 7 МЛН