I was just wondering how many of you have dont battleship, and how many lines of code should it take? Just an estimate.
See, thats what I'm working on right now. I have the player ship placement very near completion, its just a matter of typing now. After that the rest should be real easy. Do you think this is a good game to do after tic tac toe?
its simple, ive done it before
172 lines for me
Yep, I've done it... an OOP approach though, it was around 500-600 lines.
As for the estimate of how many it will take you.. I can't give you one, nor can anyone else. It all depends on your style. For example, some people comment on new lines, others don't (I do). Some declare more than one variable on one line (I don't). Others make use of brackets on tiny if statements (like me).
These things add up very quickly :)
download my battleship zip, only player ship placement is done. the zip has the source and an executable. oh and comment on it please.
And so it seems i do everything that takes up more lines! It makes it more organized for me. Always use brackets on if's, declare variables on different lines, etc..
Exactly. Less lines by no means is better.
800 i think
my battleship is 800 or so, but its totally dummy proof (other than when you press letters instead of numbers) but maybe its overly complicated...
It also depends on how many features you put in the program, sound,color,positon check,display format etc etc.
Mine is 900 odd line and still unfinished.
>>172 lines for me
Xterria, is that really true? you must be joking.
i've never heard of anything under 400
at least not if its dummy proof (what happens if they put -1 as left coord for battleship, etc.)
we did it as a project in class and the shortest code was 400 something
I am new to C:
Any chance anyone could send me or post your battleship source code? We just got the project and the function I have to write is a Generate_Board function that will take as an array a parameter of 108 integers and will place the following ships:
1 ship a length of 2
2 ships a length of 3
2 ships a length of 4
1 ship a length of 5 these must be randomly generated by the computer as opposed to being placed by the player. I was hoping your code might give me some insight.
Thanks to anyone willing
or...you can write things like this: