Computer Science Canada

Battleship

Author:  Poland13 [ Sun Jan 04, 2004 3:18 am ]
Post subject:  Battleship

does neone have ne source codes or nething i could look at i was thinking of attempting to write it but wanna get an idea of what it owuld take

Author:  Boarder16 [ Sun Jan 04, 2004 8:21 am ]
Post subject: 

well in this case u don't eed an example...it is pretty simple code, you can use randints to draw and place the computer boats, and randints to sellect coords to fire on, for the eral player they can use typed coordinates to place and to give direction, and mousewhere when they click to fire, or use coordinates again.. it would be very simple...but the computer would problebly fire randomly the whole time, not like the real ai would when it hits a ship..i dunno how to do that Crying or Very sad ....hope tthat help Laughing

Author:  Poland13 [ Sun Jan 04, 2004 3:35 pm ]
Post subject: 

how would i make the grid though so that i would be able to place things on it would i use arrays ?

Author:  Boarder16 [ Sun Jan 04, 2004 6:01 pm ]
Post subject: 

well i am making a game that has a grid as it's basic moving area.. what i do is to move right 1 space i add 40 to the x variable, to move down -40 from teh y and +40 to y when up and u know 4 left... i drew a map in paint and teh grids are 36 apart so it works perfectly and teh images are always centered in eacch grid i mpvoe them in.. you can use arrays i gues.. i never did it was jsut easier for my game.. i dunno how'd/why'd u want to sue arrays in battle ship..its pretty easy to just load an image at a randow coordinates....

Author:  Poland13 [ Tue Jan 06, 2004 4:29 pm ]
Post subject: 

thanks boarder16 i got that battleship game done in one ngith and made who wants to be a millionaire today at lunch now im working on blackjack

Author:  Thuged_Out_G [ Tue Jan 06, 2004 4:34 pm ]
Post subject: 

for the random ai
if it hits a part of a ship, its next hit would be one grid up...if that is a miss, one grid to the left...then the bottom, then the right or in whatever order...

my teacher told us if we wanted we could hand battleship in for extra marks lmao...theres some pretty easy marks


: