Re: Noob learns to code in 3 months
Posted: June 29th, 2017, 5:04 pm
Alrighty Thanks!
Learn to program or die trying
https://forum.planetchili.net:443/
Code: Select all
void Board::Drop(int Y, int X)
{
if (grid[Y][X] == empty)
{
grid[Y][X] = hidden;
}
if (grid[Y - 1][X] == empty)
{
Drop(Y - 1, X);
}
if (grid[Y + 1][X] == empty)
{
Drop(Y + 1, X);
}
if (grid[Y][X - 1] == empty)
{
Drop(Y, X - 1);
}
if (grid[Y][X + 1] == empty)
{
Drop(Y, X + 1);
}
}
Just read this post, funny shit.Yumtard wrote:Today I did a bit of repetition for tutorial 3-5.
I also bought a book called "The manga guide to linear algebra"
I'm gonna learn how to math and how to kawaii at the same time!
Glad the homework was enticing enough to get you to mess around in it. Probably means a lot of learners tried their hands at it as well. I was considering revisiting this for the homework for strings and streams, but then decided to do something in one of the games instead.albinopapa wrote:I didn't follow along with the previous videos so I don't have all the utility functions. I did however try this homework using the STL, just to see what it'd look like. Most everything in the Database and Entry classes, were needed, so the only real savings were the utility functions prior to this lesson.
Chili really knows what he's doing, for all you following along, keep following.
If you delete MemeField dynamic object, the only thing that gets freed is the memory for that object, not any of the dynamic memory that pointers in that object might point to. There is a way to get this to work automagically when you delete an object, but that will have to wait for the next tutorialYumtard wrote:I'm not deleting the Tile field inside of MemeField. Do I need to do it?If I'm deleting field inside of game then doesn't the tile field also get deleted anyways?https://github.com/Yumtard/dynamic-memesbtw: if I close down the game while the sound is playing after I fail, I get an assertion fail. Why is that? It's this one
Sounds good man. Of all the mathing you have to do in games programming, aside from basic arithmetic it's almost all linear algebra shit with maybe a little cherry of trigonometry on top. That is why I always tell people who think programming will be too hard because of math not to worry. In the grand scheme of things linear algebra is just the tip of the math iceburg. But because you're gonna be using it a shit-ton, it's a damn good idea to put some effort in and learn it inside and out.Yumtard wrote:Today I did a bit of repetition for tutorial 3-5.
I also bought a book called "The manga guide to linear algebra"
I'm gonna learn how to math and how to kawaii at the same time!
It's actually a book that my future teacher recommended when I was in for interviews so I assume it should be pretty good.albinopapa wrote:Just read this post, funny shit.Yumtard wrote:Today I did a bit of repetition for tutorial 3-5.
I also bought a book called "The manga guide to linear algebra"
I'm gonna learn how to math and how to kawaii at the same time!
Awesome Looking forward to tutorial 6!chili wrote:Looks like papa got you set while I was away. Lemme add my $0.02.
Glad the homework was enticing enough to get you to mess around in it. Probably means a lot of learners tried their hands at it as well. I was considering revisiting this for the homework for strings and streams, but then decided to do something in one of the games instead.albinopapa wrote:I didn't follow along with the previous videos so I don't have all the utility functions. I did however try this homework using the STL, just to see what it'd look like. Most everything in the Database and Entry classes, were needed, so the only real savings were the utility functions prior to this lesson.
Chili really knows what he's doing, for all you following along, keep following.
If you delete MemeField dynamic object, the only thing that gets freed is the memory for that object, not any of the dynamic memory that pointers in that object might point to. There is a way to get this to work automagically when you delete an object, but that will have to wait for the next tutorialYumtard wrote:I'm not deleting the Tile field inside of MemeField. Do I need to do it?If I'm deleting field inside of game then doesn't the tile field also get deleted anyways?https://github.com/Yumtard/dynamic-memesbtw: if I close down the game while the sound is playing after I fail, I get an assertion fail. Why is that? It's this one
The reason why you are getting the failure when you close down the game is because Memeield isn't getting destroyed properly and the song is still playing when end of program cleanup occurs. This will also be fixed in Tutorial 6.
Sounds good man. Of all the mathing you have to do in games programming, aside from basic arithmetic it's almost all linear algebra shit with maybe a little cherry of trigonometry on top. That is why I always tell people who think programming will be too hard because of math not to worry. In the grand scheme of things linear algebra is just the tip of the math iceburg. But because you're gonna be using it a shit-ton, it's a damn good idea to put some effort in and learn it inside and out.Yumtard wrote:Today I did a bit of repetition for tutorial 3-5.
I also bought a book called "The manga guide to linear algebra"
I'm gonna learn how to math and how to kawaii at the same time!
And as for the recursion, there are a number of fixes you can implement. A straight recursive function is gonna eat stack space as a function of recursive depth, and there is only so much stack space you have. One fix is to increse the stack allocation (in linker settings I think), another is to optimize the recursive function to minimize the number of local variables/function parameters if possible. Probably the best optimization you can do is to modify the algorithm to reduce its maximum depth. I know for a fact the the recursive algorithm I have there could be made to run with a lot lower depth with some semi-clever improvement.
These are all band-aids though, as with a large enough field you will eventually run out of stack space. However, any recursive algorithm can be replaced by an equialent which runs in a loop and has its own stack-like data structure. The advantage of this is of course if you can use your own data structure then you are free to allocate it on the heap instead of the stack (automatic storage region). This technique is often required to solve shit like algorithmic programming challenges.