Files
SporeBG-Conid/src/core/Board.h

24 lines
503 B
C++
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#pragma once
#include "Piece.h"
#include <memory>
#include <vector>
// 用 (row, col) 表示坐标0-based
struct Position {
int row;
int col;
//运算符重载用于判断位置是否相等
bool operator==(const Position& other) const {
return row == other.row && col == other.col;
}
};
class Board {
private:
std::vector<std::vector<std::unique_ptr<Piece>>> m_grid;
const int m_rows;
const int m_cols;
public:
Board(int rows, int cols);
~Board();
};