Frigate battle project

Hey guys, i have this project for the semester and I need some help with it.
The instructions (summarized because its a long Word doc):
[list]

[*] One ship is computer controlled, the other is user controlled.
[*] Each ship, both user and computer can have a total of 15 points applied to their attributes.
Example:
Fast Frigate: Movement – 10, Armor – 1, Weapon – 1, Range – 3;
Slow Frigate: Movement – 3, Armor – 7, Weapon – 2, Range – 2,1;
[*] The Fleet plays on a field of 10 square by 10 squares
[*] Each turn the user gets to put in a sequence of actions equal to the number of actions their ship has available. All the actions are entered one after another for the user, and then the computer calculates its turn (up to the number of actions it has). Each ship then takes an action starting at the top of its list of actions, one action at a time. Order (or who goes first each for each segment of the turn) is determined randomly
[/list]

And here is the "requirements" if you will, for the program:
Requirements:
[list]

[*]Functions as needed (there are LOTS). Each function should be logically cohesive.
[*] Array to handle the game board
[*] Draw the grid to the screen, including a symbol for the user's ship and the computer's ship
[*] Accept input from the user, validating as needed
[*] A hit is only possible if the enemy is range
[/list]

So these are pretty much the basic instructions for the program. I have just stared right now so i have only the game borad so far. Here's my code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include <cstdlib>
#include <iostream>
#include <iomanip>


using namespace std;

const int ROW = 10;
const int COL = 10;

void printBoard (int[][COL]);

int main(int argc, char *argv[])
{
    int gameboard[ROW][COL];
    
    printBoard(gameboard);
    
    system("PAUSE");
    return EXIT_SUCCESS;
}

void printBoard (int [] [COL])
{
    for (int rows = 0; rows < ROW; rows++)
    {
        for (int collumns = 0; collumns < COL; collumns++)
        {
            cout << "*";
        }
        cout << endl; 
    }
} 

Now, how would i go about putting the ships on the game board? That is what i am having so much trouble understanding D:

P.S. Thanks for any help you guys can provide :)
Last edited on
It seems like you'll need to keep track of where the computer's ship is and where the user's ship is, so I'm thinking a variable to keep a ship's coordinates (row, column). Also, you will need to define a character for the computer's ship (how about 'C') and a character for the user's ship (how about 'U').

When you call printBoard, you will need to check the coordinates of the computer's ship and use its character instead of the asterisk (same thing for the user's ship.)

I hope this is helpful!
What im wondering is that when you say "When you call printBoard, you will need to check the coordinates of the computer's ship and use its character instead of the asterisk (same thing for the user's ship.)" do you mean that when i call printBoard in the functions that dictate the locations of the ships?
Also, do i have to create a function for each ship? (so one function for player's ship and another function for the computer's ship?)
Oh man this is really frustrating im stuck at the beginning of the thing.
Topic archived. No new replies allowed.