0:29 true, thats why i only write one liner, unmaintanable code. Thats called job security
@KedrigernGaming3 ай бұрын
Are your variables also called ‘a’, ‘b’, ‘c’ and ‘tmp’?
@FoxSlyme3 ай бұрын
You can "continue" your code if you check for world coordinates using your drone senses instead of the loop variables that are lost when restarting. Something like this: def next_spot(): move(North) if get_pos_y() == 0: move(East) That way you don't even need the for loops or to know the world size
@KedrigernGaming3 ай бұрын
I thought about it and then decided not to bother 😂 But it would probably make the code better!
@shavranotheferanox7809Ай бұрын
i know im late since you already made many more videos, but you could turn the buying and planting of carots into a function, and then just put that function in the code instead of the whole thing
@KedrigernGamingАй бұрын
Thank you for the tip! I have done that already...partially. It always seemed like "This is the last I am gonna have to do/write this. Probably no need to make it generalize the idea." But new mechanics just kept popping up and...eh..yeah, I should optimize a bunch!
@OzDeaDMeaT2 ай бұрын
what is this game called?
@KedrigernGaming2 ай бұрын
I say it at 00:39 - The farmer was replaced ;)
@Dyanosis3 ай бұрын
You don't need to specify 0 for your range start. Range defaults to starting at 0 if you only provide 1 parameter. Aka: range(0, worldSize) becomes range(worldSize) It's also fair to mention that the naming conventions for Python and other scripting type languages (except JavaScript) is snake_case (aka all lower and words separated by underscores).
@KedrigernGaming3 ай бұрын
I see, that's good to know!
@hellangel283 ай бұрын
a little tip: name your variables more specific to what they contain.. using arbitrary nonsaying variable names requires you to keep a mapping of these in your head at all times... 'i' could easily just be 'x', 'j' could easily just be 'y'.. after all they are x and y coordinates.. for example: a = get_ground_type() wouldnt make much sense, if you dont know the arbitrary mapping you dont know what's in any variable, making it less readable, especially if you come back to it years later when you forgot this mapping.. groundType = get_ground_type(); would make it a lot easier to realize what is in this variable, even without seeing the definition, even a decade later :)
@KedrigernGaming3 ай бұрын
I have to agree. I need to change my mindset. This game feels like university used to. Just write some code quickly, it can be unreadable garbage because noone will ever read it anyway and I just need it to work now. BUT! This is a game, not school! This actually matters and surprisingly I want to get back to the code so I need to understand it! It is deceptive how 'easy and short' the code is now though. I don't realize that in 5 minutes I might unlock many new commands and game mechanics making the code grow. Gotta make it clean asap.
@hellangel283 ай бұрын
@@KedrigernGaming exactly, the cleaner your code, the easier you can extend or adapt it.. and yeah this is a game, but in my opinion it's good to get used to some "best practices" because in the end they will make it easier for you and if you "automatically" do these things, you already start out with cleaner and more managable code! :)
@KedrigernGaming3 ай бұрын
Sometimes it can be hard not to have that 'I am for sure never getting back to this code again' mentality. For some reason I always get back to my code and curse my past self :D
@realdragon3 ай бұрын
For now the only use for functions I see is to have everything organized. So they're basically useless
@KedrigernGaming3 ай бұрын
Agreed. I feel like sometimes people like to use functions just for the sake of using them. When in my eyes it makes the code in no way better to read and possibly harder to edit (code in multiple places).
@leamir03 ай бұрын
@@KedrigernGaming tbf with functions, as long as you have a good ida(click to go to function definition) + good function name it makes stuff more readable In my case in this game, I have a function for planting a line of each plant, a function for watering, and a main. I feel like my code is way more organized than if it was all one file
@KedrigernGaming3 ай бұрын
I expect this to be true for me as soon as the code gets larger. What you are saying makes sence, I’m just not there yet 😂
@leamir03 ай бұрын
@@KedrigernGaming you definitely aren't there yet, you are close tho. I really want to see how you are going to make the money farm, still haven't figured mine out (it's hard)
@KedrigernGaming3 ай бұрын
Hoho…no idea what you are talking about just yet. Sounds fun though. Looking forward to it! But first step for me is to stop forgetting the brackets. That really makes it hard to progress in the game 😂