Skip to content

Exercise 2: Treasure hunt #63

@oyvindeide

Description

@oyvindeide

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions