Programming Mazes

  Рет қаралды 197,025

javidx9

javidx9

Күн бұрын

Пікірлер: 356
@H2CO3Szifon
@H2CO3Szifon 7 жыл бұрын
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 3 жыл бұрын
Listen here you little sh..
@Jetpans
@Jetpans 4 жыл бұрын
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.
@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 👍
@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...
@didaloca
@didaloca 4 жыл бұрын
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.
@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!
@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 7 жыл бұрын
Too few people like programming and understanding old algorithms. Actually, many programmers like "not to re-invent the wheel". sad...
@tahwnikcufos
@tahwnikcufos 7 жыл бұрын
2,810 views... this is a good "code along" video.
@81gamer81
@81gamer81 6 жыл бұрын
Great videos indeed. wish yt suggested the channel sooner
@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.
@oliverdacracker
@oliverdacracker 4 жыл бұрын
This is the greatest KZbin channel that I have had the pleasure to stumble upon.
@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.
@nailbomb420
@nailbomb420 7 жыл бұрын
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 7 жыл бұрын
Thanks CodeyThings!
@ravensncrows
@ravensncrows 2 жыл бұрын
Boo gplv3 boooo
@Drogba402
@Drogba402 7 жыл бұрын
This channel deserves more subscribers
@javidx9
@javidx9 7 жыл бұрын
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.
@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.
@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.
@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.
@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!
@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! ^^
@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!
@altheahicks9574
@altheahicks9574 4 жыл бұрын
Hey, just want to say thanks! I've learned so much from your videos, and continue to learn more.
@EmanueleMicciulla
@EmanueleMicciulla 3 жыл бұрын
I learned this from the same magazine! In italy it was distributed by De Agostini with the name "Input"
@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 4 жыл бұрын
@@DFPercush bit fields aren't modern C++, bit fields existed in C since it was created in the 70's
@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?
@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
@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.
@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.
@Saleca
@Saleca 4 жыл бұрын
Of course he did, then he slow down to explain it to us mortals
@matschbirne5363
@matschbirne5363 4 жыл бұрын
Salu omnidentidade The only thing limiting him is the speed of light lol.
@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!
@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
@stichtingyimak9695
@stichtingyimak9695 4 жыл бұрын
1:57 into this video and im already convinced that this is awesome.
@BluesManPeich
@BluesManPeich 4 жыл бұрын
"rarely the programs did actually work" - can confirm this. Good times!
@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
@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.
@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!
@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!
@dorjderemnamsraijav5182
@dorjderemnamsraijav5182 5 жыл бұрын
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++?
@scottcooper3107
@scottcooper3107 6 ай бұрын
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 5 ай бұрын
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.
@truthteller4689
@truthteller4689 5 жыл бұрын
I like your setup. It looks like the Matrix.
@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.
@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
@MuratMaman
@MuratMaman 3 жыл бұрын
This is a amazing video, it has been a while since I was looking for. Thank you for your great work.
@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!
@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.
@fzac
@fzac 4 жыл бұрын
This video is incredible. Thank you.
@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!
@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
@thesanctuary225
@thesanctuary225 5 жыл бұрын
You are a Wizard of C++.
@MrSinedddd
@MrSinedddd 3 жыл бұрын
This guy is the greates teacher I have ever met.
@BeerBong97
@BeerBong97 4 жыл бұрын
This is the absolute best channel on the internet
@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!
@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!
@DarkEgo2468
@DarkEgo2468 3 жыл бұрын
My first maze was done on a RadioShack model 1. I used a string variable as the stack. Back in 1980
@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!
@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
@tahwnikcufos
@tahwnikcufos 7 жыл бұрын
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 7 жыл бұрын
Cheers, yeah, I was still finding my feet with the whole making videos back then (still am to be fair!) Thanks!
@tahwnikcufos
@tahwnikcufos 7 жыл бұрын
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.
@22rw
@22rw 3 жыл бұрын
wow, this video helped me out so much, thank you!
@barmetler
@barmetler 5 жыл бұрын
Absolutely beautiful.
@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.
@QouteOfTheDay
@QouteOfTheDay 6 жыл бұрын
Thank you for this wonderful video.
@javidx9
@javidx9 6 жыл бұрын
Hey Thanks First Mill, my pleasure!
@alfiewhitson7726
@alfiewhitson7726 5 жыл бұрын
this video was a maze-ing
@javidx9
@javidx9 5 жыл бұрын
Ba boom tish!
@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.
@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.
@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).
@meridian974
@meridian974 3 жыл бұрын
this solution has a many long street without '+' type (cross) branching... I suppose that after 10-12 step randomly open new paralel counting thread :) And randomly open just reached dead end connecting with a neighbour cell... (so make a circuit path). :)
@ZaneDragonBorn
@ZaneDragonBorn 4 ай бұрын
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
@Ascendance2001
@Ascendance2001 4 жыл бұрын
Clicking on random videos cool to see this one in my recomended the first one you used OLC on
@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!
@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.
@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.
@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...
@professorracc.9780
@professorracc.9780 3 жыл бұрын
that algorithm is pretty ingenious
@MasterOfMisc
@MasterOfMisc 4 жыл бұрын
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.
@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.
@samuelmaucaille702
@samuelmaucaille702 7 жыл бұрын
Thanks! What a precious video!
@javidx9
@javidx9 7 жыл бұрын
Thanks Samuel, I'm pleased you found it useful!
@helicon2ify
@helicon2ify 7 жыл бұрын
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 7 жыл бұрын
Hi Lukas, thanks, I hope I don't ruin your breakfast!
@jonny5_
@jonny5_ 3 жыл бұрын
YES! You DIDN'T use 'system('cls')' to clear your console...thank you, sir!
@ayushman_sinhaa
@ayushman_sinhaa 3 жыл бұрын
Damn ! You explain things really well..
@shadowdragon7362
@shadowdragon7362 5 ай бұрын
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!
@12012004
@12012004 4 жыл бұрын
you are the best!!! Thank you for realeasing such great content
@nickorsini7239
@nickorsini7239 4 жыл бұрын
Interesting adaptation of depth first search, would think to use it here.
@mannyx2796
@mannyx2796 2 жыл бұрын
Very useful video implementing this into my game
@skepat9426
@skepat9426 7 жыл бұрын
This is the DFS algorithm :)
@goodboiadvsp3297
@goodboiadvsp3297 4 жыл бұрын
Depth first search for those not binging maze videos rn
@joaocesarlima7339
@joaocesarlima7339 4 жыл бұрын
Great video! Thank you!
@jensBendig
@jensBendig 4 жыл бұрын
Good explained!
@monolyth421
@monolyth421 3 жыл бұрын
I learned about random number generators from a maze generating game on a DOS computer when I was 5
@snork_games
@snork_games 7 жыл бұрын
First video I've seen of yours, sub earned!
@javidx9
@javidx9 7 жыл бұрын
Hey thanks 0x5E! I appreciate that!
@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).
@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?
@OneSaile
@OneSaile 7 жыл бұрын
this channel will have 70k subscribers by the end of 2018
@javidx9
@javidx9 7 жыл бұрын
Hi OneSaile, i love the optimism, but as long as people find it and the community useful Im happy.
@abandoned7501
@abandoned7501 6 жыл бұрын
@@javidx9 sadly but not =(
@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.
@alexnovik6223
@alexnovik6223 2 жыл бұрын
It's a real appreciate video!!! Excellent explanation !!!
@ddman12345678910
@ddman12345678910 7 жыл бұрын
loving these videos
@javidx9
@javidx9 7 жыл бұрын
Thanks Revi09!
@alastairbowie
@alastairbowie 6 жыл бұрын
This vid was so cool and helpful. Cheers!!
@javidx9
@javidx9 6 жыл бұрын
Hey thanks Alastair!
@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/
@zpenguz3267
@zpenguz3267 6 жыл бұрын
Your videos are so clean and calm. Regarding this video I have one question, it is supposed to generate a random maze, because no matter how much I run it, it will print the same maze everytime.
@javidx9
@javidx9 6 жыл бұрын
Thanks Pengu, you will need to seed your random function. Random is never random on a computer, so you would normally seed the random number generator with a variable that changes such as "time()" to give true pseudo randomness
@zpenguz3267
@zpenguz3267 6 жыл бұрын
Thanks for the answer, I've played around with the code and this is what I realised: in your github code you indeed "randomised" the starting spot but it still run the same version everytime. It started to be "random" after I moved the srand(clock()); from the main function to the onUserCreate; Now, I have 2 more questions: - what is the difference between srand(clock()); and srand((unsigned)time(NULL));? - will it make any difference if I reset the seed before choosing a random neighbour? Thanks again for your time and for your work :)
@javidx9
@javidx9 6 жыл бұрын
1) nothing really, srand just needs a "random" set of bits to get started. Any function which can provide something you cant easily predict will do. 2) If you reset srand to the same value each time, it will always choose the same number next time you call rand(). resetting srand with a time based function, may have a negligible increase on the quality of the random number, but probably not worth bothering with.
@adamodimattia
@adamodimattia 4 жыл бұрын
Question: why my display on this is squeezed horizontally? The x axis is much shorter then the y, I tested also on the source code. I’m running it on Windows on Mac, but with other tutorials from OLC I hadn’t had this problem (on the other hand I didn’t do that many of them). Is it a problem somehow related to my equipment? Of course it is not of utmost importance, the lesson itself is. But maybe someone has and idea? Maybe even the SENSEI HIMSELF? It is my favorite channel. Cheers!
@warmdk9536
@warmdk9536 4 жыл бұрын
Thanks for the tips :D Great work!
@neozoan
@neozoan 7 жыл бұрын
Your videos are very well made. Keep it up! :-)
@javidx9
@javidx9 7 жыл бұрын
Thanks Daniel!
@Erebus2075
@Erebus2075 5 жыл бұрын
all your stuff is very good and enjoyable to follow ^^. it would be very helpful for this vid if when you use your console drawing lib that you put a link-mark to a short vid of how to structure this draw from std::cout ^^ for those who are just trying to get the alg in ^^ (took me longer than i want to admit to restructure for cout output approach, but didn't want to do draws etc. and wanted it to be something where i could just create a 1d-array for usage and send to another module which then figures out what graphic is needed where etc ^^)
@ellamcgillivray2742
@ellamcgillivray2742 4 жыл бұрын
Hey David i'm currently doing a class on C#, my instructor directed the class to you. I love your channel. It has a lot of interesting code but do you think you can do a video based on c#? If thats not too much to ask?
@mortkebab2849
@mortkebab2849 5 жыл бұрын
My first thought would have been to store visited/not-visited as a vector and use the indices of the bools as (row, column) to refer to position. Is your convention the more customary one? I want to use an approach that conforms to whatever informal "standards" are commonly used.
@cedricfiege7880
@cedricfiege7880 5 жыл бұрын
Your videos are amazing !
@javidx9
@javidx9 5 жыл бұрын
Thanks Cedric!
What Is Assembly Language?
24:56
javidx9
Рет қаралды 456 М.
Coding Challenge #10.1: Maze Generator with p5.js - Part 1
16:05
The Coding Train
Рет қаралды 399 М.
How To Choose Mac N Cheese Date Night.. 🧀
00:58
Jojo Sim
Рет қаралды 92 МЛН
Из какого города смотришь? 😃
00:34
МЯТНАЯ ФАНТА
Рет қаралды 2,5 МЛН
СКОЛЬКО ПАЛЬЦЕВ ТУТ?
00:16
Masomka
Рет қаралды 3,4 МЛН
Do you love Blackpink?🖤🩷
00:23
Karina
Рет қаралды 16 МЛН
What School Didn't Tell You About Mazes #SoMEpi
12:49
mattbatwings
Рет қаралды 270 М.
Programming Perlin-like Noise (C++)
27:54
javidx9
Рет қаралды 105 М.
Is Functional Programming DEAD Already?
21:07
Continuous Delivery
Рет қаралды 69 М.
Code-It-Yourself! First Person Shooter (Quick and Simple C++)
38:56
The Fastest Maze-Solving Competition On Earth
25:22
Veritasium
Рет қаралды 20 МЛН
Maze Solving - Computerphile
17:15
Computerphile
Рет қаралды 1,1 МЛН
why rust libraries may never exist.
7:26
Low Level
Рет қаралды 277 М.
Procedural Generation: Programming The Universe
41:57
javidx9
Рет қаралды 206 М.
New Maze Generating Algorithm (Origin Shift)
6:32
CaptainLuma
Рет қаралды 85 М.
Path Planning - A* (A-Star)
31:18
javidx9
Рет қаралды 162 М.
How To Choose Mac N Cheese Date Night.. 🧀
00:58
Jojo Sim
Рет қаралды 92 МЛН