Info

Questa domanda è chiusa. Riaprila per modificarla o per rispondere.

i have a some problem with the code i wrote for a while loop and cant't figure it out.can someone look at it and tell me where i went wrong?

1 visualizzazione (ultimi 30 giorni)
i have attached a file with the code in it,this is only a small bit of my batlleship game code. i this attached code,i have a matrix of 10x10 of zeros,and two ships: destroyer[2,2] and submarine[3,3,3](both randomly in either vertical or horizontal position].and now i want to prevent the intersection between these two.
i wrote the while loop checking if they intersect......if they do then i ask matlab to repeat the code until it doesnt.There is something wrong with the loop and i cant figure out what,as when i run this code multiple time to check if it works or not,whenever there is an intersection the it goes into an infinity loop. could some please help ?

Risposte (0)

Questa domanda è chiusa.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by