|
![]() |
Overclock.net - Overclocking.net > Software, Programming and Coding > Coding and Programming > Application Programming | |
Battleship Game - C++
|
||
![]() |
|
|
LinkBack | Thread Tools |
|
|
#1 (permalink) |
|
New to Overclock.net
|
Hello guys,
This is my first post, I wanted to post my final class project. We had to make a game, i made a Battleship game. It is a 1 player game, so there is AI in it along with some colours. I didn't have time to get graphics working (graphics.h library) yet, but will soon. I attached the .exe file, please do check it and let me know of any errors. Let me know if anyone wants a fully documented source code. Click Here to download -Thanks |
|
|
|
|
|
#2 (permalink) | |||||||||||||
|
Case Modder
|
Its cool, but hard to use.
Allow me to be your first REP+
__________________
[||||||||||||||||||] __________________________________________________ __________________________________________________Car fund(5% Increments) "Student by day, Gamer by night" ╩╪Unofficial Lego Lovers Club╩╪
|
|||||||||||||
|
|
|
|
|
#3 (permalink) | |||||||||||||
|
Intel Overclocker
|
question: why does it take so long to choose a 'random' spot to place my ships?? I have a quad core at 3.6GHz for cryin out loud. :C
also i would like to recommend you make either the rows or the columns letters. That way you can specify a hit like 'A2'
__________________
|
|||||||||||||
|
|
|
|
|
#4 (permalink) | |||||||||||||
|
Case Modder
|
lol, i thought that too...
__________________
[||||||||||||||||||] __________________________________________________ __________________________________________________Car fund(5% Increments) "Student by day, Gamer by night" ╩╪Unofficial Lego Lovers Club╩╪
|
|||||||||||||
|
|
|
|
|
#5 (permalink) | |
|
New to Overclock.net
|
Quote:
You see, when your done placing ships, assuming you are adding it manually, then it's computer's turn. The computer randomly picks the coloumn and row number, and a random direction for all ships. It is doing many checks as this process continues. If the ship overlaps, it erases all ship cells and starts over again. If the ship gets out of the given box (from 0-9), it erases all ship cells and starts over again. So there are lots of checks, if any of them are false then the ships cells have to be erased in the array and the process is restarted. Since the number for the computer is picked randomly, it may happen a couple of times per ship. I did put restriction on random function but as more ships appear on the board, error percentage increases. I guess i haven't listed in the game that '*' means its a hit and 'm' means its a miss shot. As for letters, i'll have to change everything and go back to strings. It is possible though. -Thanks, good question though. |
|
|
|
|
|
|
#6 (permalink) | |||||||||||||
|
Intel Overclocker
|
ah gotcha. still, even with all those checks you'd think it would still be almost instantaneous... I dunno though, i am just starting to learn C++.
another suggestion in addition to the one i posted above: you should color code the ships (if you can) as well as the hit and miss icons. (eg make the * red or something) that should get u a better grade :P
__________________
|
|||||||||||||
|
|
|
|
|
#7 (permalink) |
|
New to Overclock.net
|
AOA! Please send me the cpp file of ur game. I'm required to make the same game for my semester project. I hav been trying to figure out how to make it and so far i have just made the board. I want to see how did u make the random ship placement and the checks. Many thanks. Kindly send it on rasputin_returns89@yahoo.com
|
|
|
|
|
|
#8 (permalink) | |
|
New to Overclock.net
|
Quote:
![]() |
|
|
|
|
|
|
#9 (permalink) | ||||||||||
|
Networking Nut
|
Am I the only one that finds it a little shady that this kid joined just to post this program he made? Could be my internet-sense kicking in.
__________________
|
||||||||||
|
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
|
|