Add ConnectedComponentManager

This commit is contained in:
2025-11-26 15:20:18 +08:00
parent ff2ddc6fd4
commit d43ca4394d
9 changed files with 379 additions and 9 deletions

View File

@@ -0,0 +1,24 @@
#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();
};