本文整理匯總了C#中Board.SetBomb方法的典型用法代碼示例。如果您正苦於以下問題:C# Board.SetBomb方法的具體用法?C# Board.SetBomb怎麽用?C# Board.SetBomb使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Board
的用法示例。
在下文中一共展示了Board.SetBomb方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: TestGetCoutOfAroundBombs4
public void TestGetCoutOfAroundBombs4()
{
var board = new Board(10, 10);
board.SetBomb(1, 0);
board.SetBomb(0, 1);
Assert.That(board.GetCountOfAroundBombs(0, 0), Is.EqualTo(2));
}
示例2: TestGetCoutOfAroundBombs6
public void TestGetCoutOfAroundBombs6()
{
var board = new Board(3, 3);
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 3; j++)
{
if (i != 1 || j != 2)
board.SetBomb(i, j);
}
}
Assert.That(board.GetCountOfAroundBombs(1, 2), Is.EqualTo(5));
}
示例3: TestGetCoutOfAroundBombs5
public void TestGetCoutOfAroundBombs5()
{
var board = new Board(5, 5);
board.SetBomb(4, 4);
board.SetBomb(2, 3);
Assert.That(board.GetCountOfAroundBombs(4, 2), Is.EqualTo(0));
}
示例4: WhenTouchZero_TheresOneBombs3
public void WhenTouchZero_TheresOneBombs3()
{
var board = new Board(5, 5);
board.SetBomb(4, 4);
board.SetBomb(2, 3);
board.Touch(0, 0);
var notOpendCellIndexes = new []{ Tuple.Create(2, 3), Tuple.Create(2, 4), Tuple.Create(3, 4), Tuple.Create(4, 4) };
for (int x = 0; x < 5; ++x)
for (int y = 0; y < 5; ++y)
{
if (notOpendCellIndexes.Any(idx => idx.Item1 == x && idx.Item2 == y))
{
Assert.That(board.GetCell(x, y).IsOpened, Is.False);
}
else
{
Assert.That(board.GetCell(x, y).IsOpened, Is.True);
}
}
}
示例5: WhenTouchZero_TheresOneBombs2
public void WhenTouchZero_TheresOneBombs2()
{
var board = new Board(5, 5);
board.SetBomb(4, 4);
board.Touch(0, 0);
for (int x = 0; x < 5; ++x)
for (int y = 0; y < 5; ++y)
{
if (x == 4 && y == 4)
{
Assert.That(board.GetCell(x, y).IsOpened, Is.False);
}
else
{
Assert.That(board.GetCell(x, y).IsOpened, Is.True);
}
}
}
示例6: WhenTouchZero_TheresOneBombs
public void WhenTouchZero_TheresOneBombs()
{
var board = new Board(3, 3);
board.SetBomb(2, 2);
board.Touch(0, 0);
for (int x = 0; x < 3; ++x)
for (int y = 0; y < 3; ++y)
{
if (x == 2 && y == 2)
{
Assert.That(board.GetCell(x, y).IsOpened, Is.False);
}
else
{
Assert.That(board.GetCell(x, y).IsOpened, Is.True);
}
}
}
示例7: WhenTouchBomb_GameOver3
public void WhenTouchBomb_GameOver3()
{
var board = new Board(10, 10);
board.SetBomb(1, 1);
board.Touch(1, 2);
Assert.That(board.State, Is.Not.EqualTo(GameState.GameOver));
}
示例8: TouchSafetyCell
public void TouchSafetyCell()
{
var board = new Board(3, 3);
board.SetBomb(2, 2);
board.Touch(1, 0);
for (int x = 0; x < 3; ++x)
for (int y = 0; y < 3; ++y)
{
if (x == 2 && y == 2)
{
Assert.That(board.GetCell(x, y).IsOpened, Is.False);
}
else
{
Assert.That(board.GetCell(x, y).IsOpened, Is.True);
}
}
}