Website Summary Files Commits Branches @commit @diff @stats
path: root / Sem. 15 / Chess / ChessBoard / ChessBoard.h
blob: d2bf81f05183c5c97cc090c4aa7435481bdbe378 (plain) (blame)
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
#pragma once
#include "../Figures/FigureBase/Figure.h"

const size_t BOARD_SIZE = 8;
class ChessBoard
{
	struct Cell
	{
		Figure* f = nullptr;
		Cell() = default;

		Cell(const Cell& other) = delete;
		Cell& operator=(const Cell& other) = delete;
		bool isEmpty()
		{
			return f == nullptr;
		}

		void print() const
		{
			if (f != nullptr)
				f->print();
			else
				std::cout << ' ';
		}

		~Cell()
		{
			delete f;
		}
	};
	Cell board[BOARD_SIZE][BOARD_SIZE];

public:
	ChessBoard();
	ChessBoard(const ChessBoard& other) = delete;
	ChessBoard& operator=(const ChessBoard&) = delete;

	void print() const;
	
	//TODO. Free memory?
};