logo Use SA10RAM to get 10%* Discount.
Order Now logo
193 Times Downloaded

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Laurence FarrellStatistics
(5/5)

509 Answers

Hire Me
expert
Susanne ParkerNursing
(5/5)

810 Answers

Hire Me
expert
Bhargav AppasaniiEngineering
(/5)

726 Answers

Hire Me
expert
Geoffrey MorrisMathematics
(5/5)

772 Answers

Hire Me
Python Programming
(5/5)

Giant robots are about to invade the earth and you are tasked with simulating the invasion.

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

 

Giant robots are about to invade the earth and you are tasked with simulating

the invasion.

 

You are given a map containing the names of cities in the non-existent world of

X. The map is in a file, with one city per line. The city name is first,

followed by 1-4 directions (north, south, east, or west). Each one represents a

road to another city that lies in that direction.

 

For example:

 

Foo north=Bar west=Baz south=Qu-ux

Bar south=Foo west=Bee

 

The city and each of the pairs are separated by a single space, and the

directions are separated from their respective cities with an equals (=) sign.

 

You should create N robots, where N is specified as a command-line argument.

 

These robots start out at random places on the map, and wander around randomly,

following links. Each iteration, the robots can travel in any of the directions

leading out of a city. In our example above, an robot that starts at Foo can go

north to Bar, west to Baz, or south to Qu-ux.

 

When two robots end up in the same place, they fight, and in the process kill

each other and destroy the city. When a city is destroyed, it is removed from

the map, and so are any roads that lead into or out of it.

 

In our example above, if Bar were destroyed the map would now be something

like:

 

Foo west=Baz south=Qu-ux

 

Once a city is destroyed, robots can no longer travel to or through it. This

may lead to robots getting "trapped".

 

You should create a program that reads in the world map, creates N robots, and

unleashes them. The program should run until all the robots have been

destroyed, or each robot has moved at least 10,000 times. When two robots

fight, print out a message like:

 

Bar has been destroyed by robot 10 and robot 34!

 

(If you want to give them names, you may, but it is not required.) Once the

program has finished, it should print out whatever is left of the world in the

same format as the input file.

 

Feel free to make assumptions (for example, that the city names will never

contain numeric characters), but please add comments or assertions describing

the assumptions you are making.

 

(5/5)
Attachments:

Expert's Answer

193 Times Downloaded

Related Questions

. The fundamental operations of create, read, update, and delete (CRUD) in either Python or Java

CS 340 Milestone One Guidelines and Rubric  Overview: For this assignment, you will implement the fundamental operations of create, read, update,

. Develop a program to emulate a purchase transaction at a retail store. This  program will have two classes, a LineItem class and a Transaction class

Retail Transaction Programming Project  Project Requirements:  Develop a program to emulate a purchase transaction at a retail store. This

. The following program contains five errors. Identify the errors and fix them

7COM1028   Secure Systems Programming   Referral Coursework: Secure

. Accepts the following from a user: Item Name Item Quantity Item Price Allows the user to create a file to store the sales receipt contents

Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip

. The final project will encompass developing a web service using a software stack and implementing an industry-standard interface. Regardless of whether you choose to pursue application development goals as a pure developer or as a software engineer

CS 340 Final Project Guidelines and Rubric  Overview The final project will encompass developing a web service using a software stack and impleme

Get Free Quote!

314 Experts Online