# Boreholes **by [Matt Hall](https://github.com/kwinkunks)** You have a list of boreholes. Each one has an (x, y) location. The locations are given as a Python string, and look like this: ..., (12.1, 34.3), (56.5, 78.7), (90.9, 12.1),... Your data, when you receive it, will be longer than this. We're going to analyse these locations. We need the answers to the following questions: 1. How many boreholes are there? We'll call this number _n_. 2. What's the distance, **to the nearest metre** between the first two boreholes in the list? 3. What is the mean straight-line distance between all pairs of boreholes **to the nearest metre**? Call this _m_. 4. There is a clump of boreholes. How many boreholes are in the clump? (A borehole is defined to be in a clump if the mean distance to its nearest _n_ / 5 neighbours is _m_ / 4 or less.) Please note that all your answers must be integers. If you get a float for an answer, round it. ## Example Here are the locations of some boreholes: (1, 4), (5, 4), (9, 3), (2, 8), (6, 4), (9, 9), (5, 5), (4, 3), (4, 5), (2, 1) If we plot them, they look like this: y ^ 9 - - - - - - - - - 0 8 - - 0 - - - - - - - 7 - - - - - - - - - - 6 - - - - - - - - - - 5 - - - - 0 0 - - - - 4 - 0 - - - 0 0 - - - 3 - - - - 0 - - - - 0 2 - - - - - - - - - - 1 - - 0 - - - - - - - 0 - - - - - - - - - - 0 1 2 3 4 5 6 7 8 9 > x Here's how we'd answer the questions for this small dataset: - In this example, there are **10** wells (marked `0` on the plot above). - The distance between the first two boreholes in the list, (1, 4) and (5, 4), is **4**. - The mean distance between boreholes is 4.58... which to the nearest metre is **5**. - There are **4** wells in the clump. See below. Wells in the clump are marked `X` here (the borehole marked `O` does not meet the criterion): y ^ 9 - - - - - - - - - 0 8 - - 0 - - - - - - - 7 - - - - - - - - - - 6 - - - - - - - - - - 5 - - - - X X - - - - 4 - 0 - - - X X - - - 3 - - - - O - - - - 0 2 - - - - - - - - - - 1 - - 0 - - - - - - - 0 - - - - - - - - - - 0 1 2 3 4 5 6 7 8 9 > x ## A quick reminder how this works This document is formatted in [Markdown](https://daringfireball.net/projects/markdown/). You can retrieve your data, which is always a string, by choosing a **``** (also a string). This ensures that you have different data from other people, so be creative. ``` url = 'https://kata.scienxlab.org/challenge/boreholes' params = { 'key': # Replace with your own string. } r = requests.get(url, params) r.text ``` To answer question 1, change the `params`: ``` params = { 'key': , # Use the same key you used to get your input. 'question': 1, 'answer': 1234 # Your answer; can be a float, int, list or array; # the challenge description will tell you which. } ``` To get a hint for a question, provide the question number but no answer: ``` params = { 'question': 1, } ``` [Complete instructions at kata.scienxlab.org](https://kata.scienxlab.org/challenge) [An example notebook to get you started](https://gist.github.com/kwinkunks/50f11dac6ab7ff8c3e6c7b34536501a2) ---- © 2024 [Scienxlab](https://scienxlab.org/) — Code: openly licensed under [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0) — Text: openly licensed under [CC BY](https://creativecommons.org/licenses/by/4.0/).