2d array

write a program that simulates a drunk mouse movement on an island using 2d arrays
Write a program that simulates the above game by inputting:
size of the island N, 3 <= N <= 9
position of the mouse (i, j), 2 <= i, j <= N-1
position of the cat (a, b), 2 <= a, b <= N-1 and a ≠ i or b ≠ j
position of the bridge (x, y), x and y values are one of the following:
x = 1 or N and 1 <= y <= N
1 <= x <= N and y = 1 or N
number of movements (M), 3 <= M <= 20
M movements (U = Up, D = Down, L = Left, R = Right)


Your program should output the following if moving the mouse from its starting position using M or less movements leads to the following:
Going into the water -> Drown
Hitting the cat -> Eaten
Passing the bridge -> Escaped
Staying in the Land -> Starved


Hello Ahmede99,

Welcome to the forum.

Eventually someone will ask. And your problem is? What you have posted makes it look like you want someone to write the program for you and that will not happen.

Write some code and post it pointing out where you problem is and help will be given.

It looks like the 2D array is at least 3 X 3 and as much as 3 or more X 9. Just a thought for now.

Hope that helps,

Andy
my problem is with the 2d array
it gives garbage value
Hello Echelon22,

My apologies on the wrong name. I mostly do a copy and paste to get the spelling right. Not sure where that came from.

It is hard to answer your question without seeing your code and being able to see what you did. I have no idea how or what you put into the 2D array, so I haave no idea why you get garbage out.

Without the code I could make guesses for the next year and still never figure it out.

Andy
i didn't have the array initialized. i fixed it thank you
Topic archived. No new replies allowed.