Rihatsu
Rihatsu
  • Видео 1
  • Просмотров 18 048
The Farmer Was Replaced - Fully Automated Reset - No Code Spoilers
The Farmer Was Replaced is a game where you program a drone to run a farm for you. This is a video of my solution.
Просмотров: 18 056

Видео

Комментарии

  • @TheDawnOfTheCreeper
    @TheDawnOfTheCreeper Месяц назад

    Quick question why not just continue to move off the edge instead of going all the way back to the start of a row/column?

    • @rihatsu
      @rihatsu Месяц назад

      It's been a minute since I wrote all this but I'm pretty sure it does use the automatic position looping when appropriate for the algorithm it's running. The more dynamic algorithms only move within the defined world because I didn't want to deal with figuring out the best way to move to a target square; just go left or right until you're in the right column and then go up or down until you've arrived. 😅

  • @BrostroTheWizard
    @BrostroTheWizard Месяц назад

    Very impressive dude!

  • @webkinskid
    @webkinskid 3 месяца назад

    mmm, love a visible algorithm, so satisfying to watch it work

  • @brgenilsen623
    @brgenilsen623 3 месяца назад

    awsome farm, my mind was locked into farming full fields. i tryed this layout and only farming giga pumpkings, much more efficient, and my farm looks much better. pluss i got an programmers eureka moment, when i had to look into moving the drone to specific locations.

  • @alanschlieper
    @alanschlieper 4 месяца назад

    Can you please share the code you used to automate getting the treasure from the hedge maze. Just cannot seem to figure out how to code this.

    • @rihatsu
      @rihatsu 4 месяца назад

      It took me a bit to figure out too. I assume you're familiar with the idea of the left / right hand rule for solving a maze. I implemented the right hand rule by storing a value (0-3) to keep track of what direction my drone was "facing" while it was exploring the maze. Whenever the drone moves in a direction, it remembers that direction. For it's next move it first tries to move to the right, if that fails it tries to move forward, if that fails it tries to move left, and if that fails it moves back to the square it just came from. In each case, whatever square it enters next, it checks if it has found the treasure and updates the value for what direction it is facing to match whatever the move was, and then does the same thing again: move right or straight or left, and it just loops like that until it finds the treasure.

    • @matilozano96
      @matilozano96 4 месяца назад

      I did mine by implementing a Depth-First-Search of sorts. Look at the problem like nodes of a tree. You start in a position, and you can branch into any of the 4 directions. You eliminate possibilities by exploring those 4 directions, then you go through them until you either hit a dead end or find the treasure. The key hereis that the function at some point will have to call itself. This is called recursion. You define the directions you can go, then you choose one at random, move there and create a call to the function. Once the function resolves, it will either tell you the treasure was found or not. If it was found, exit and harvest. If it wasn't, keep exploring. Once you're out of options to explore from your current position, return false, so that the parent function knows this position is a no-go. Here's the code, if you want to take a look: def oppCord(coord): if coord == North: return South if coord == East: return West if coord == South: return North if coord == West: return East def SolveMaze(origin): canGo = [] coords = [North, East, South, West] if origin != None: coords.remove(origin) if get_entity_type() == Entities.Treasure: return True for i in range(len(coords)): if coords[i] != origin: canGo.append(coords[i]) for i in range(len(canGo)): solved = False if (move(canGo[i])): solved = SolveMaze(oppCord(canGo[i])) if solved: return True move(origin) return False Doing mazes in succession removes walls, which opens up the possibility to find loops within the maze. To avoid this, you'll need a list of visited positions, so that you don't repeat them. You also get the position of the next treasure, so this opens up further optimizations and other algorithms.

  • @Linuxdirk
    @Linuxdirk 4 месяца назад

    This is some impressive farming given the fact that you only have two coordinates and the information about the currently hovered part of the farmland to work with.

    • @BrostroTheWizard
      @BrostroTheWizard Месяц назад

      you can use measure(Dir) to check the entity next to you in the chosen direction for sunflowers dinos and cacti.

    • @lukamiler5824
      @lukamiler5824 Месяц назад

      There's actually lots of data you have available. Including prices of upgrades, current inventory amounts, automatic upgrading and such. It isn't as cavemanish as you make it out to be.

  • @saadharta8057
    @saadharta8057 4 месяца назад

    For the sunflower part: it is possible to do the measure() as the next instruction after planting.

    • @danielrhouck
      @danielrhouck 3 месяца назад

      It is *now.* The game has clearly changed a lot since this video (cactus and dinosaur exist now, for example) and I donʼt know if it was then.

  • @salkincan7508
    @salkincan7508 4 месяца назад

    when new video?

  • @rucola007
    @rucola007 4 месяца назад

    Would you mind sharing your Code? Looks amazing!

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

      what is the point in looking at other people doing what you should have done?

    • @BrostroTheWizard
      @BrostroTheWizard Месяц назад

      ​@@NickMaovich That’s how humanity works, dude. We stand on the shoulders of those who learned before us. What you have said is equivalent to someone saying, “Why look at other scientific experiments? You should only do your own.” We are pack animals, and we pool our knowledge together. Peer review is an important thing; perhaps they want to see the code so they can understand it better and possibly incorporate some of the methods into their own code. Yes, some people copy and paste, but I have learned a lot from just reading other people’s work and seeing the solutions they come up with. This helps me when I face similar problems later.

    • @sky0kast0
      @sky0kast0 Месяц назад

      Quite true

  • @fatmike5038
    @fatmike5038 11 месяцев назад

    Nice Job

  • @rileymeggison326
    @rileymeggison326 Год назад

    Have you played since the leaderboard update? I would like to see how your algorithm outpaces mine XD

    • @rihatsu
      @rihatsu Год назад

      I just tried this out and unfortunately discovered that my algorithm depends on having piggies to advance past a 4x4 farm. I'll need to add some more code to be a bit smarter about what it's growing, rather than just planting things in roughly correct ratios.

    • @rihatsu
      @rihatsu Год назад

      Total Time: 4 hours, 21 minutes. Global Rank #9, but that also appears to be last on the leaderboard. It seems that perhaps I could improve some things to make it more efficient.