View Single Post
Old May 25th, 2008, 4:50 PM   #51
Fall Back Son
Hobbyist Programmer
 
Join Date: Oct 2006
Posts: 204
Rep Power: 2 Fall Back Son is on a distinguished road
Re: back to online battleship

I'm glad you got it working. I'm not sure what design you finally decided on, but what I had in mind for ActionRequest was that action request would simply contain two things, 'boolean hitSuccess' and 'coordinatesArray'. Whoever goes first would pass across an action request. Then player2 would check if it hit or not, update 'hitSuccess' appropriately, update the board appropriately, take his turn by guessing a square and updating coordinatesArray, then send it back. Then this process would be repeated. All you would need to do this is a couple of while loops, and a few things inside each while loop. To update the board you could call a updateBoard method (what I was calling eval earlier)
Fall Back Son is offline   Reply With Quote