-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBoard.h
79 lines (62 loc) · 2.14 KB
/
Board.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/**
*Header file of class Board
*Authors Alexey Titov and Shir Bentabou
*Version 1.0
**/
//libraries
#include <algorithm>
#include <iostream>
#include <fstream>
#include <string>
#include <list>
#include <math.h>
#include <ctime>
#include <stdio.h>
#include <cstdlib>
#include <cmath>
#include <stdlib.h>
#include "Cell.h"
#include "OurException.h"
using namespace std;
struct RGB {
uint8_t red, green, blue;
public:
RGB() {}
RGB(uint8_t red, uint8_t green, uint8_t blue): red(red), green(green), blue(blue) {}
};
class Board{
private:
int bound;
Cell **board;
public:
//Empty constructor for board class
Board(){this->bound=0;}
//Constructor that receives an int that defines the board size wanted
Board(int b);
//A copy constructor that receives a Board object and makes a deep copy to another Board object.
Board(Board& copy);
//Distructor for Board object - deletes everything we allocated memory for.
~Board();
//This function helps to delete a Board class object (used in distructor and '=' operator function).
void delBoard();
//Operator [] overloading for Board class - for a specific cell inside the board.
Cell& operator[](list<int> lst);
//Operator '=' overloading for Board class. Inserts value to whole board if '.'. Else throws exception.
Board& operator=(char c);
//Operator '=' overloading for Board class. Copies another Board object.
Board& operator=(Board& copy);
//Draw function for Board class. Draws the game board.
const string draw(int n);
//----------------------------------
// friend global IO operators
//----------------------------------
friend ostream& operator<< (ostream& os, const Board& b);
friend istream& operator>> (istream& is,Board& c);
};
//----------------------------------------
// friend global IO operators
//----------------------------------------
//Operator '<<' overlaoding for board class.
ostream& operator<< (ostream& os, const Board& b);
//Operator '>>' overlaoding for board class.
istream& operator>> (istream& is,Board& c);