The Farmer Was Replaced

The Farmer Was Replaced

Dinosaur Code
I was reading some of the discussion pages mentioning dinosaurs and I noticed that there weren't many (if any) codes provided for open-source use. Not only that, but this game has updated several times, meaning that the code language changes as well (and I also hear that the puzzles have changed over the ~year.

I am BY NO MEANS a coding wiz. BUT the below-listed code is working for me to get a "max length" tail and keep going automatically after harvesting said tail.

**I KNOW THE CODE HAS REDUNDANT "IF" STATEMENTS, I AM USING THOSE AS FAILSAFES**

def home(): while get_pos_x() != 0: move(West) while get_pos_y() != 0: move(South) def back(): change_hat(Hats.Straw_Hat) home() change_hat(Hats.Dinosaur_Hat) dino() def mn(): if move(North) == False: if move(North) == False: if move(North) == False: back() def me(): if move(East) == False: if move(East) == False: if move(East) == False: back() def ms(): if move(South) == False: if move(South) == False: if move(South) == False: back() def mw(): if move(West) == False: if move(West) == False: if move(West) == False: back() def dino(): while True: #1 for i in range(5): mn() #2 for i in range(5): me() ms() #3 for i in range(4): mw() ms() #4 for i in range(4): me() ms() #5 for i in range(4): mw() ms() #6 for i in range(4): me() ms() #7 for i in range(5): mw() set_world_size(6) change_hat(Hats.Straw_Hat) home() change_hat(Hats.Dinosaur_Hat) while True: dino()
Last edited by dBlueFalcon; 27 Jan @ 8:01pm
< >
Showing 1-1 of 1 comments
owenz 28 Jan @ 2:40am 
TLDR: Go for the 16 length snake if starting and skip the final tier reward as the 16 length snake is good enough for a beginner to easily solve.

So, the new dino is a very interesting beast.

From the docs it is stated that it takes 800 ticks with an ever decreasing amount of 3% per added tail length(picked up apple). And it is unlikely that getting all 100 gives a 300% reduction it is safe to assume that it goes something like

1. 800 - (800 * 0.03) = 776
2. 776 - (776 * 0.03) = 752.72
3. 752 - (752 * 0.03) = 729.35
4. ect

This means the following,
That if the max ticks will always be (x - 1) * current_tick_cost
The min will always be current_tick_cost

Thus, if a perfect game where only one move is required we can get the total tick cost at around 24,286 with a max of 178,243,263 ticks. The max game is the exhaustive game where each space is visited once.

That being said, this means that each bone at max length of 100 gives us 178,243,263/10,000 or 17,824 ticks per bone.

Next, lets do a thought experiment where we are only trying to achieve the next highest total which is a length of 16 for 256 bones.

A few thoughts, as we will only ever get to a length of 16 at most we can employ a different strategy to get to the apple.

Strategy:
1. Measure each apple to get the next location.
2. Store the current length and positions of the snake
3. Pre-calculate the route
4. Execute the pre-calculated route

We will take a hit from storing and calculate the route but as it will only ever be at most the board length plus around 50% of the board length it will all us to calculate the maximum ticks taken by the movement.

Using the same method to get the results from example 1 we get 1,407,255 ticks max to get 256 bones or 1,407,255/256 = 5,497 ticks per bone.

As can be seen, it is roughly 3 times better than the first example of an exhaustive move algorithm. So if a player could come up with a method to always achieve full board coverage with minimum wastage of movement (solved already as snake is super old, just look it up. fun to implement) then you would handily beat the snot outta the second example.

If the minimum number of traversals is equal to the Max(10, length_of_snake-1) then the total cost would be 47,749,185 or 47,749,185/10,000 = 4,774 ticks per bone.

What this means is that you can basically cheese this challenge by going the lower difficulty mode to get started and when you want to maximize your profits you can go for the solved snake code, which is magnitudes more difficult to solve without help.
< >
Showing 1-1 of 1 comments
Per page: 1530 50