Link to home
Start Free TrialLog in
Avatar of supermotoxxx23
supermotoxxx23

asked on

A Battleship game that has a five by five playing board and has to save the highest score and display it at the begenning of the game

---->Sorry I never asked you my question, like I was saying before my problem is probably so easy for you experts that i'm embarassed to ask BUT...I'm not sure how to  do a coulple things, one is the positioning of the ships on a playing board using an array, and then tellling the opponent the ship has been HIT --->(how will the program know that a ship was hit)<---, AND i'm having trouble figuring out what to use to save the highest score and displaying it at the begining of the game at the top  --->I'm just learing the basics of programming and I haven't put all the puzzel pieces together to write this simple program ---->Please Help me out as much as you can<------        Thank you     ----> GOOD FOR 500 Points<------
Avatar of InteractiveMind
InteractiveMind
Flag of United Kingdom of Great Britain and Northern Ireland image

Hi,

firstly: no question is stupid; it's only stupid not to ask the question.

Anyways, onto it: I'm not sure if you've already posted a question related to this previously, but either way, I need to know a few things: what programming language are you using? What problems are you having so far?

Rob.
Avatar of Sid_The_Kid
Sid_The_Kid

I am going to try to sneak in for the points by answering this question in very general concepts that apply to all programming languages.

I am assuming you already have your multidimensional array set up, and that you are able to assign the position of each ship to that array. With that, all you need to do is detect whether a ship is hit. Do not be afraid to create another array. What I mean is you have the one array that holds the ships positions; so create another to hold the status of each ship. I am just throwing in these ideas because there are three ways I can think of to do this:

1. Each ship has its own array for position and another array for the status for each section of the ship      
2. The board is a big 2D array that has True of False for each little location of the board for every piece, and each ship has its own array for whether each section is hit or still alive (true or false)
3. The board is a big 2D array that has the value of 0, 1, or 2 for each little location on the board for every piece. 0 meaning the ship is not there, 1 meaning the ship is there and alive, and 2 meaning the ship is there, but down.

In any case (I recommend #3) you should have noted in some variable the start and end of each ship so you can say "You sunk my battleship!".

As for the top score thing: I don't see how you plan to have a scoring system on Battleship. Isn't that a win or lose game? Anyway... You are going to have to learn to save text (or other) files to the hard drive. But that can often be an ugly chunk of code in the programming languages I've studied. Best not to get in to that if you are a beginner. Good luck. Hope you can solve your problem.

I would also like to add: sorry for trying to steal points from your question InteractiveMind.  LOL, I have like 0, so I'm point hunting.
LOL that doesn’t make any sense... Pay no attention to the second block of sentences where there are errors in grammar.
ASKER CERTIFIED SOLUTION
Avatar of mathbiol
mathbiol

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
What does WOOT mean?
There is a long history behind the word: W00T. It is both an acronym standing for many different terms, and an expression of happyness.

Woot can stand for the following:
-We Owned the Other Team
-Want One Of Those
-Waste Of Our Time
-Wonderful Loot (Everquest gaming slang)

And there is a legend that says in one of the first games around, there was a boss the sait "woot woot" whenever he killed you (from what I've heard). But internet slang is becoming more and more popular, and woot is one of those abstact terms. It is something you say when you feel like cheering. It is the modern day version of "yaaaahoooo!" It is most comonly used by people of younger ages, and those who play games on the internet.

There is no real definition of woot. Its definition changes as much as it is used. But one thing I can tell you, is that this particualr use of it did have meaning: Thankyou. Thanks for requesting the assist, I was happy to recieve the "nice assist" message even though I didn't get the points I was so searching for. At least I got the 1000 expert points, and yet another question answer on my profile. I have asked a whole bunch of questions and have only answerd 2 (including the answer point from this one). That is what you get for being a 16-year-old programmer. But its all good, because I am getting great experience here.

Sorry, I know you were only expecting like 1 sentence LOL.
Sid, thanks for explaining.  Why are you so anxious to get points?  Are you trying to get free premium services?

You may be able to answer some of the math review questions posted by InteractiveMind, who is also young, I believe.  He posts them from time to time in the math topic area.

mathbiol
K, thanks.

The reason I want points is because if I had enough, I would be asking questions every day.

I was just reading the premium services page. That’s all I need to do? Answer 12 questions? That’s easy enough. All I have to do is answer 10 more. But if experts have the ability to ask unlimited questions, what is the point of currency points in this? Or is that just a product of the "Premium Membership" that you have to buy? It just seems a bit over-rewarding for such a small amount of questions answerd. And what is with these yearly subscriptions? Anyways, I really don't know what awats for me on this site, or how the site actually works. But it doesn't even matter that much. I am just as happy with this non-premium package. The only thing is that I need points!