Ore In The Desert Ore In The Desert
Challenging
RU English

During their adventure, the Robo-trio came across a desert, and the ships sensors have registered ore in the region. The desert has a size of 10x10 cells and can be represented as a 2D array. The ship has four probes which can be used to help us find the ore. At each step you will need to return the coordinates of a cell (as [row, column]) for the probe to travel to. If the cell contains ore, then you can finish; else the probe will give a distance to the location of the ore cell (it will be the Euclidean distance between cells' centers). The perception of probe is not very good and it will give you a result rounded to the closest integer (1.41 ≈ 1; 2.83 ≈ 3). At each step you receive information from the previous probes as a list of list. Each list will be in the following format: [row, column, distance]. At the beginning of the mission, you will only receive an empty list.

ore-in-the-desert ore-in-the-desert

Input: Information of the previous probes as a list of lists. Each list contains three integers.

Output: The coordinate of the next probe as a list of two integers.

Example:

checkio([])
checkio([[5, 3, 4]])
checkio([[5, 3, 4], [2, 9, 3]])

How it is used: This task illustrates trilateration. Trilateration is the process of determining absolute or relative locations of points by measurement of distances, using the geometry of circles, spheres or triangles. In addition to being an interesting geometric problem, trilateration does have practical applications in surveying and navigation and is an important part of the equations making global positioning systems (GPS) possible.

Precondition:
len(desert) == 10
all(len(row) == 10 for row in desert)
There is always exist an ore cell in the desert.

Settings
Code:
CheckiO Extensions

CheckiO Extensions allow you to use local files to solve missions. More info in a blog post.

In order to install CheckiO client you'll need installed Python (version at least 3.8)

Install CheckiO Client first:

pip3 install checkio_client

Configure your tool

checkio --domain=py config --key=

Sync solutions into your local folder

checkio sync

(in beta testing) Launch local server so your browser can use it and sync solution between local file end extension on the fly. (doesn't work for safari)

checkio serv -d

Alternatevly, you can install Chrome extension or FF addon

checkio install-plugin
checkio install-plugin --ff
checkio install-plugin --chromium

Read more here about other functionality that the checkio client provides. Feel free to submit an issue in case of any difficulties.

×
 
 
<< <
> >>
exec

Whats Next?

Free accounts will see Best CheckiO solutions with some delay.
Best Solutions will be opened in
Become Awesome and Don't wait
The next stage is ""
Will be activated in
View More Solutions Random Review Solutions Share your own solution
Go to the next mission Back to the list of missions Back to the map