When doing this code Its not liking the "Cell_Function" its stating that "cell_fuction have never been defined and i need must assign a value before using. Can someone help, What did i miss?
ive seen other playthroughs of this game and this is probably the most informative, and im seeing concepts that i can use in my programming projects i haven't thought about in the way you have
I wanted to compliment you. I know when I am teaching the kids in the family complicated topics i get little praise. I started coding in May, with Arduino and ESP32 using c and micropython through the assistance of AI. Being on the spectrum reading on a topic does nothing for me, seeing it means everything. I followed your first two videos with eagerness as I am approaching the Auto Run in my own save and somehow I noticed how you were bringing everything together with these entity arguments. Today while looking to see if you had another video, I decided to bring in the pumpkin code myself. And while the dying pumpkins are leaving a blank spot of tilled soil (Lists surely) I integrated pumpkins very VERY easily. I am over the moon! Thank you Sir. Your service has been noticed and put to good use.
@@jack.hodkinson my other channel @modelersguild was made on 2010 to teach people. And I know the comments can be hell. Or not helpful. I rarely comment, but do if I’m inspired to do so.
Thanks for These Videos, cant wait for the next one. Learned a lot from your approaches. Especially the thoroughness that you move functionality away from the more abstract layers and encapsulate it in more basic functions. I always saw this 'style' on github projects and usually hate it, because it means jumping around and into functions a lot until you get to the bottom where the actual functionality is hidden. I come from scientific data Analysis and we usually use a more Script based approach with a very linear path like "do x to the data, then do y and save the results in z".
Thank you! Choosing the right abstractions is one part of the difficulty (you want them to be fairly stable). Another underrated aspect is choosing names for your lower-level code. The names should be descriptive enough that you don't feel the need to dive in deeper when you're thinking levels above.
It seems like the way the game progresses favors the logic being grid-wide rather than tile-by-tile. That is, calling something like make_wood(), make_carrots(), etc., with each of those being optimal for the grid as a whole. Your tile-by-tile is way more versatile, but it seems like the number of arguments being passed around is way more than needed because each crop is trying to teach a different coding concept.
Probably a nitpick, but the move_to_origin isnt necessarily faster, you now have half the number of steps on average but with 1 branch condition at each step. Branch conditions in general are extremely slow and inefficient, though here in the case move takes many more cycles to run then it doesnt really matter much However, you could move the branch condition outside to only check it once per axis and choose the move direction and then just call it in while loop
in the Entity_to_plant function here's a suggestion for some inprovement for the wood production^^ Sorry indentation on coments are non existent, spaces galore it is. if (x+y) %2 == 0 and wood_count < best_count best_resource = Entities.tree best_count = wood_count elseif wood_count < best_count best_resource = Entities.bush best_count = wood_count number 1, this will make a checkerboard pattern, and lose an extra And in the if statement(more performant for later in the game) number 2 if it can't plant a tree it will plant a bush, so as to try and keep up the wood production better ^^ number 3 can't actually remember if it is elseif, that is used in the game might want to look it up :)
@@Koroistro That only works depending on if get_world_size() is odd or even. I think if it's even, you'll end up with rows of trees on every other row.
I already played through this game and it's very interessting to watch your way. Btw, you can safe a bit of time if you just continue the while loop instead of doing a flip.
Rather than never planting bushes, you can choose between bush and tree when you want wood. A denser packing than only on coordinates where both are even, is when the parity of x is different to parity of y, i.e. x % 2 != y % 2
I know i disliked tilling and untilling. I started just planting hay on tilled soil, so i didn't need to worry about the ground type (you can find the type in the auto complete for the plant() funtion)
When doing this code Its not liking the "Cell_Function" its stating that "cell_fuction have never been defined and i need must assign a value before using. Can someone help, What did i miss?
Doubles check that you haven't made any typos either with casing ('Cell_Function' and 'cell_function' are not the same) or spelling ('cell_fuction' and 'cell_function' are not the same). If it's not that, paste some more code so that we can help you with context.
You can store moves in a stack and store visited cells in a 2D array, and when you encounter a dead end (only walls and visited cells around the current cell) just pop the previous moves and move backwards until you find the next unvisited cell to move to. Repeat this until you have no moves left in the stack or until you find the treasure The algorithm is called "depth-first search"
Random movements are a good start, but you really need to use 3 things to have a good time with the maze: 1. Tuples, Tuples are amazing, I'd strongly recommend making a get_pos function that just returns (get_pos_x(), get_pos_y()) for convenience. 2. A set of visited cells (store the tuples inside here); when moving "randomly" you should only visit cells that aren't in this set. 3. A stack: To let you move backwards once you hit a dead end; would recommend defining a invert_direction(dir) function here. There are other possible algorithms, and some serious potential for optimisation by remembering this state to rewalk the maze efficiently by refertilising the treasure. But that should get you started on a good solution.
If you're falling behind on wood you can plant bushes in between the treas, it wont slow down the growth
Great idea!
trees can be planted in a checkerboard im pretty sure so instead of x even and y even you do x+y even
This is HUGE! Thank you for the info
Yeah, I use get_pos_x() % 2 == get_pos_y() % 2.
When doing this code Its not liking the "Cell_Function" its stating that "cell_fuction have never been defined and i need must assign a value before using. Can someone help, What did i miss?
@@terrylake5966 why are you asking this as an answer to my comment
Can’t wait for the next episode, this game is so interesting to watch. Each play through is completely unique to the devs mindset
ive seen other playthroughs of this game and this is probably the most informative, and im seeing concepts that i can use in my programming projects i haven't thought about in the way you have
Keep these coming! I would love a full playthrough!
I wanted to compliment you. I know when I am teaching the kids in the family complicated topics i get little praise.
I started coding in May, with Arduino and ESP32 using c and micropython through the assistance of AI. Being on the spectrum reading on a topic does nothing for me, seeing it means everything.
I followed your first two videos with eagerness as I am approaching the Auto Run in my own save and somehow I noticed how you were bringing everything together with these entity arguments. Today while looking to see if you had another video, I decided to bring in the pumpkin code myself. And while the dying pumpkins are leaving a blank spot of tilled soil (Lists surely) I integrated pumpkins very VERY easily.
I am over the moon! Thank you Sir. Your service has been noticed and put to good use.
Thank you, I'm glad you're getting something out of it!
@@jack.hodkinson my other channel @modelersguild was made on 2010 to teach people. And I know the comments can be hell. Or not helpful. I rarely comment, but do if I’m inspired to do so.
Thanks for These Videos, cant wait for the next one.
Learned a lot from your approaches. Especially the thoroughness that you move functionality away from the more abstract layers and encapsulate it in more basic functions. I always saw this 'style' on github projects and usually hate it, because it means jumping around and into functions a lot until you get to the bottom where the actual functionality is hidden.
I come from scientific data Analysis and we usually use a more Script based approach with a very linear path like "do x to the data, then do y and save the results in z".
Thank you! Choosing the right abstractions is one part of the difficulty (you want them to be fairly stable). Another underrated aspect is choosing names for your lower-level code. The names should be descriptive enough that you don't feel the need to dive in deeper when you're thinking levels above.
It seems like the way the game progresses favors the logic being grid-wide rather than tile-by-tile. That is, calling something like make_wood(), make_carrots(), etc., with each of those being optimal for the grid as a whole.
Your tile-by-tile is way more versatile, but it seems like the number of arguments being passed around is way more than needed because each crop is trying to teach a different coding concept.
I'm fiending for part 3!
Soon…
Probably a nitpick, but the move_to_origin isnt necessarily faster, you now have half the number of steps on average but with 1 branch condition at each step.
Branch conditions in general are extremely slow and inefficient, though here in the case move takes many more cycles to run then it doesnt really matter much
However, you could move the branch condition outside to only check it once per axis and choose the move direction and then just call it in while loop
or just use the int of the position to directly move to the origin
in the Entity_to_plant function here's a suggestion for some inprovement for the wood production^^
Sorry indentation on coments are non existent, spaces galore it is.
if (x+y) %2 == 0 and wood_count < best_count
best_resource = Entities.tree
best_count = wood_count
elseif wood_count < best_count
best_resource = Entities.bush
best_count = wood_count
number 1, this will make a checkerboard pattern, and lose an extra And in the if statement(more performant for later in the game)
number 2 if it can't plant a tree it will plant a bush, so as to try and keep up the wood production better ^^
number 3 can't actually remember if it is elseif, that is used in the game might want to look it up :)
... and just looked at the coments further down sugesting what i just wrote, but without the code sample..... doh!!
elif
For the trees, if x % 2 == y % 2 should work better giving you a checkerboard grid.
(x+y)%2 == 0 also works well
@@Koroistro That only works depending on if get_world_size() is odd or even. I think if it's even, you'll end up with rows of trees on every other row.
I already played through this game and it's very interessting to watch your way.
Btw, you can safe a bit of time if you just continue the while loop instead of doing a flip.
Rather than never planting bushes, you can choose between bush and tree when you want wood. A denser packing than only on coordinates where both are even, is when the parity of x is different to parity of y, i.e. x % 2 != y % 2
I know i disliked tilling and untilling. I started just planting hay on tilled soil, so i didn't need to worry about the ground type (you can find the type in the auto complete for the plant() funtion)
13:25 you noticed there is an inbuilt get_ground_type so you rename your custom function instead of using the inbuilt one? 😅
They do different things - the inbuilt one gets the ground type currently underneath the drone
@@jack.hodkinson ahhh thank you! i was confused about that. great series 🙏🏼
@@keejay98195 Thank you!
When doing this code Its not liking the "Cell_Function" its stating that "cell_fuction have never been defined and i need must assign a value before using. Can someone help, What did i miss?
Doubles check that you haven't made any typos either with casing ('Cell_Function' and 'cell_function' are not the same) or spelling ('cell_fuction' and 'cell_function' are not the same). If it's not that, paste some more code so that we can help you with context.
i gave up on the maze its just not possible for me without cheating or doing random movements
You can store moves in a stack and store visited cells in a 2D array, and when you encounter a dead end (only walls and visited cells around the current cell) just pop the previous moves and move backwards until you find the next unvisited cell to move to. Repeat this until you have no moves left in the stack or until you find the treasure
The algorithm is called "depth-first search"
Random movements are a good start, but you really need to use 3 things to have a good time with the maze:
1. Tuples, Tuples are amazing, I'd strongly recommend making a get_pos function that just returns (get_pos_x(), get_pos_y()) for convenience.
2. A set of visited cells (store the tuples inside here); when moving "randomly" you should only visit cells that aren't in this set.
3. A stack: To let you move backwards once you hit a dead end; would recommend defining a invert_direction(dir) function here.
There are other possible algorithms, and some serious potential for optimisation by remembering this state to rewalk the maze efficiently by refertilising the treasure.
But that should get you started on a good solution.