1234567891011121314151617181920212223242526 |
- #include "Chessboard.h"
- #include "Figure.h"
- #include <iostream>
- Chessboard::Chessboard(vector<Figure*> figures)
- {
- board = new Cell*[8];
- for(int i = 0; i < 8; i++) board[i] = new Cell[8];
- Position p;
- for(int i = 0; i < figures.size(); i++) {
- p = figures[i]->get_position();
- board[p.posNum-'0'-1][p.posSym-'A'] = Cell(figures[i]);
- }
- }
- std::ostream& operator <<(std::ostream& out, Chessboard& chess)
- {
- for (int i = 0; i < 8; i++) {
- for(int j = 0; j < 8; j++) {
- out << chess.board[i][j];
- }
- out << '\n';
- }
- return out;
- }
|