SHARE
TWEET

Lawn Mower Script Thoughts

Kirkq Dec 5th, 2019 (edited) 198 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Implement a bot that performs the entire search space and stores the complete map state after each move.
  2. I'd recommend doing this in C++, most other languages will have too much time overhead per operation.
  3.  
  4. A state consists of the following:
  5. 1: Position
  6. 2: Facing Direction
  7. 3: Next intended direction
  8. 4: Frame Count
  9. 5: Number of Tiles Mowed (Store number to reduce calculations)
  10. 6: Number of Non-lawn tiles mowed (Store number to reduce calculations)
  11. 7: Map State of Mowed Tiles
  12. 8: Fuel Count
  13. 9: (Probably more things I'm forgetting)
  14.  
  15. State[0] = Starting state
  16. State[1] = State after mowing first tile in some direction
  17. State[2] = State after mowing second tile in some arbitrary direction.
  18.  
  19. A: The bot will perform all iterations of 1: up, 2: left, 3: right, 4: down from the present tile.
  20. B: If the bot reaches a failure condition, it will reset the game state back one tile and go the next direction.  The state it attempted when it failed will be erased.
  21. - Failure conditions include:
  22. - Too many non-lawn tiles mowed
  23. - Out of fuel
  24. - Attempted all viable directions
  25. - Ran into edge of map
  26. - Exceeded predetermined maximum frame count. (Slower than we came up with for the level by hand.)
  27. - (Probably more things I'm forgetting)
  28. C: If the bot completes the level, output the history of each move.
  29.  
  30. The following needs simulated in between frames, to move from one frame to the next:
  31. 1: Pixel, Subpixel, Velocity
  32.  
  33. Notes:
  34. 1: If you turn, you lose your subpixels.
  35. 2: Max speed is 49, by letting go of A for one frame.
  36. 3: The costs in frames of moving a direction ends up being 5,4,4,4,5,4,4,4,5,4,4,4,4,5,...  Moving in sets of 4 ends up being mostly ideal to not spend a frame, but the 13th square also saves 1 frame.  Turning loses a potential frame a lot of the time.  The script should not contain these oversimplifications, this is just some known observations.
  37. 4: Truly simulating fuel spawns is the difficult part.  If the rest of the bot is written, this can probably be done last.  For now we might try manually placing the fuel can(s).
  38. 5: Drawing the output is computationally intensive, maybe it's fine as a debug option, but if it runs during the brute forcing, it will probably be too slow.
  39. 6: The computational search space has been narrowed down by imposing failure thresholds in order to hopefully reduce the search space to something achievable within a reasonable amount of time.  It's probably fast enough for early levels.  Later levels might take a lot longer.
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top