Improvements I could make to my Bships code.

Hey guys,

was just wondering if anyone can list me any improvements I could make to my code? Minds blank at the minute. So far, I've got random placements of ships.

Any help would be much appreciated.

Thanks,

Mark.

----

code: http://pastie.org/pastes/1834907/text
if (PlayerWon=17) should be ==.

CPUTurn doesn't need to be recursive. You should prefer loops over recursion.
Also, you can just write int a = rand(); there is no need to set it to 0 first (same thing in other functions too. Not that it is in any way bad.. ).

In getBshipsGrid, you should probably have switched "grid"

Your setPlayer/CPUGrid functions lack sophistication.
Topic archived. No new replies allowed.