Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Toroidal Rolling Problem Submissions Leaderboard Discussions In a certain video game, the screen is square of a given size, s , measured in pixels. The
Toroidal Rolling Problem Submissions Leaderboard Discussions In a certain video game, the screen is square of a given size, s measured in pixels. The and ycoordinates go from to Boulders are rolling across the screen, and the player must avoid being hit by them. When a boulder rolls off one edge of the screen, it appears at the opposite edge of the screen, preserving the other coordinate. For example, if s and a boulder on the middle of the right edge of the screen, at coordinate moves to the right, it would reappear at coordinates ie in the middle on the left edge of the screen The screen is essentially the surface of a torus doughnut shape where you can imagine the right side has been joined to the left side, and the top of the screen to the bottom. The rolling boulders are simulated by updating their x y coordinates in discrete steps. Each rolling boulder is considered to move along a trajectory defined by a sequence of discrete points: yo yLi Yi It moves along a straight line joining consecutive points in the sequence. The trajectory of a rolling boulder is parameterised by two integers a and b so that Xi Yi is given by: Xi aci Yi Yi x; byi If either coordinate returned by the calculation is either negative or larger than s then it is considered to wrap around to the other side of the screen, and carry on counting. For example, if s then the coordinate would correspond to the point at and the coordinate would correspond to the coordinate Given the parameters a b and s which govern all of the boulders on the screen at the same time you are asked to determine the result of each of a queries. Each query is of the form x y n and is asking for the current position of a boulder that would have started at position x y and taken n update steps. Input Format Line : a b s Line : Each of the following a lines is of the format: x yn Constraints Constraints The code provided is not even for this question, could you help?
Toroidal Rolling Problem Submissions Leaderboard Discussions In a certain video game, the screen is square of a given size, s measured in pixels. The and ycoordinates go from to Boulders are rolling across the screen, and the player must avoid being hit by them. When a boulder rolls off one edge of the screen, it appears at the opposite edge of the screen, preserving the other coordinate. For example, if s and a boulder on the middle of the right edge of the screen, at coordinate moves to the right, it would reappear at coordinates ie in the middle on the left edge of the screen The screen is essentially the surface of a torus doughnut shape where you can imagine the right side has been joined to the left side, and the top of the screen to the bottom. The rolling boulders are simulated by updating their x y coordinates in discrete steps. Each rolling boulder is considered to move along a trajectory defined by a sequence of discrete points: yo yLi Yi It moves along a straight line joining consecutive points in the sequence. The trajectory of a rolling boulder is parameterised by two integers a and b so that Xi Yi is given by: Xi aci Yi Yi x; byi If either coordinate returned by the calculation is either negative or larger than s then it is considered to wrap around to the other side of the screen, and carry on counting. For example, if s then the coordinate would correspond to the point at and the coordinate would correspond to the coordinate Given the parameters a b and s which govern all of the boulders on the screen at the same time you are asked to determine the result of each of a queries. Each query is of the form x y n and is asking for the current position of a boulder that would have started at position x y and taken n update steps. Input Format Line : a b s Line : Each of the following a lines is of the format: x yn Constraints Constraints
The code provided is not even for this question, could you help?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started