Please answer in python!! answer in PYTHON!

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

Please answer in python!! answer in PYTHON!

Post by answerhappygod »

Please answer in python!!
answer in PYTHON!
Please Answer In Python Answer In Python 1
Please Answer In Python Answer In Python 1 (238.04 KiB) Viewed 35 times
Please Answer In Python Answer In Python 2
Please Answer In Python Answer In Python 2 (291.81 KiB) Viewed 35 times
Please Answer In Python Answer In Python 3
Please Answer In Python Answer In Python 3 (113.63 KiB) Viewed 35 times
<numRows> <numCols> <Blob startRow> <Blob startCol> <map characters> • Num rows and columns indicate the maps dimensions • Start row and column are where Blob begins • The row and columns coordinates range from 0 to (num Rows-1) and 0 to (num Cols-1) • The top left of the map would be considered 0,0 The map consists of: • Streets represented by capital 'S' • The Blob can only move through streets and sewers . People represented by capital 'p' • Buildings are represented by '#' . Sewers are represented by '@' . You will need to do some pre-processing on the file to find the locations of all sewers before your Blob simulation begins • All sewers are considered adjacent A file is invalid and the program should end with an error message if... if file doesn't exist if num Rows are less than 1 . if numCols are less than 1 • if start position is not within range You may assume the map characters match the parameters given above.
Blob Moving Rules • The Blob starts at the start position • The Blob only spreads orthogonally (up, right, down, or left) not diagonally • See special rules of sewers • You must check for valid directions to spread in the order: up, right, down, left • You cannot spread through the Buildings • See special rules of sewers • People • People work just like streets, except they add the "People Eaten Total" • Sewers • If the Blob is on a sewer space, and has tried to spread in all other directions, it will spread into the sewer, which allows it to move to all connected sewer spaces one at a time Once the Blob moves through a sewer it continues to move as normal
Output After receiving a file from the command-line you will output to where the Blob spread. As the Blob spreads, you will marks its path with 'B's. You must keep the sewers as '@' in the output. Below the blob-filled map you will also print a count of "Total Eaten"
Sample Runs Input file 1 4 4 02 ##S# #PS# ##S# SPP# Output 1 ##B# #BB# ##B# BBB# Total eaten: 3 Input file 2 8 8 00 PSSSSSS# ######S# aSSSSSP# ####### ###S#### @SSSSS# #S####S# ###PPPSP Output 2 88 0 0 BBBBBBB# ######B# @BBBBBB# ########
Output 2 8 8 0 0 BBBBBBB# ######B# @BBBBBB# ######## ###B#### @BBB#SS# #B####S# ###PPPSP Total eaten: 2
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply