Question
Write a program that simulates a robot running a queue of commands to move around a board with obstacles. The board is composed of spaces
Write a program that simulates a robot running a queue of commands to move around a board with obstacles. The board is composed of spaces that are either empty (_) or have an obstacle (X). Also the board is assumed to be 10x10 spaces. The robot (O) has an x and y position corresponding to its location on the board, and four commands: move up, move down, move left, and move right. Both the board and the robots commands are assumed to be read in via a file (you can make your own format). Assume the robot starts in the top left corner of the board. The robot and an obstacle cannot exist in the same space, and if that happens the robot will crash, or in other words the simulation will stop. Also if the robot goes outside of the bounds of the board, then the robot will crash as well. The robots commands must be enqueued and dequeued from a Generic Queue of your own making. You may not use the built in Java Queue.
board.txt
_____X____ _______X__ _______X__ X____X____ _X________ __X___X___ _________X ___X__X___ ___X______ __XX______
robotCommands.txt
Move Right Move Down Move Down Move Down Move Right Move Right Move Right Move Down Move Right Move Right Move Right Move Right Move Down Move Down Move Down Move Down Move Down Move Right
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