0
I need someone to help me with an algorithm , please!
7 Answers
+ 1
And please specify the language too
+ 1
I am favorable to python, so i will be using it with that.
I recommend having a loop with a photonâs coordinates (integers) along with its dx and dy values (can only be +-1 or zero each), and incrementing its position by its velocity before checking if its current position is a mirror and adjusting the velocity appropriately.
Assuming the âtableâ is a multi-line ascii string, i will work on code.
+ 1
This code will take the laser starting point (a tuple), a starting velocity (a capitalized one-character string of one of the compass points N, S, E, W), and a table (a multi-line string with 0s 1s and 2s with the specified meanings), and return a boolean. The coordinates start at the top left of the table, which is 0, 0. False will be returned if the laser goes back over the point where it started from heading in the same direction it started with, thus going around in circles. I have not fully tested this code yetâŚ
https://code.sololearn.com/cR6uLn5PVce0/?ref=app
+ 1
Thank you so much Wilbur Jaywright
0
â¤â˘â đđ˘đ˘đđ¨ đđĄđđ˛đđĽ ââ˘â¤
A laser cross a rectangular grid (table) that contains many mirrors. The objectif of the algorithm is to define if the laser will exit from the grid or not .
The table contain 'L' lines and 'C' columns, each one of the cases of the table will get one of these values : 0, 1 or 2
0 : blank case
1 : mirror oriented \
2 : mirror oriented /
The mirror has an reflection of 45 degrees
Please I need to define these cases , can you help me ?!
0
Atul it's just algorithm , there is no specific language