Simulate the walk of a drunkard in a square street grid. Assume a grid of 10 streets horizontally and 10 streets vertically. Simulate a drunken person moving starting at the center of the grid. Simulate for 100 times the person picking a direction (east, west, north and south), move one block in the chosen direction. After 100 simulation print the location as a horizontal (east/west) and vertical (north/south) from the center. Hint: declare two variables one to keep track of east/west movement and the other to track north/south. Add or subtract one from the corresponding variable depending on the moves.
Write a Review
Leave a reply Cancel reply
Ask Your Question
We have verified professionals who are ready to answer your question.
Save Time and Money
We choose experts who can quickly answer your question and that suit your budget.
Get Your Answer
Your satisfaction is 100% guaranteed. You can keep on asking questions until you get the answer you need.