Answered step by step
Verified Expert Solution
Link Copied!

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 2- and y-coordinates go from (0,0) to (81,81). 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 =100 and a boulder on the middle of the right edge of the screen, at coordinate (99,50), moves to the right, it would reappear at coordinates (0,50)(i.e. 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: (30,yo),(01, y1),...,(L'i, 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+1, Yi+1) is given by: Xi+1= aci - Yi Yi+1= 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 =100, then the coordinate (131,257) would correspond to the point at (31,57), and the coordinate (-1,-3) would correspond to the coordinate (99,97). 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 1: a b s Line 2: 4 Each of the following a lines is of the format: x yn Constraints Constraints 1
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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Jeffrey A. Hoffer Fred R. McFadden

4th Edition

0805360476, 978-0805360479

More Books

Students also viewed these Databases questions