Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exercise 2: Treasure hunt #63

Open
oyvindeide opened this issue Sep 8, 2023 · 0 comments
Open

Exercise 2: Treasure hunt #63

oyvindeide opened this issue Sep 8, 2023 · 0 comments

Comments

@oyvindeide
Copy link
Collaborator

oyvindeide commented Sep 8, 2023

You are an intrepid explorer, navigating a scenery of rolling hills at night. It is completely dark, and your only source of information is your handheld computer which will give you the next point on your journey. You have heard that there exists a treasure here, and your only clue is that the treasure is located in an incline where the slope between your current position and the next coordinate is above X. Your task is to navigate this landscape and locate the coordinates of the treasure. Example:

Given a list of coordinates (your test input) (x, y):

 [(1, 1), (2.0, 1.8), (2.5, 2.1), (3, 2), (4.3, 7.2), (5.3, 6.2)]

we can calculate the slope along the coordinates:

[0.8, 0.6, -0.2, 4.0, -1.0]  # be wary of rounding of these numbers

given a threshold of 1, the coordinate we are looking for is: (4.3, 7.2)

Your task in image form:

image

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

No branches or pull requests

1 participant