Question
Winter is back and is end of season's sale all over. The City's biggest Housewares and Home Appliances Fair is inaugurated at the Mathura Trade
Winter is back and is end of season's sale all over. The City's biggest Housewares and Home Appliances Fair is inaugurated at the Mathura Trade Centre and the show hosted numerous retailers, wholesalers, distributors to promote domestic economy. Public participated in large groups and the Event coordinators have designed a Robot at the Event ground to give instructions to the public in which directions to move.
The Event ground is a rectangular grid with R rows and C columns, with R*C cells in the grid. There are many obstacles in the event ground, so the Robot is set initially in the cell such that it is facing north, south, east or west. The initial position of the Robot (X,Y) is known. It can take a series ofmmoves through the ground. Each move is one of:
- F - moves forward one cell in the direction that he is facing, or
- L - turns 90 degrees counter-clockwise, remaining on the same cell, or
- R - turns 90 degrees clockwise, remaining on the same cell.
After making these moves, the Robot would stand at some final position where the guests wanted to drop. The coordinators wanted you to figure out where the Robot is standing. You will help them by writing a program to determine all possible final position of the Robot. You may also assume that the Robot is always facing a direction that is parallel to the sides of the event ground (north, south, east, or west).
Computer Science
Engineering & Technology
Java Programming
Step by Step Solution
There are 3 Steps involved in it
Step: 1
To solve this problem we can simulate the movement of the robot based on the instructions given F L ...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