I am working on a java program that is an optimization problem. The problem is i have this man who wants to go fishing and i have to represent this pond by a 2D array. Also i have to show fish movement during the iterations. I can create the 2D array manually using numbers to represent land=0, water=1, and where fish are present=2. Here is the array at the bottom. I have to optimize the number of fish caught by going to certain locations where fish are present, and this is the part where i get confused. I dont know how to write code for the movement of the fish and how the fisherman gets to those locations, etc. If i could be provided with some syntax for writing 2D arrays it would be helpful
Those for loops help me out to scan the pond. Now my next challenge is to make some fish behavior so that after each iteration the 2's move around. I was suggested using something like using a random number generator and use the number in an equation like x%4 and by using the mod fuction i could associate values for each direction like 0=right 1= left, 2 = up, 3= down. Since i have never coded something like this i am very unsure how to code a random generator and then use in the sense that was suggested to me by my professor.