Dec-06-2018, 07:33 AM
(This post was last modified: Dec-06-2018, 07:33 AM by MAZambelli4353.)
Im trying to code random placements for the computer's ships into the 10x10 grid. The five ships are of lengths 2, 3, 3, 4, and 5. If you are unaware of the game, the ships cant be diagonally placed, only vertical and horizontal. I cant seem to get around all the problems that arise such as two ships overlapping or their positions simply being illegal. I mean I could code it but it would be extremely tedious and ugly. Is there some elegant way of doing something like this?