Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The problem is an over simplification of the flow of liquid. - A terrain is given as a grid of cells of random elevations. The

The problem is an over simplification of the flow of liquid. - A terrain is given as a grid of cells of random elevations. The grid is always odd sized and is always a square. - A liquid is poured at the central cell. Water can flow only north-south or east-west; not diagnonally. - At the first step, the water level is the same as the central cell. - Water from one cell flows to a neighbouring cell if the level of water is equal to greater than the elevation of the neighbouring cell. - When the water flows to the neighbouring cell, the level of water is maintained. - If the water cannot flow to any new cell, the water level rises. - The simulation stops when the water reaches the end of the domain. - The output consists of the domain represented by . and W representing dry and wet terrain. Write a C/C++/Python Code. Output: ..................W................
...............W.WWW...............
..............WWWWWWW..............
..............WWWWWW...............
.............WWW..WWWW.............
...........W.WWWWWWW.WWW...........
..........WWWWW.WWWWWWWWW..........
.........WWWWW.WWWWWWWWW.W.........
.........WWWWW.WWWWWWWW.WWW........
.......W..WWWWWWWWWWWWWWWWWW.......
......WWW.WWWWWWW.WWW..WWWWWW......
.....WWWW...WWWWWWW.WWW.WW.WWW.....
........WWWWW.W.WWWWWWWW.WWWWWW....
...W.WWWWWWWWWWWW.WWWWWWWWW.WW.....
..WWWWWWWWW.WWW.WWWWW.WWWW.WWWW....
.WWWWWWWWW.WW.WWWWWWWWW.WWWWW......
...WWW..WWWWWW..WWWWW..W.W..WWW....
..WWWWWWWWWWWWWWWWWWWW.WW..WWWWW...
..WWW.WWWWW.WWW.WWWWWW.WWWWW.WW....
.WWWW..WWWWWWWWWWWWWWWWWW.WWWWWW...
..WWWW.WWWW.WWW.WWWWWW..W.W.WWW....
...WWWWWWWWWWWWWWWWW.WWWWWWWWW.....
....WWWW..WWWWW.W.WWW.WWWWWW.WW....
.....WWWWWWWWWWW.WWWWWWWW.WWWW.....
......WWWWWWWWWWWWWWWWWWWWWWW......
.......WWWW.WW.WWW.WW..WWWWW.......
........WWWWWW.WW...WWWW.WW........
.........WW.WWWWWW.WW.WWW..........
..........W..WWWWWWWWWWWW..........
.............WWW.WWWWWWW...........
............WW.WWWWWWWW............
.............W.W.W.WWW.............
....................W..............
...................................
...................................W.WWW.
WWWWWWW..
WWWWWW.
WWW..WWWW.
W.WWWWWWW.WWW.
WWWWW.WWWWWWWWW.
WWWWW.WWWWWWWWW.W..
WWWWW.WWWWWWWW.WWW.
W..WWWWWWWWWWWWWWWWWW.
WWW.WWWWWWW.WWW. WWWWWW.
WWWW...WWWWWWW.WWW.WW.WWW.
WWWWW.W.WWWWWWWW.WWWWW
W....
W.WWWWWWWWWWWW.WWWWWWW
WW.WW.....
.WWWWWWWWW.WWW.WWWWW.WWW
W.WWWW....
.WWWWWWWWW.WW.WWWWWWWWW.W
WWWW......
image text in transcribed

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

Databases Demystified

Authors: Andrew Oppel

1st Edition

0072253649, 9780072253641

More Books

Students also viewed these Databases questions

Question

Define and discuss affirmative action.

Answered: 1 week ago

Question

Discuss diversity management.

Answered: 1 week ago