Thanks. Works good. But it still lets you enter in a hit twice. It does not change the value of shipLocation[x][y] to equal something other then a number after it was used.

Unit

04-30-2004, 03:54 AM

Ah, I must have overlooked that one.

The problem is in this line

shipLocation[x][y] = 'hit';

As you can see, our shipLocation format is like shipLocation[0][0]=x and shipLocation[0][1]=y; so you were marking it at the wrong spot. see if you can correct it yourself.

If not, I messed with the code and changed what I felt like.. and I can't be bothered to change it back, so that's what you get :D. anyway, hope that it helps you in understanding it better. Post back if you have something that you dont understand. Highlighted my changes in red.

Oh! Light bulb! I see now. I think I can fix it my self. Thanks. :thumbsup:

Unit

05-01-2004, 03:51 AM

You might want to make it similar to my script such that guessing the same spot twice does not do anything like incrementing the number of guesses or hits. Try running my version of the script to see what I mean.