[cs23021] Battleship Problems (Lab 8)

Mikhail Nesterenko mikhail at cs.kent.edu
Wed Oct 27 23:08:38 EDT 2010


> Ok, I'm having strange errors now. When I debug the deploy() function and
> step through the function and the subfunctions one line at a time, it
> appears to work. 

Your deploy() is not correctly coded. I suggest you re-code it from
scratch. Very carefully read the instructions in the lab assignment
for this function.

There needs to be two nested loops. There also needs to be a single
variable that keeps track of how many ships are deployed.

The outer loop is a while-loop that iterates until the whole array is
filled (the above variable is equal to FLEET_SIZE). The inner loop is
a for-loop that iterates across the already deployed ships and check
(with match()) if the location of the already deployed ships matches
the picked location. If yes - next outer loop iteration, if not - new
ship is deployed.

Thanks,
-- 
Mikhail


More information about the cs23021-2 mailing list