Skip to content

Conversation

truggeri
Copy link
Owner

Summary

The solution for this took a number of iterations, but finally breaks down as follows,

  1. Collect all the like crops - that is those that have the same character on the input map
  2. Iterate through each point in the crop and assign them into unique plots - those that are contiguous on the map
  3. Add all the fences around the point, except one that is shared with another point - this means the fence is not needed
  4. Iterate over plots and fence positions used to calculate each plots area and perimeter
  5. Use each area and perimeter to determine the total cost.

@truggeri truggeri self-assigned this Dec 26, 2024
@truggeri truggeri merged commit e006ac4 into main Dec 26, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant