Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

in python3 Problem Specification After numerous Godzilla attacks, the city of Tokyo, Japan is testing their new invention, Mechagodzilla. You are tasked with implementing a

in python3

image text in transcribed

image text in transcribed

Problem Specification After numerous Godzilla attacks, the city of Tokyo, Japan is testing their new invention, Mechagodzilla. You are tasked with implementing a program to help retrieve Mechagodzilla after successful deployments. Mechagodzilla's movements are controlled by sending a series of inputs. 'N' for north, 'E' for east, 's' for south, or 'W' for west If something goes wrong and Mechagodzilla is destroyed, we need to be able to find it for retrieval The question we want to answer: Using a standard Cartesian grid, what are the (x,y) coordinates of Mechagodzilla after it finishes a series of movement inputs? Assume Mechagodzilla always starts at the base coordinates of (0,0). Here are some examples to help clarify: NNE: coordinate (1, 2) NNEEENNW': coordinate (2.4) WNENWNSNN : coordinate (-1.4) 'EESSENNESE?: coordinate (5, -1) WEENEWE: coordinate (2, 1) NWEWWNSWW': coordinate (-4,1) You will be given a number of datafiles containing inputs of different lengths. Each file will contain a number of lines. Each line will represent inputs from a deployment. The program you must write will open the file, read each line, and then print the final (x,y) coordinates for that deployment to the console. For example, if a datafile contained the examples above, your program would display (1, 2) (2, 4) (-1, 4) (5, -1) (2, 1) (-4, 1) Detailed Example Example File (with only one deployment): NNEEENNW Program Output: (2, 4) Illustration to help visualize path taken: 6 4 finish o O 20 start -5 4 -3 -1 0 1 2 3 4 5 -2

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

SQL For Data Science Data Cleaning Wrangling And Analytics With Relational Databases

Authors: Antonio Badia

1st Edition

3030575918, 978-3030575915

Students also viewed these Databases questions

Question

=+ What is the nature of the contracts or agreements with unions?

Answered: 1 week ago

Question

=+What is the procedure for labor relations in the workplace?

Answered: 1 week ago

Question

=+ Are ballots compulsory?

Answered: 1 week ago