UTests pass with Pathfinder2D

This commit is contained in:
2021-02-28 07:52:28 -06:00
parent 715b328ef5
commit f55716d2ec
24 changed files with 687 additions and 294 deletions

View File

@@ -75,7 +75,7 @@ namespace Gameboard.ShogiUI.UnitTests.BoardState
To = new Vector2(0, 3)
}
};
var shogi = ShogiBoard.ConstructWithMoves(moves);
var shogi = new ShogiBoard(moves);
shogi.Board[0, 2].Should().BeNull();
shogi.Board[0, 3].WhichPiece.Should().Be(WhichPiece.Pawn);
}
@@ -99,9 +99,9 @@ namespace Gameboard.ShogiUI.UnitTests.BoardState
{
var invalidLanceMove = new Move
{
// Lance moving adjacent
From = new Vector2(0, 0),
To = new Vector2(1, 5)
// Bishop moving lateral
From = new Vector2(1, 1),
To = new Vector2(2, 1)
};
var shogi = new ShogiBoard();
@@ -177,16 +177,12 @@ namespace Gameboard.ShogiUI.UnitTests.BoardState
// P1 Bishop puts P2 in check
new Move { From = new Vector2(1, 1), To = new Vector2(6, 6) }
};
var shogi = ShogiBoard.ConstructWithMoves(moves);
//foreach(var m in moves)
//{
// shogi.Move(m);
//}
//var shogi = new ShogiBoard(moves);
var shogi = new ShogiBoard(moves);
// Prerequisit
shogi.InCheck.Should().Be(WhichPlayer.Player2);
// Act - P2 moves Lance while remaining in check.
var moveSuccess = shogi.Move(new Move { From = new Vector2(8, 8), To = new Vector2(8, 7) });
@@ -208,7 +204,8 @@ namespace Gameboard.ShogiUI.UnitTests.BoardState
// P2 Pawn
new Move { From = new Vector2(6, 6), To = new Vector2(6, 5) },
};
var shogi = ShogiBoard.ConstructWithMoves(moves);
var shogi = new ShogiBoard(moves);
shogi.PrintStateAsAscii();
// Act - P1 Bishop, check
@@ -229,7 +226,7 @@ namespace Gameboard.ShogiUI.UnitTests.BoardState
// P2 Pawn
new Move { From = new Vector2(6, 6), To = new Vector2(6, 5) }
};
var shogi = ShogiBoard.ConstructWithMoves(moves);
var shogi = new ShogiBoard(moves);
// Act - P1 Bishop captures P2 Bishop
var moveSuccess = shogi.Move(new Move { From = new Vector2(1, 1), To = new Vector2(7, 7) });
@@ -275,7 +272,7 @@ namespace Gameboard.ShogiUI.UnitTests.BoardState
// P2 Pawn
new Move { From = new Vector2(6, 6), To = new Vector2(6, 5) }
};
var shogi = ShogiBoard.ConstructWithMoves(moves);
var shogi = new ShogiBoard(moves);
// Act - P1 moves across promote threshold.
var moveSuccess = shogi.Move(new Move { From = new Vector2(1, 1), To = new Vector2(6, 6), IsPromotion = true });
@@ -313,7 +310,7 @@ namespace Gameboard.ShogiUI.UnitTests.BoardState
// P2 King retreat
new Move { From = new Vector2(4, 7), To = new Vector2(4, 8) },
};
var shogi = ShogiBoard.ConstructWithMoves(moves);
var shogi = new ShogiBoard(moves);
// Act - P1 Pawn wins by checkmate.
var moveSuccess = shogi.Move(new Move { From = new Vector2(4, 6), To = new Vector2(4, 7) });