Real Software Engineer Creates Automated Farm

Поделиться
HTML-код
  • Опубликовано: 22 ноя 2024

Комментарии • 39

  • @РуменИвановАндреев
    @РуменИвановАндреев 2 месяца назад +38

    If you're falling behind on wood you can plant bushes in between the treas, it wont slow down the growth

  • @ar_chbtw
    @ar_chbtw 2 месяца назад +30

    trees can be planted in a checkerboard im pretty sure so instead of x even and y even you do x+y even

    • @jack.hodkinson
      @jack.hodkinson  2 месяца назад +10

      This is HUGE! Thank you for the info

    • @MorningNapalm
      @MorningNapalm 2 месяца назад

      Yeah, I use get_pos_x() % 2 == get_pos_y() % 2.

    • @terrylake5966
      @terrylake5966 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?

    • @ar_chbtw
      @ar_chbtw 2 месяца назад +1

      @@terrylake5966 why are you asking this as an answer to my comment

  • @ilirx1509
    @ilirx1509 2 месяца назад +5

    Can’t wait for the next episode, this game is so interesting to watch. Each play through is completely unique to the devs mindset

  • @deadbody408
    @deadbody408 2 месяца назад +2

    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

  • @asseenontv247
    @asseenontv247 2 месяца назад +1

    Keep these coming! I would love a full playthrough!

  • @RonPare
    @RonPare 2 месяца назад +1

    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
      @jack.hodkinson  2 месяца назад +2

      Thank you, I'm glad you're getting something out of it!

    • @RonPare
      @RonPare 2 месяца назад

      @@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.

  • @HannesMrg
    @HannesMrg 2 месяца назад +1

    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".

    • @jack.hodkinson
      @jack.hodkinson  2 месяца назад

      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.

  • @StewPedassle
    @StewPedassle 2 месяца назад +6

    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.

  • @zakbenson5508
    @zakbenson5508 2 месяца назад +1

    I'm fiending for part 3!

  • @toshii2198
    @toshii2198 2 месяца назад +4

    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

    • @keejay98195
      @keejay98195 2 месяца назад

      or just use the int of the position to directly move to the origin

  • @Kunteki
    @Kunteki 2 месяца назад +2

    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 :)

    • @Kunteki
      @Kunteki 2 месяца назад

      ... and just looked at the coments further down sugesting what i just wrote, but without the code sample..... doh!!

    • @MorningNapalm
      @MorningNapalm 2 месяца назад +1

      elif

  • @ecjb1969
    @ecjb1969 2 месяца назад +4

    For the trees, if x % 2 == y % 2 should work better giving you a checkerboard grid.

    • @Koroistro
      @Koroistro 2 месяца назад +1

      (x+y)%2 == 0 also works well

    • @ecjb1969
      @ecjb1969 2 месяца назад

      @@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.

  • @PierreDole
    @PierreDole 2 месяца назад +1

    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.

  • @adamrowell1588
    @adamrowell1588 2 месяца назад

    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

  • @Drizzt405
    @Drizzt405 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)

  • @keejay98195
    @keejay98195 2 месяца назад

    13:25 you noticed there is an inbuilt get_ground_type so you rename your custom function instead of using the inbuilt one? 😅

    • @jack.hodkinson
      @jack.hodkinson  2 месяца назад

      They do different things - the inbuilt one gets the ground type currently underneath the drone

    • @keejay98195
      @keejay98195 2 месяца назад

      @@jack.hodkinson ahhh thank you! i was confused about that. great series 🙏🏼

    • @jack.hodkinson
      @jack.hodkinson  2 месяца назад

      @@keejay98195 Thank you!

  • @terrylake5966
    @terrylake5966 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?

    • @jack.hodkinson
      @jack.hodkinson  2 месяца назад

      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.

  • @EmM-ko7mu
    @EmM-ko7mu 2 месяца назад

    i gave up on the maze its just not possible for me without cheating or doing random movements

    • @hedgehogsch.7270
      @hedgehogsch.7270 2 месяца назад +1

      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"

    • @billy65bob
      @billy65bob 2 месяца назад

      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.