本文整理汇总了C++中Board::AddBlockH方法的典型用法代码示例。如果您正苦于以下问题:C++ Board::AddBlockH方法的具体用法?C++ Board::AddBlockH怎么用?C++ Board::AddBlockH使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Board
的用法示例。
在下文中一共展示了Board::AddBlockH方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: StepRight
void SolverTest::StepRight()
{
Board board;
int blockId = board.AddBlockH(0,0,4);
VisitedNode visitedNodes;
Step step;
auto res = step.Solve(1, board, visitedNodes);
QCOMPARE((int)res.size(), 0);
QCOMPARE((int)visitedNodes.Children().size(), 2);
QCOMPARE((int)step.Children().size(), 2);
QCOMPARE(step.Children()[0].MoveDesc(), MoveDescription(blockId, Direction::Right, 1));
QCOMPARE(step.Children()[1].MoveDesc(), MoveDescription(blockId, Direction::Right, 2));
}
示例2: vNodeAddH
void SolverTest::vNodeAddH()
{
VisitedNode root;
Board board;
board.AddBlockH(0,2,4);
board.SetBlockF(3,4);
QVERIFY2(!root.HadNodeBeforeCall(board), "0");
QCOMPARE((int)root.Children().size(), 1);
QCOMPARE((int)root.Children()[0].Children().size(), 1);
QCOMPARE((int)root.Children()[0].Children()[0].Children().size(), 0);
QCOMPARE(root.Children()[0].Position(), IntVector(2,0));
QCOMPARE(root.Children()[0].Children()[0].Position(), IntVector(3,4));
}
示例3: vNodeAddHTwoPos
void SolverTest::vNodeAddHTwoPos()
{
VisitedNode root;
Board board;
int blockId = board.AddBlockH(0,1,2);
board.SetBlockF(4,6);
root.HadNodeBeforeCall(board);
board.MoveRight(blockId, 1);
QVERIFY2(!root.HadNodeBeforeCall(board), "0");
QCOMPARE((int)root.Children().size(), 2);
QCOMPARE((int)root.Children()[0].Children().size(), 1);
QCOMPARE((int)root.Children()[1].Children().size(), 1);
QCOMPARE((int)root.Children()[0].Children()[0].Children().size(), 0);
QCOMPARE((int)root.Children()[1].Children()[0].Children().size(), 0);
QCOMPARE(root.Children()[0].Position(), IntVector(1,0));
QCOMPARE(root.Children()[1].Position(), IntVector(2,0));
QCOMPARE(root.Children()[0].Children()[0].Position(), IntVector(4,6));
QCOMPARE(root.Children()[1].Children()[0].Position(), IntVector(4,6));
}