Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Download: http://solutionzip.com/downloads/stumble/
- 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.
- Download: http://solutionzip.com/downloads/stumble/
Add Comment
Please, Sign In to add comment