Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Battleship
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Poland13




PostPosted: 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
Sponsor
Sponsor
Sponsor
sponsor
Boarder16




PostPosted: Sun Jan 04, 2004 8:21 am   Post subject: (No 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
Poland13




PostPosted: Sun Jan 04, 2004 3:35 pm   Post subject: (No subject)

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




PostPosted: Sun Jan 04, 2004 6:01 pm   Post subject: (No 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....
Poland13




PostPosted: Tue Jan 06, 2004 4:29 pm   Post subject: (No 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
Thuged_Out_G




PostPosted: Tue Jan 06, 2004 4:34 pm   Post subject: (No 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
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 6 Posts ]
Jump to:   


Style:  
Search: