Modified the rule to only allow moves for selected piece

This commit is contained in:
2025-12-13 18:44:27 +08:00
parent 034c1a858e
commit 3d73994360

View File

@@ -106,11 +106,10 @@ bool Rule::canSpore(const Board* board, const int fromRow, const int fromCol, co
int toPieceID = board->getPieceID(toRow, toCol);
auto selectedComponent = board->getComponentByPieceID(fromPieceID);
std::cout << "before action Component size: " << selectedComponent.size() << "\n";
for (auto PieceID : selectedComponent) {
auto SporeRegion = board->getSporeRange(PieceID);
if (SporeRegion.find(toPieceID) != SporeRegion.end()) {
return true;
}
auto SporeRegion = board->getSporeRange(fromPieceID);
if (SporeRegion.find(toPieceID) != SporeRegion.end()) {
return true;
}
return false;