-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathPlayer.h
65 lines (52 loc) · 1.95 KB
/
Player.h
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#ifndef PLAYER_H
#define PLAYER_H
#include "Board.h"
#include <iostream>
#include <string>
class Player{
private:
Board hiddenBoard ; // The board shown to opponent
Board gameBoard; // this board shows ships and hitted space
Board original_Board;// the board stores all the shps and do not make any change
int shipsLeft;
public:
Player();
~Player();
bool checkHit(int row,char col);//checks what is hit
//@input - int row - the row in which the player wants to place a boat.
//@input - char col - the column in which the player wants to place a ship.
//@process - uses the passed parameters to check to see if a B exists at the passed location in the hiddenBoard.
//return 1 if hits ships, 0 if hits water
int checkShips();
//@input - none.
//@input - none.
//@process - none
//@return - returns the amount of ships left for the player class.
void get_hit(int row, char col);//helper function checkHit()
//@input - int row - the row in which the player wants to place a boat.
//@input - char col - the column in which the player wants to place a ship.
//@process - replaces a B in the array with an X.
//@return - none.
void getHiddenBoard();
//@input - none.
//@input - none.
//@process - print the hidden board object.
//@return - none
void getGameBoard();
//@input - none.
//@input - none.
//@process - print the Game board object.
//@return - none
void getOriginalBoard();
//@input - none.
//@input - none.
//@process - print the Game board object. Mainly used for calling methods of the board class
//@return - none
bool placeShip(int row, char col, int size);
//@input - the row number in which the ship will be placed
//@input - the column number in which the ship will be place
//@input - int the size of the ship
//@process - asking user about the direction of the shop. places a ship in the gameBoard and original_Board
//@return - true if ship was placed, false if ship wasnt placed.
};
#endif