Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Concepts Of Database Management

Authors: Philip J. Pratt, Joseph J. Adamski

4th Edition

0619064625, 978-0619064624

More Books

Students also viewed these Databases questions

Question

Explain how organisational behaviour impacts change strategies

Answered: 1 week ago