By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,612 Members | 1,632 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,612 IT Pros & Developers. It's quick & easy.

programming battleship issue

P: n/a
hi, im trying to program the game battleship but i cant figure out how to
code how people can place the ships and keep track of it. Ive been trying and
researching for a couple days now and am at the end of my rope...if anyone
cal help thatd b awsome.

i have a 10x10 picturebox grid initialized into a 2d array to hold them. i
just need to have a way to have them pick where they want their ships and
keep track of it....thanks to anyone that can help
--
-iwdu15
Jan 12 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Does this answer your question:

(*) Have a box on the side with the still-to-be-placed ships
(*) User clicks on one of these (removing ship from box), then a location in
the grid.
(*) Ship is placed there in current orientation (allow it to clip).
(*) have two rotate-buttons for each rotation direction.
(*) Hitting these buttons rotates the last placed ship about its placement
point.
(*) Have a 'finish' button. This is only active if all ships have been
placed legally.
(*) Have a "delete" button also. Clicking on a placed ship and then 'delete'
will remove it from the grid and place it back in the side box.
(*) Clicking on a ship already placed in in grid 'selects' it. It can now be
rotated (again), and clicking on an empty locatin in grid will place it
there at current orientation if legal.

'Legally" mean no clipping and no overlapping.

You can get fancy by not allowing rotations to stop in illegal positions,
and/or disallow placing ships for which no orientation is legal.

That should get you started... : )

[==P==]

"iwdu15" <jmmgoalsteratyahoodotcom> wrote in message
news:2B**********************************@microsof t.com...
hi, im trying to program the game battleship but i cant figure out how to
code how people can place the ships and keep track of it. Ive been trying
and
researching for a couple days now and am at the end of my rope...if anyone
cal help thatd b awsome.

i have a 10x10 picturebox grid initialized into a 2d array to hold them. i
just need to have a way to have them pick where they want their ships and
keep track of it....thanks to anyone that can help
--
-iwdu15

Jan 12 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.