Hi I was hoping anyone here had a simple source code for the game battleship its a project in class we have to do and I'm a little lost on how I should set it up and would like to see how some other rpogrammers did.
Hi I was hoping anyone here had a simple source code for the game battleship its a project in class we have to do and I'm a little lost on how I should set it up and would like to see how some other rpogrammers did.
First, try to write the code yourself. You won't learn much from someone else's source. You will find that it is twice as hard or even three times as hard to read someone else's source (even when it has good format and comments) than to just try the code on your own.
Try and fail. Come back here and post the part that failed and about a gazillion people will help you solve your problem. But you gotta try first.
If you don't know where to start, play the game in real life. Break the game into it's component parts and try to code those to the best of your ability. For starters: look at the game board. Isn't it strange how it looks like a 2 dimensional array?
Just wondering... have someone ever made a 3D-Battleship, which includes airplanes with different height?
MagosX.com
Give a man a fish and you feed him for a day.
Teach a man to fish and you feed him for a lifetime.
Why don't you go talk to someone like John Carmack or romero?
Don't know, but it would not be that hard to do. To explain it in this thread would probably confuse the issue at hand.
understand the functionality of the real world application...
understand the syntax for implementing that same functionality in a source code file...
debug debug debug... wash rinse repeat...
then ask...
hasafraggin shizigishin oppashigger...
Hi,
I am new to C and C++ and reading up on it.
I studied the tic tac toe game and would like to attempt a battleships game.
What I would like to ask is, as I am a beginner should I write this in C or C++?. I would like to go straight for C++ with classes and polymorphism's etc but will I come into problems?
Your advice would be helpful.
Thanks
try either... use only what you have to, and if you end up only using C then go with that... lay it out, figure how to get it to code, wash rinse repeat... theoretically, since guru programmers do exist... [like salem... ] you should have no problems doing anything... but practically, you do... ask and ye shall find, be not vague, but rather as specific and local as you can... the more concise you are, the more concise we'll be...
hasafraggin shizigishin oppashigger...
Then that is your answer. I agree, you just got to go with what you are interested in. Both C and C++ are more than capable to accomplish just about any task.I would like to go straight for C++
Allegro precompiled Installer for Dev-C++, MSVC, and Borland: http://galileo.spaceports.com/~springs/
...but will I come into problems?
You are programming, right? Yes, you will have problems since that is the name of the game. Will you have problems because you choose C++ over C? No. Both approaches have their bad points and good points. Since this is for a simple project, I would use C instead of C++. If you have more time to study the hierarchy of the objects in the game and how they relate to each other then use C++. The choice is yours. If you are not strong in C++, then code the project for class in C (to get the grade), and then code it in C++ on your own to learn more.
I'm not a "everything must be C++ or it's worthless" kind of programmer. Both C and C++ when used correctly are very powerful.
> Yes, you will have problems since that is the name of the game.
that's very true... practice makes perfect... [lim as practice -> infinity dpractice/dtime == perfect...]if debugging is the practice of removing bugs... then programming must be the practice of putting them in...
>kind of programmer
i agree... use what you need... get it done... especially if someone is grading you... and in general if you further explore it... i find this is always good practice... it's the mentality...
hasafraggin shizigishin oppashigger...
Hi,
Thanks all for the comments.
I will post the Battleships Program when I have it done. (or have a major problem stopping me completing it!!).