Hello,
I have to make this battleships games for an assignment and can't seem to figure out what i need to place ten random 'Ships' which are only 1's and the 'sea' is 0's so if the co-ordinates the user enters = 1 its a hit.
So how do I get these ten ships which are just one in size? help is appreciated!!
DMK
2 replies to this topic
#1
Posted 22 November 2011 - 02:08 AM
|
|
|
#2
Posted 23 November 2011 - 05:58 PM
Well I've never made a BattleShip game before, but couldn't you use an array? You could store the 1s and 0s to know where each hit was. Then when you make a guess a scan the array and see if it hits.
~ Committed.
~ Committed.
A man can be defined by what he does when no one is looking.
Science is only an educated theory, which we cannot disprove.
Science is only an educated theory, which we cannot disprove.
#3
Posted 23 November 2011 - 06:32 PM
You would probably need a random () function, or something similar.
* * *
Why 1's and 0's? Can't there just be (ASCII) 32's and (ASCII) 2's?
* * *
Why 1's and 0's? Can't there just be (ASCII) 32's and (ASCII) 2's?
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account

Back to top









