How to Automate Farming Pumpkins (Poorly) Using Python Code

  Рет қаралды 29,273

Olexa

Olexa

29 күн бұрын

Program and optimize a drone to automate a farm and watch it do the work for you. Collect resources to unlock better technology and become the most efficient farmer in the world. Improve your problem solving and coding skills.
Check out The Farmer was Replaced here:
-- store.steampowered.com/app/20...
Check out my Python tutorials:
• VARIABLES, TYPES, AND ...
#games #olexa #strategy #farming #automation #programming
Thanks for watching!
-- Extra Olexa Content - / @olexa2
-- Discord: / discord
-- Twitch: / olexastream
-- Twitter: / olexayt
-- Reddit: / olexa
-- My Nexus Gamestore: www.nexus.gg/olexa
-- KZfaq: / olexayt
-- Business Email: olexakid@gmail.com
-- Join this channel to get access to perks:
/ @olexayt
Music I Use:
-- www.bensound.com/free-music-f...
-- Spring by Ikson
-- Harris Heller Streambeats Lofi

Пікірлер: 237
@OlexaYT
@OlexaYT 27 күн бұрын
You know the drill... :)
@kyleallred984
@kyleallred984 27 күн бұрын
I wonder if we could achieve a thousand likes on this comment of yours?
@TheDistur
@TheDistur 27 күн бұрын
Black and Decker
@borisverhaar190
@borisverhaar190 27 күн бұрын
One thing with the if can_harvest() is that the way youre doing it now you just skip over whatever isnt ready even though it will probably be ready soon so it will be at full growth for a while wasting growing time. It also usually works out in a way where you end up getting to the other crops faster that also havent been grown yet. So my conclusion here is that its better to wait until its ready for harvesting in that spot. Now I think the game wants you to use the do_flip thing there but what actually works best in my experience is doing this: while not can_harvest(): quick_print("waiting") harvest() Who knows maybe you end up doing something like this later in the video its so long :) but if not i hope it helps! edit: you do have to check can_harvest but you dont have to with planting pumpkins, if there is already a pumpkin you dont use seeds and nothing happens.
@misterfamilyguy
@misterfamilyguy 27 күн бұрын
We need Rusty's Retirement python coding
@aztheking6280
@aztheking6280 24 күн бұрын
it says 2 days PAY UP 😅
@Linuxdirk
@Linuxdirk 27 күн бұрын
This game is what they should use in school to teach kids programming. Even if it’s just a subset of Python, they would get immediate feedback and success and learn a lot of logic and general problem solving in code while having fun. Best way to learn, in my opinion!
@FlexNiko
@FlexNiko 23 күн бұрын
when i was little, like 18 years ago, we used robot karol in school for a short time. pretty similar concept but you only can pick up and place blocks and markers. even has a free online version
@turbotwo1
@turbotwo1 19 күн бұрын
I work tech in a school district and actually showed this to our department who looks into software to use.
@paulh.5505
@paulh.5505 27 күн бұрын
I initally was getting mad while watching, thinking you are doing things in very inefficient ways. Then I bought the game myself. And I gotta say. Its not as obvious/easy when you write the code yourself. :D Thanks for the entertaining videos :)
@misterfamilyguy
@misterfamilyguy 27 күн бұрын
That's how he gets you to buy the games.
@umbaupause
@umbaupause 27 күн бұрын
Welcome to coding. "This should work. Why doesn't it work? What did I even do now? Why does it work now?! Don't touch anything."
@myclamish
@myclamish 27 күн бұрын
It works on my local...
@abandonment
@abandonment 27 күн бұрын
i love that having a ruby background lets me understand python perfectly fine. also, you stumbling around a giant nested bowl of noodles and missing colons and stuff actually makes it even more believable that you do this professionally lmao
@FranWin
@FranWin 27 күн бұрын
Just as a tip, I made a function called "goto" that takes a coordinate and sends the drone there. With lists that allows you to keep a list of all the coords that have not got a grown pumpkin, and only check them on the next pass rather than traversing the whole farm. So the first and second passes check the whole area and then the drone just jumps between the ones that are yet to grow until all are grown, before harvesting. Super satisfying to watch as a bonus. You do need to also write a function for that which generates a list of all coords in the grid in a sensible order but that's fairly easy! :)
@OlexaYT
@OlexaYT 26 күн бұрын
This is LITERALLY EXACTLY WHAT I THOUGHT OF TODAY haha. Gonna build that next episode
@FranWin
@FranWin 26 күн бұрын
@@OlexaYT Haha amazing! Very much looking forward to that one then. There's some cool optimisations you can do in the goto() to make it decide whether to wrap around or not :) Good luck and loving this series!
@lordthor5951
@lordthor5951 23 күн бұрын
Its weirdly actually not that much more efficient, I have that set up and compared them and you get maybe 25% more every minute. Which is great but stil weirdly underwhelming
@only2sea
@only2sea 15 күн бұрын
​​@@lordthor5951A 25% gain might be quite significant. Let's say that an improvement in something reduced the number of cycles from 5 to 4; that's approximately a 25% gain. In this case, the initial loop and planting take quite some time, which is the same either way. That means the actual gain except the initial loop is even more significant than 25% gain. Even though the drone does not teleport and has to pass the grids, the efficiency gain is less significant. Also, it takes a while for a failed pumpkin grid to regrow. The drone keeps moving to all incomplete grids until they are completed more efficiently, but it's still limited by the growing time.
@lordthor5951
@lordthor5951 14 күн бұрын
@@only2sea to put it more into perspective, my current speedrun time for the speedrun function in the game is around 40 minutes, I think i spend 4? minutes of that time on pumpkins. Compared to the naive solutions on the other harvests it also makes it pretty clear how its not that big of an improvements, my maze solution is shitty and like a third the speed of the fast maze solvers. My Cactus sort is pretty close to perfect and maybe double the speed of some of the slower but still competent cactus solves. The 25% on pumpkins are nice but weirdly not that great of an improvement. (Also for talk about the initial loop the 25% is based on pumpkins per minute, on a 10x10 grid, you go roughly from 80k to roughly 100k, the initial loop doesn't really matter in this)
@pedroff_1
@pedroff_1 27 күн бұрын
I absolutely loved the brain breaking with the unified loop for pumpkins, although I did rage a tiny bit with the `return true`. Also, when the drone started just going sideways, I almost hit my head on a counter from laughing. Loving how the game is managing to find new ways of adding complexity to crops
@SSZaris
@SSZaris 26 күн бұрын
It doesn't matter how perfect your code is, someone will always have a "better" way. The important thing is to keep it fun. I'm having such an amazing time playing this. I'm a visual learner, so seeing my code actually DO something in real time is perfect. I just make a whole heap of little useless functions like a GPS coordinate display and a little shop to buy seeds etc... It's just fun. And that's what a game should be :)
@dascandy
@dascandy 24 күн бұрын
Some conceptual things that can help you write better code: - Split your code consciously into "policy" versus "mechanism" code. Mechanisms are functions that *do*, but never *decide*. Policy is code that *decides*, but never (directly) *does*. Mechanisms are things you test the heck out of, policy are things where tests would only replicate the function. - Make functions that *ensure* things. Instead of having a "if carrots < 25: buy_carrots(25 - count(carrots));" have a "ensure_at_least(Items::Carrot, 25);" that does the complexity for you. - Prefer to avoid inversions. Make your functions positively-phrased, if you have an if statement with an else attached, put the positive form first. Inversions make reading harder, multiple inversions make you stop and try again. Think "if (have_enough(carrot))" and not "if (not are_short(carrot))".
@jwoodCAD
@jwoodCAD 16 күн бұрын
Thank you, I needed to hear this. I actually do drafting for a living, but have some coding I've done to help be more efficient. The policy vs mechanism point really sounds helpful for how to approach a rewrite that I've been spinning my gears on.
@SchPal
@SchPal 27 күн бұрын
Okay, but in the middle of all the code optimization can we all just stop and admire that a 4*4 pumpkin happened with no pumpkins dying at 47:35 immediately after Tyler solved the pumpking planting code?
@thearrogantone4756
@thearrogantone4756 25 күн бұрын
pretty sick
@KCopperr
@KCopperr 27 күн бұрын
Actually my new favorite group of videos ( cant call them a series because the continuation is based on audience participation, I know) Im glad youre having fun with this and even taking the time to do stuff offline! Also, did I miss where you linked the Python YT Tutorials?
@OlexaYT
@OlexaYT 27 күн бұрын
Check description!
@mcaelm
@mcaelm 27 күн бұрын
Tyler: If youre not lost here Im impressed I've been lost since episode 2!
@aldridge1975
@aldridge1975 27 күн бұрын
One thing you could do to improve pumpkin efficiency, is when you can’t harvest, you can reset checks to 0 then rather than at the end of your loop I think. I know it’ll reset your planting to that empty slot rather than the top left, but you’ll be able to harvest the pumpkins a lot quicker that way, rather than getting to the end of the grid, then checking from the top left to see if all squares are harvestable, since it seems like when pumpkins can be harvested, they won’t die
@pmangano
@pmangano 27 күн бұрын
I don't think that changes anything as its a while loop and will only check if checks is = total_grid at the start of a new loop, which only happens at the top left The idea is good and it would make it more efficient but i think implementing that would require more changes
@umbaupause
@umbaupause 27 күн бұрын
I think what you want to do is to count up how many pumpkins you have seen since the last planted one? Of course that'll still go through the entire field unless you make a special wait and check loop for the last pumpkin that was missing.
@jeffreyblack666
@jeffreyblack666 24 күн бұрын
My thoughts, for 3 options: 1 - just making this code nicer by checking if you planted in the loop rather than the checks you have now. change it so it starts as planted=true, while planted, planted=false, and then if it needs to plant, planted=true; 2 - keep track of the last square you planted, or count down from how far ago you did. e.g. set it so when you plant, you set a variable to the size of the grid, then each time you move, count down. When the counter hits 0 (checked inside the part where you see the fully grown pumpkin) you harvest. May have an off by 1 error so double check. 3 - An alternative and likely slowly approach, stay on the square continually checking what is there, if nothing, plant the pumpkin, if a pumpkin, check if you can harvest, and if so move onto the next square. When you complete the grid, every square has a fully grown pumpkin, so harvest.
@ElectricalInsanity
@ElectricalInsanity 27 күн бұрын
I'm loving this series and game! It's fun going back to needing to solve things in a CS101 et al. way instead of just importing someone else's (way better) code. As someone who uses OOP as my favorite hammer, not having classes is the real challenge to this game for me! My solution for the pumpkin was just waiting (using fertilizer once unlocked) for the pumpkin to fully grow before moving on, replanting if it dies.
@OlexaYT
@OlexaYT 27 күн бұрын
I honestly want to set up doing pumpkins like that, and then setting up a timer to see which way is faster. Bc I thought about that too but the growth just seems too slow
@Solanaar
@Solanaar 27 күн бұрын
@@OlexaYT Idk when it gets unlocked, but at some point you get a new menu called "Stats" that measures your collection over the last 60s. That does what you want to.
@Solanaar
@Solanaar 27 күн бұрын
Aren't the functions of the game like classes? I have no clue about coding, but I thought a class is simply a collection of code that always requires predefined variables. If no, what's the difference?
@neohope3851
@neohope3851 27 күн бұрын
@@Solanaar Disclamer : Junior software engineer here so my knowlege and expirience is limited. But my 2 cents on this is Class is just a chunk of code that creates an Object in memory. Now objects are useful because they have their own variables and functions that you can access when you need. Think of it as an item in RPG, that item has it's stats (variables) and can do things like attack (which you would use do_damage function there). Drone for example is an object, it has its own stats (speed for example) and functions (harvest() for example). Coding for drone in the background of the game would be a class. Not sure what Olexa was thinking to do with classes but my guess would be to define the grid as class and then do some stuff with that, or perhaps define pumpkin as a class and then track how big it is untill it reached desired size. I guess. I dont know, my young junior programer brain is probably not developed enough to comprehend XD
@ElectricalInsanity
@ElectricalInsanity 27 күн бұрын
@@OlexaYT It gets more effective the larger your field size. The time and/or fertilizer cost scales linearly with field size, but the harvest amount scales exponentially. Eventually the exponential term dominates and the linear term's contributions can be ignored. I'm not saying it's the optimal solution, but it's good enough for for me to not want to optimize further.
@NiftyPants
@NiftyPants 27 күн бұрын
Bought this because of these vids and ended up playing about 8 hours. I have solutions I'm fairly happy with for all the crops (including Sunflowers which were pretty tricky), but I think I might just give up without doing mazes lol. These are so much fun to watch!
@brunoianigro61
@brunoianigro61 27 күн бұрын
Mazes were really hard for me, but technically if you're willing to wait a bunch of time for every solution, you can solve them by making a while loop that moves the drone in a random direction and then stops when it's on the treasure
@theneekofficial8829
@theneekofficial8829 26 күн бұрын
i just made my drone stick to the RHS as much as possible. similar to how i would solve a maze irl. only tricky thing is knowing the direction you came from as that affects what’s on the RHS. but you can do it with just lists. it’s not the MOST efficient but it’s not random and it does it as quick as i could think of
@khaledahmed9136
@khaledahmed9136 26 күн бұрын
I'm stuck at mazes currently, I'll clean up the rest of my code before trying that one
@hi123-ns3tc
@hi123-ns3tc 26 күн бұрын
The maze is damn complex. So pen and paper design a flow chart first, then convert into pseudo code, then write the real code. Otherwise there are just too many unexpected things to think about...
@billy65bob
@billy65bob 26 күн бұрын
Yeah, the Maze was horrible. A naive "LHS' (or RHS) rule will just get you stuck in funny corridors and make no progress. I had to make about 3 distinct attempts before I finally got something semi-decent and actually reliable. I genuinely wish there was a can_move(dir) I could use to test if a path is blocked, instead of doing the solution I settled on of moving them moving back to test for forks in the path. For my last attempt, I made a recursive solver. Basically every time I detect more than 1 path (excluding the direction the drone came from), it will recurse the solver down each path. If there's 1, it just travels. And if it reaches a dead end, it just undoes all the steps that specific iteration did (by popping a list), so the caller can try the other forks. It still got stuck in loops, so I tracked the already visited tiles in a set once i unlocked those... There is another possibly faster one I want to try, but it basically would just make every step recursive, instead of only when reaching a fork. There's also some funny tricks you can do with dictionaries to make a path resolver, if you refertilise the treasure to solve the maze again (since you know where it warps to), but that requires contingencies if the maze moves walls.
@Dylan52meow
@Dylan52meow 26 күн бұрын
Yay my favorite coding series continues! Please keep it going and eventually fully automate the entire game! After watching you initially go over this game, I have since got the game and completely automated it. I currently reset a total of 29 times. My first and only successful timed_reset() took a total of 2:07:15.154, but I'm sure I can get it way faster after figuring out which unlocks to do in what order and optimizing some of my function a bit. Loving the series! I'll ring the ding-a-ling bell next to the subscribe button so I make sure not to miss any future videos in the series! 🔔✌
@wcrb15
@wcrb15 27 күн бұрын
Bought this game because of your videos. It's been super fun. I'm a software engineer in my day job. I'll probably have my kids play with this some too since they've been interested in learning to program. Thanks for bringing some attention to the game. :)
@billy65bob
@billy65bob 26 күн бұрын
27:30 you can do a 2-pass system. pass 1: Loop the grid once, and plonk a pumpkin in each space pass 2: this time you baby sit the square until the pumpkin has grown fully before moving on Use something like this for pass 2 while not can_harvest(): if get_entity_type(): #this means there is something on the cell do_a_flip() #this is just to waste time else: plant(Entities.Pumpkin) use_item(Items.Water_Bucket)
@REXITT
@REXITT 26 күн бұрын
Loving this! I’m so glad you’re doing more 😁
@Fazal828
@Fazal828 16 күн бұрын
Love these videos! They are the perfect combo of fun and relaxing
@volleyballman1366
@volleyballman1366 27 күн бұрын
Hey bro just stumbled across your channel on episode 1 and I’m very happy you continued this series. I’m a comp sci student and watching this is so entertaining btw 7 hours and 1k likes on the vid 😁
@SchPal
@SchPal 27 күн бұрын
I contributed to getting the like goal, and as long as this game is a series, I will! I love this game
@mr.oplays9089
@mr.oplays9089 26 күн бұрын
Hey Olexa! This video has actually really made me interested in learning python (which I know nothing about) but I think there’s one spot I might have noticed you could make your code just one line smaller, if you remove the Else command from the pumpkin code and just put the whole trade carrot, plant carrot, etc command under the harvest command in the (If entity is not pumpkin and not nothing) then you have no need for the else, at first I thought you could remove the Elif command but then realized that’s necessary for the check. Great video! I’m definitely downloading this game!
@bobbigford6290
@bobbigford6290 19 күн бұрын
You know how funny it is watching you talking to a program I’m dying XD
@BasslineBeat
@BasslineBeat 27 күн бұрын
I realy started to learn coding because of your videos. Its very funny to learn with this game. Thanks for your content, love it❤
@ericslingerland5472
@ericslingerland5472 16 күн бұрын
Never thought id be sitting around excited for someone to start using python lists, but here we are.
@jayjchapman
@jayjchapman 27 күн бұрын
Love the series, for someone who is interested in learning to code this game looks great
@biggusriggus7693
@biggusriggus7693 27 күн бұрын
Just started watching. Went from 1k like in 15 hours to 1k pikes and the video has been up 6 hours. Bolster the videos friends! Need more farm drone
@shadowofdeath8000
@shadowofdeath8000 27 күн бұрын
I'm surprised so many people are turning up for these. Keep it going 😂 i want more
@Forien
@Forien 27 күн бұрын
16:30 instead of doing addition checks, use a boolean variable, let's call it "field_full" that starts out true. If at least one cell in a pass cannot be harvested, it's set to false. If `field_full` variable at the end is true, harvest. At the beginning, before both fors, reset it to true. basically: while true: field_full = true for1 for2 if can_harvest pass else field_full = false plant move move if field_full harvest
@maxwellparker418
@maxwellparker418 27 күн бұрын
I dont have any coding experience at all but this is really interesting to watch. I can follow the majority of whats happening, though i definitely appreciate when you write things out instead of the proper shorthand.
@mathieularocque1953
@mathieularocque1953 24 күн бұрын
Just a few pointer 1 you can do a function for each type of plant you want to plant with parameter to water, harvest, etc with an extra to harvest the non type plant you are trying to plant 2 your main can determine the priority you want it to harvest/plant and shift the crops instead of making it recursive, just make a couple of if for each type of harvest you want, or just make them in different panel and call them if you want but managing most of it in the main is easier specially when you dont have all the tech unlocked 3- For the pumpkin efficiency the most you can do is note the line you have them all and skip them instead of restarting from the beginning of doing them but you wont save much... 4- for your trade function just add a if to check the requirement for the trade for each seed you can buy, simple after that to just call and trade for whatever, just define your harvesting priority with the seed trade requirement if you have 1000 of hay, wood and carrot you can buy any seed in decend pack anyway Cant wait to see you get to the next part
@TReyeHD
@TReyeHD 16 күн бұрын
I got something to say to the people who commented about wasting water and the can_harvest function... can_harvest is to ensure that you don't accidentally harvest an entity that isn't ready. So I agree with you, can_harvest is necessary, especially when the drone moves faster and faster. And the other thing about the comment for "wasting water"... It would be wasting it if not for the fact that the more empty tanks you have the faster you regenerate water, therefore this comment is plain unnecessary. But for those who really think they're wasting water... Put the water_me function under the plant function, simple as that.
@collegelifecookingwithjohn8481
@collegelifecookingwithjohn8481 26 күн бұрын
I love this so much! Will be getting the game!
@jayglenn837
@jayglenn837 26 күн бұрын
Yay it's back! So glad I shared around the video lol
@vorpal23
@vorpal23 26 күн бұрын
I throughly enjoy empathizing with the head spinning feeling when you run into something that just increases the complexity and all of a sudden all the code needs to be updated. I can’t wait for the further unlocks to make your brain itch like it did mine.
@HypotonicSponge
@HypotonicSponge 26 күн бұрын
Hell yea man. I learned the basics to python and I’m having a blast watching a pro in their flow state (still with head scratching). Not the advanced yet but soon.
@Sal.Almutairi_
@Sal.Almutairi_ 26 күн бұрын
Quick Tip: After planting pumpkins, check your farm for any dead plants. If you find any, replant them and save their locations. To quickly move to any point you need to check, use the Manhattan Distance algorithm. It’s super easy-just subtract your current position from the target position to find the distance.
@SolDizZo
@SolDizZo 27 күн бұрын
I started playing this on Steam Deck away from home after watching you and it was like putting ankle weights on. I got home and I was amazed at my progress and what I remembered from your code-- I basically brute-forced my way past pumpkins but man, I can't wait to see your solutions for the rest! I'm currently stuck in a maze...
@starwheels8648
@starwheels8648 26 күн бұрын
this game was my first introduction to coding and it took me 5ish hours of failure to get a working code for mazes
@SolDizZo
@SolDizZo 26 күн бұрын
@@starwheels8648 I remember spending 5 hours on a level in Shenzhen IO then deciding the game wasn't for me. So far I like how this game gives a bit more freedom and simultaneously has something very close to the real coding language it's based on.
@THYnameISsarcasm
@THYnameISsarcasm 27 күн бұрын
I use the top right quadrant of my farm for pumpkins and only harvest on the top right tile. It's not 100% efficient but it does often give my pumpkins a chance to merge more often than not. I'm not sure if it's more efficient to wait for a mega pumpkin or to just harvest every pass but I like it enough for now
@OlexaYT
@OlexaYT 27 күн бұрын
I think that’s definitely an approach. I kinda like the all or nothing more so I can specialize quickly in certain crops but it’s clear there’s many routes to success!
@THYnameISsarcasm
@THYnameISsarcasm 27 күн бұрын
@@OlexaYT With the ability to clear the grid so quickly, why choose anyways? 😂 I should build out more specialized functions for targeted upgrades, I've just been farming everything at once in the background while I read on my other screen
@braam828
@braam828 2 күн бұрын
Most efficient way I got my pumpkins to work is just deleting the for loops, make it so it moves north every time it loops and every time the y = 0 move east Then just reset the checks to 0 when you plant a pumpkin and adding 1 to it every time a pumpkin is harvestable. This way it doesn’t have to check if it’s a big pumpkin separately.
@matyaszdralek6774
@matyaszdralek6774 27 күн бұрын
interesting thing with the giant pumpkin method of farming is that at the grid size 4x4 and smaller it is actualy slower than just harvesting while on the max size it becomes close to 3 times as efficient as the regular method
@MrSongib
@MrSongib 26 күн бұрын
Love the series and the dev needs to do something with the sound effects. Make it specific type of sound when do some specific action. my brain go nuts atm. xd
@EmmaJasper-bk7kh
@EmmaJasper-bk7kh 26 күн бұрын
Father olexa has blessed us once again with a banger video 🙏
@tarax6626
@tarax6626 27 күн бұрын
I was just finishing the last "episode" of this game and this drops.. Just perfect
@KCopperr
@KCopperr 27 күн бұрын
Literally same!
@williamwolfe962
@williamwolfe962 27 күн бұрын
I think the only way to be more efficient with the pumpkin is for the drone to know what square it is on, (I think it does from you printing indexes somehow in the first video?), and to implement some sort of pathfinding function you can give coordinates to. Then when you get lists, you record the coordinates where you plant and check only those squares to make sure they lived this time.
@matirion
@matirion 26 күн бұрын
You can do a lot of shenanigans, including creating a pseudo array with just math to store growth state. Or use a binary flag. Add 2X-1 to the stored value if you can harvest, where X is the grids position, and then check if it's the maximum it can be for the grid size, and if so harvest.
@omechron
@omechron 26 күн бұрын
I'm typing this comment before I see what you do. What I did with my pumpkins is I made a variable and incremented it every time the drone moves, then reset it every time the drone plants a pumpkin. Then I set it to harvest when that variable equals the number of tiles in my farm. This way, the drone checks every square to make sure it has a pumpkin in it so I get a perfect mega pumpkin every time. It's not that efficient though since once the mega pumpkin is complete, the drone has to do a complete flyover of the entire farm doing nothing before it harvests. So we'll see if you come up with something less wasteful. Edit 1: Making it calculate the grid size instead of just putting 16 is a great idea. This way it automatically scales up when you enlarge the farm. Edit 2: I don't understand the advantage of making a trade function. I have been simply using trade(Items.Whatever_Seed) directly before planting Edit 3: Yeah, you're pretty much doing what I did until you have lists and dictionaries which I don't know how to use, so I'm looking forward to the next couple of episodes.
@camillemale
@camillemale 25 күн бұрын
Same solution here, and same frustration for the last big pumpkin scan 😄
@danielrhouck
@danielrhouck 7 күн бұрын
1:16 Since youʼre leaving the non-tree blocks fallow here, you donʼt need to water them. (I plant bushes there in the equivalent place in my code, on the assumption that if I want wood Iʼll want it from the trees and bushes. For that, water does help.) Edit: Oops. I guess thatʼs what I get for not waiting ten more seconds before commenting.
@johnsearing9128
@johnsearing9128 26 күн бұрын
Finally caught up to where you are in the game. I’ve fully automated grass, wood, and carrots. Pumpkins are on the docket for today so I can make it truly AFK until cacti. (Currently over 1M grass, wood, carrots)
@helicoidcyme
@helicoidcyme 27 күн бұрын
you were discussing theoretically using lists once you get them, and i think the only missing piece from what you described was marking them as pumpkins in the data structure when they return true on can_harvest instead of when you first plant them. of course at that point theres room to develop a function to determine the shortest path to an arbitrary coordinate in order to streamline the replants, but who wants to do that >:3c
@satibel
@satibel 26 күн бұрын
the way to minimize the search is to have a subset instead of the full grid, so if a line is full, you can skip it, but you have to basically unroll your inner loop, so it's very ugly without lists.
@marceelino
@marceelino 27 күн бұрын
Lovely game. Got to watch you based on this game recommendation.
@markusjansson011
@markusjansson011 26 күн бұрын
Honestly love this lol Love coding And maybe an idea if you could check lane by lane so some how get the total scale of area Check harvesteble pumkins in one lane if harvest = total lane size "or i gues totaled check area cus lanes could be added up move to next lane, Tho you would need some kind of lane counter btw love the video! xD keep it up
@Givs12
@Givs12 27 күн бұрын
Damn Olexa, bought the game, ahead of you now but still loving the content.
@baconpork342
@baconpork342 27 күн бұрын
I'm interested in seeing you handle sunflower. I wasn't proud of my first script, but I think my current script is decent. Interested to see your approach.
@codewonderland-gaming
@codewonderland-gaming 27 күн бұрын
I bought the game because of your playthrough! Made it to 83 in the world leaderboard 😊
@Mr_Ebuh
@Mr_Ebuh 26 күн бұрын
I did more coding yesterday in this game then in my entire school year of software development
@OBCOR
@OBCOR 27 күн бұрын
I can't believe you missed the opportunity to give this game an A++ score.
@Puinfa
@Puinfa 27 күн бұрын
Keep it up olexa 💪💪💪💪
@DerSolinski
@DerSolinski 27 күн бұрын
You can not do classes, but closures do work. Generally recursions work great.
@helioke
@helioke 27 күн бұрын
None of this is complicated, but I love to watch it. I just don’t know why… But that doesn’t matter, just watchin‘ and enjoying
@evinroen6401
@evinroen6401 26 күн бұрын
I would love to see you play bitburner! Pros: Another code-based game Cons: It's in javascript
@OlexaYT
@OlexaYT 26 күн бұрын
JavaScript 🤮
@codesymphony
@codesymphony 24 күн бұрын
for the pumpkins i did a first pass where i would plant and water every spot, then on the second pass around i would stay in each empty spot and replant until it was fully grown before moving onto the next spot. seemed way more efficient then sweeping the entire grid every time even if there is just one empty spot left
@OlexaYT
@OlexaYT 24 күн бұрын
I think it’s less efficient because there’s a LOT of dead time waiting
@codesymphony
@codesymphony 24 күн бұрын
@@OlexaYT possibly but imagine you have a big board. you are doing a full cycle every single time there is a failed check. your goto solution still has to be the best tho
@OlexaYT
@OlexaYT 24 күн бұрын
Beauty of code, lotta solutions for something!
@andrewsanders17
@andrewsanders17 27 күн бұрын
35:22 I see a couple issues eith the code. First is that if the world size increases over carrot max. Second is if carrots requirement is met or the wood requirement is finished half way then your losing by over planting.
@OlexaYT
@OlexaYT 27 күн бұрын
Definitely an issue for both, it’s just something I’m not too concerned about. It’s an extremely minimal concern in the long run
@PizzaBeeDude
@PizzaBeeDude 27 күн бұрын
Yay more code!
@MindCaged
@MindCaged 27 күн бұрын
I just got this game the other day and I've done pretty much everything but companion planting(not sure if this is even worth it), cactus, dinos, and resetting. I was actually working on optimizing some of my code for pumpkins and sunflowers. I'm not looking forward too much to cactuses as I imagine it'll take many passes, unless I limit the area. Basically it requires writing a sorting algorithm but it's got to sort it in real time(like you actually see every swap) and in 2 dimensions. Not even sure what the dinos involve, I saw something about their being different types? Edit: Okay, I just coded Polyculture and I will say it's good for boosting a single crop if you want a lot, it does give you a 10 times increase if you can plant the companion crop, which you can't really do for /every/ crop so it's not a perfect multiplier but I did get like a ton of hay in a short amount of time.
@King_Mahon
@King_Mahon 26 күн бұрын
Just so you know, if Entities.Grass is ever the limiting factor for purchasing carrot seeds, you are creating an infinite recursive loop since your “while not trade_req…” check is not nested inside of an if statement first verifying that the active crop is carrots. If the crop was grass, the check would still be made, still fail, and you would never be able to actually plant carrots. Love these videos, makes me want to try this game out myself.
@OlexaYT
@OlexaYT 26 күн бұрын
Yup, it’s a good catch. It’s fixed in next epi bc I redid that function
@christianloizou4463
@christianloizou4463 27 күн бұрын
Please more of this 🎉
@josephfolkemer
@josephfolkemer 25 күн бұрын
if( water/(water+empty) > percent ): water() This way you’re always watering at the equilibrium point when water-in = water-out, or in other words: precisely as much watering as you can sustain.
@houmamkitet9555
@houmamkitet9555 25 күн бұрын
I am smashing my head against the maze one i hope you will continue playing untill you reach that I did my pumpkin in a similar fashion but yours is way better and cleaner I really have no idea how to use alot of the functions available so i end up brute forcing stuff
@SirHackaL0t.
@SirHackaL0t. 9 күн бұрын
I’d love to have this on the iPad. I rarely use my PC these days.
@thedormantinformant3216
@thedormantinformant3216 27 күн бұрын
Frankly, I love this, my brain go brr, from working code satisfaction.
@tuqann
@tuqann 27 күн бұрын
while true: move_to(check_min(grid)); if (not can_harvest()): plant(pumpkin) else: harvest(); plant(); updateTile(grid) idea is move to first potentially empty tile, if you cannot harvest then plant. you need to use a list of tuple to represent a 2d grid, and use min(grid) to get the first tile that's not harvestable. same logic applies to Sunflower, except pumpkin value range is zero or one, and the Sunflower is zero to 16, also you use max(grid) function for finding the sunflower to harvest as opposed to finding the empty soil to plant a pumpkin using min(grid)
@thedouchebagofholding980
@thedouchebagofholding980 24 күн бұрын
So satisfying
@aizenmd5705
@aizenmd5705 27 күн бұрын
Just finished episode 2, will continue tomorrow :)
@Hawkeye021
@Hawkeye021 24 күн бұрын
28:42 "quick and dirty episode" *looks at runtime* 51:24 Oh no.
@Adalast
@Adalast 27 күн бұрын
In plant_trees() move the can_harvest() block out of the modulo since it does not depend on the results of the modulo.
@GhostZeroGZ
@GhostZeroGZ 26 күн бұрын
"If you're not lost here, I'm impressed" Nah, I was just thinking about how I'd nest each resource into the planting > harvesting loop and run it indefinitely
@josephle5373
@josephle5373 27 күн бұрын
what would in my opinion help your code is to not think of a n*x grid but a "wherever i am i can move n directions in all sides". and of course i dont know if this is a conscious decision to make it more understandable for your users, but for pumkins you can then think way like "as soon as i moved n*n times and i counted n*n harvestable pumpkins i am done" so whereever you counted the last pumpkin to have fully filled your field (hehe alliterations!) you can immediately harvest. wherever you stopped is your next starting pumpkin patch. also easier for trees in midst of other crops (think of you having a requirement of only needing 3 trees for your wood requirement, you dont want to start at 0x0, or 0x4, but at the first position you can currently plant a tree, then you want to save THIS position) this also then makes small pumpkins possible. hmmmmmmm what i didnt think about is that maybe a 3x3 mega-pumkin that goes "over an edge" doesn't merge together.... so maybe disregard the above for multi-cropping?
@OlexaYT
@OlexaYT 27 күн бұрын
Yeah the plantable grid is not wrapping even though the drone can wrap.
@ex2dxpi
@ex2dxpi 27 күн бұрын
Ok so I was thinking about how I would automatize every crop at once and I have an idea: So you would have a main function that holds a stack of crops, these crops would be popped from the stack and used as the arguments to a function that calls the function that plants each crop. These functions would clear the board, check for the requirements of the crops, and put stuff onto the stack if the requirements are running low, if they run out the function would push the requirements and return. Else continue execution untill you obtained some threshold (relative to the previous amount of resources you had). If the stack is ever emptied you push some arbitrary stuff onto the stack and continue execution like normal.
@OlexaYT
@OlexaYT 27 күн бұрын
I think you’re overcomplicating things haha
@ex2dxpi
@ex2dxpi 26 күн бұрын
@@OlexaYT most like yes
@ex2dxpi
@ex2dxpi 26 күн бұрын
@@OlexaYT most like yes
@spazisspaz6074
@spazisspaz6074 27 күн бұрын
Let's goo!!
@robertcotton8481
@robertcotton8481 27 күн бұрын
For code availability very reasonable way to do pumpkin
@glych002
@glych002 23 күн бұрын
When you plant the pumpkin, it looks like you could just plant twice before moving maybe with a delay
@joshuasteffanie947
@joshuasteffanie947 25 күн бұрын
by the way with a grid bigger then 4x4 it might be better to not use the bushes and only use the trees. You will still need to water them but you can also just water the spots where u plant the trees instead of planting on the entire grid if you place the water_me within the if can_harvest():. Atleast that's what i did and it seemed to give more wood then with the bushes yet not consume too much water.
@Chaotican362
@Chaotican362 27 күн бұрын
900 likes in 6 hours. Looks like you’re gonna be making another episode
@jdsims9064
@jdsims9064 24 күн бұрын
I wish I could download this game on Mac. Are there any like it on steam?
@glych002
@glych002 23 күн бұрын
I think that you have too many while loops, you need one main loop. Conditions in the main loop check all variables and call functions if true.
@pmangano
@pmangano 27 күн бұрын
The only way to make the pumpkin function more efficient would be to exclude fully grown pumpkins from future checks on second pass with a flag, which also means you would have to code pathing for the drone to only move between the tiles that were not excluded, that right there sounds like a fucking nightmare with a lot of math and maybe matrices.
@OlexaYT
@OlexaYT 27 күн бұрын
Yup, this is basically the only way. I have an idea but it’s super ugly haha. Might write it offline and show it to you guys next time
@electrowizard2000
@electrowizard2000 26 күн бұрын
I think a minX/maxX minY/maxY bounds narrowing would probably do it well enough, scanning smaller subsets of the farm.
@kamilrichert8446
@kamilrichert8446 27 күн бұрын
does this game support overloading functions?
@ingiford175
@ingiford175 26 күн бұрын
Instead of can_harvest call you can do a: if (get_entity_type() == None): to see what entity is below the drone, none means the seed died
@andrewsanders17
@andrewsanders17 27 күн бұрын
Should you not have it be empty tanks and filled tanks because your infinite loop doesnt take into account empty tanks converting into filled tanks. I understand it being a stand alone fuction there isn't a issue but if you try to modular your function.
@zulaaislynn
@zulaaislynn 27 күн бұрын
YAY!
@kin98100
@kin98100 20 күн бұрын
can you make the function recursive instead of a while loop till it hits the requirement. i like recursion :)
@weaselfranklin7478
@weaselfranklin7478 27 күн бұрын
I am not 100% sure whats going on but its looks dope
@youssefsaleh9220
@youssefsaleh9220 27 күн бұрын
LETS GOOOO
@bbittercoffee
@bbittercoffee 27 күн бұрын
12:33 the yield of a WHAT?!
@nsc_notncs
@nsc_notncs 27 күн бұрын
PLEASE DO MORE
@TheBalthassar
@TheBalthassar 25 күн бұрын
of course you managed to get a stack overflow
My Python-Automated Pumpkins are Now Efficient...
57:40
Olexa
Рет қаралды 31 М.
My New Favorite Idle Farming Game
47:27
Olexa
Рет қаралды 124 М.
ГДЕ ЖЕ ЭЛИ???🐾🐾🐾
00:35
Chapitosiki
Рет қаралды 6 МЛН
$10,000 Every Day You Survive In The Wilderness
26:44
MrBeast
Рет қаралды 132 МЛН
She ruined my dominos! 😭 Cool train tool helps me #gadget
00:40
Go Gizmo!
Рет қаралды 29 МЛН
Чай будешь? #чайбудешь
00:14
ПАРОДИИ НА ИЗВЕСТНЫЕ ТРЕКИ
Рет қаралды 2,9 МЛН
I was hired to automate farming...
24:17
Real Civil Engineer
Рет қаралды 229 М.
I DOMINATED this Unique Math Roguelike
32:59
Olexa
Рет қаралды 22 М.
King Of The Bridge - Indie Game Review
3:16
KyotoCrank
Рет қаралды 1,1 М.
I Made a Neural Network with just Redstone!
17:23
mattbatwings
Рет қаралды 546 М.
Sunflowers are my BEST Python-Automated Crop
34:57
Olexa
Рет қаралды 21 М.
Welp, It's Time for Solving a Maze with Python
57:35
Olexa
Рет қаралды 22 М.
This is the BEST Slot Machine Roguelike
32:15
Olexa
Рет қаралды 19 М.
Why Stardew Valley’s Creator Hated His Game
20:17
Nello
Рет қаралды 449 М.
They turned MATH into a factory game...
21:34
Real Civil Engineer
Рет қаралды 75 М.
ЗАХОТЕЛА В ТУАЛЕТ НА УРОКЕ в ROBLOX!
21:40
Family Play TV
Рет қаралды 478 М.
skibidi toilet - season 24 (all episodes)
25:14
DaFuq!?Boom!
Рет қаралды 16 МЛН