Please code in JAVA and follow the instructions as it is mentioned.. please refer the images provided for scope and proper output making a retro-style game called Zeldar. You've been tasked to implement the player movement. The game is top- down, with the overworld modeled as a 2d grid. The player's location is tracked by x,y values correlating to its row and column positions within that grid. Given the current position of the player and a sequence of input commands: w,a,s,d you must determine the new position of the player. Facts ● the player's position is modeled using two integer values (x, y) ● x represents the column position, left-right axis ● y represents the row position, up-down axis ● “w” move up by decreasing y by 1 ● “a” move left by decreasing x by 1 ● “s” move down by increasing y by 1 ● “d” move right by increasing x by 1 Input The input will begin with a single line containing the number of test cases to execute. The next line should consist of the starting (x,y) position of the player. The next line is the sequence of moves represented with "w", "a", "s", or "d". This sequence can be empty string to any number of letters long. Each input is separated by a space with the last terminated with a new line. Output The program should print out the final location of the player in the form of , where “x” and “y” are the coordinates on the overworld grid.
Please code in JAVA and follow the instructions as it is mentioned.. please refer the images provided for scope and proper output
making a retro-style game called Zeldar. You've been tasked to implement the player movement. The game is top- down, with the overworld modeled as a 2d grid. The player's location is tracked by x,y values correlating to its row and column positions within that grid. Given the current position of the player and a sequence of input commands: w,a,s,d you must determine the new position of the player.
Facts
● the player's position is modeled using two integer values (x, y)
● x represents the column position, left-right axis
● y represents the row position, up-down axis
● “w” move up by decreasing y by 1
● “a” move left by decreasing x by 1
● “s” move down by increasing y by 1
● “d” move right by increasing x by 1
Input
The input will begin with a single line containing the number of test cases to execute. The next line should consist of the starting (x,y) position of the player. The next line is the sequence of moves represented with "w", "a", "s", or "d". This sequence can be empty string to any number of letters long. Each input is separated by a space with the last terminated with a new line.
Output
The program should print out the final location of the player in the form of <x> <y>, where “x” and “y” are the coordinates on the overworld grid.
Step by step
Solved in 2 steps with 1 images