From 50444e86ea5048e05b8eb74055e0f7c4d2c5d7b7 Mon Sep 17 00:00:00 2001 From: angeld55 Date: Thu, 10 Jun 2021 18:54:25 +0300 Subject: sem 15 --- Sem. 15/Chess/ChessBoard/ChessBoard.h | 40 +++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 Sem. 15/Chess/ChessBoard/ChessBoard.h (limited to 'Sem. 15/Chess/ChessBoard/ChessBoard.h') diff --git a/Sem. 15/Chess/ChessBoard/ChessBoard.h b/Sem. 15/Chess/ChessBoard/ChessBoard.h new file mode 100644 index 0000000..1825119 --- /dev/null +++ b/Sem. 15/Chess/ChessBoard/ChessBoard.h @@ -0,0 +1,40 @@ +#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; +}; \ No newline at end of file -- cgit v1.3.1-23-gd82d