0
Someone That Can Help Me With That Please
the algorithm is called "minefield"
8 Respostas
+ 2
Where's your attempt?
0
What do you need help with?
0
I need to solve a problem with python, which basically consists of moving a robot from one place to another avoiding areas where there is dynamite and you can not leave the area that is delimited by rows and columns.
0
This is the problem
We are asked to check the path of a robot in a rectangular enclosure delimited by four walls, each of them oriented to one of the points cardinals (clockwise: N, E, S and O).
The robot is designed to move using a grid that covers the floor of the enclosure, so that you can advance in each step from a square to any of those that have a side in common with her. So, we can consider the space by which the robot divided into m rows can move (numbered from 1 to m, going from N to S) and n columns (numbered from 1 to n, going from O to E). The robot moves according to three different orders: "turn to the left" (I), "turn to the right" (D) and "advance" (A). The advance is made from square to square (one at a time), being able to only pass from the box in which the robot to each of the four (or less) that have a side in common with this.
0
At all times the robot is oriented directly towards one of the four sides of the box in which it is located (which we will distinguish naming them as the Cardinal points; that is, in a clockwise direction: N, E, S and O), and orders I and D they turn the robot 90Âș without advancing. In this way, if for example the robot has orientation N, with the order I, would be in the same box but with OR orientation (since the turn to the left corresponds to the counterclockwise rotation); and with order D would be oriented to the E (because the turn to the right is the one that is made in the schedule). The progress order is always applied in the orientation that you have in that moment the robot and it has to be taken into account that an attempt to advance against the limits of the enclosure would cause the destruction of the robot. The problem is that the space through which the robot has to move is mined, so that if the robot steps on one of the squares that has a mine it will be destroyed.
0
The same thing happens if the robot crashes against any of the walls of the enclosure upon receiving an incorrect progress order, as we have already saying.
The programmers of the robot are responsible for generating the sequence of orders that they would get him from his initial position to a destination. Our responsibility is that of supervise this proposed sequence and ensure that the solution that we proposed by the programmers is correct and does not pose any danger to the Robot integrity.
objective
It is about checking that a certain sequence of orders displaces the robot inside the enclosure without it being destroyed.
0
Entry
The program data are in a list composed of a series of Elements that correspond to:
The first item in the list is a string that contains the number of rows (m) andcolumns (n) of the enclosure separated by a blank space. You can assume that 1 <= m <100 and 1 <= n <100 is met.
The following m elements (from 2 to m + 1) are string and each one of them they contain the information of a row of the enclosure. Specifically the elements will have n zeros or ones. A 0 corresponds to a box that can be stepped on withou danger and a 1 corresponds to a mined box.
The next element (m + 2) corresponds to a string that contains the coordinates (i1, j1), 1 <= i1 <= m, 1 <= j1 <= n, of the robot's initial position, separated by a blank space.
The next element (m + 3) corresponds to a string that ontains the coordinates (i2, j2), 1 <= i1 <= m, 1 <= j1 <= n, of the destination of the robot, separated with a blank space.
The next element (the m + 4) is a string that contains a single letter indicating the initial orienta
0
my Idea is to be able to take coordinates to the positions where the dynamites are located so at the moment of realizing the movements compare them with those and see if it is in a dynamite or out of range (in such a way it would be destroyed) or at its point of arrival