private PieceGrid GetPieceGrid() { Point[] arrowPoints = { Point.Get(2, 9), Point.Get(4, 9), Point.Get(3, 8), Point.Get(4, 8), Point.Get(2, 7), Point.Get(3, 7), Point.Get(5, 7), Point.Get(6, 7), Point.Get(7, 7), Point.Get(8, 7), Point.Get(1, 6), Point.Get(2, 6), Point.Get(4, 6), Point.Get(8, 6), Point.Get(0, 5), Point.Get(5, 5), Point.Get(1, 4), Point.Get(2, 4), Point.Get(5, 4), Point.Get(6, 4), Point.Get(7, 4), Point.Get(7, 3), Point.Get(1, 2), Point.Get(9, 2), Point.Get(0, 0), Point.Get(7, 0), }; Dictionary <Point, Amazon> amazonsDict = new Dictionary <Point, Amazon> { { Point.Get(2, 8), AmazonPlayer1.Get() }, { Point.Get(6, 6), AmazonPlayer1.Get() }, { Point.Get(3, 3), AmazonPlayer1.Get() }, { Point.Get(7, 2), AmazonPlayer1.Get() }, { Point.Get(3, 9), AmazonPlayer2.Get() }, { Point.Get(4, 7), AmazonPlayer2.Get() }, { Point.Get(3, 1), AmazonPlayer2.Get() }, { Point.Get(6, 1), AmazonPlayer2.Get() } }; PieceGrid grid = new PieceGrid(10, amazonsDict); foreach (Point p in arrowPoints) { grid.PointPieces[p] = ArrowPlayer1.Get(); } return(grid); }
public void PointsOutFrom3() { HashSet <Point> answer = new HashSet <Point>() { }; PieceGrid grid = new PieceGrid(10, PieceHelpers.GetInitialAmazonPositions(10)); grid.PointPieces[Point.Get(0, 4)] = ArrowPlayer1.Get(); grid.PointPieces[Point.Get(1, 4)] = ArrowPlayer1.Get(); grid.PointPieces[Point.Get(1, 3)] = ArrowPlayer1.Get(); grid.PointPieces[Point.Get(1, 2)] = ArrowPlayer1.Get(); grid.PointPieces[Point.Get(0, 2)] = ArrowPlayer1.Get(); IEnumerable <Point> points = grid.GetOpenPointsOutFrom(Point.Get(0, 3)); Assert.IsTrue(points.ToSet().SetEquals(answer)); }
public void ApplyMove() { PieceGrid grid = new PieceGrid(10, PieceHelpers.GetInitialAmazonPositions(10)); Assert.AreEqual(AmazonPlayer1.Get(), grid.PointPieces[Point.Get(0, 3)]); Assert.AreEqual(Open.Get(), grid.PointPieces[Point.Get(6, 3)]); Assert.AreEqual(Open.Get(), grid.PointPieces[Point.Get(6, 7)]); Assert.IsTrue(grid.Amazon1Points.Contains(Point.Get(0, 3))); Assert.IsFalse(grid.Amazon1Points.Contains(Point.Get(6, 3))); grid.ApplyMove(new Move(Point.Get(0, 3), Point.Get(6, 3), Point.Get(6, 7))); Assert.AreEqual(Open.Get(), grid.PointPieces[Point.Get(0, 3)]); Assert.AreEqual(AmazonPlayer1.Get(), grid.PointPieces[Point.Get(6, 3)]); Assert.AreEqual(ArrowPlayer1.Get(), grid.PointPieces[Point.Get(6, 7)]); Assert.IsTrue(grid.Amazon1Points.Contains(Point.Get(6, 3))); Assert.IsFalse(grid.Amazon1Points.Contains(Point.Get(0, 3))); }
static void RenderSpecificState() { Point[] arrowPoints = { Point.Get(2, 9), Point.Get(4, 9), Point.Get(3, 8), Point.Get(4, 8), Point.Get(2, 7), Point.Get(3, 7), Point.Get(5, 7), Point.Get(6, 7), Point.Get(7, 7), Point.Get(8, 7), Point.Get(1, 6), Point.Get(2, 6), Point.Get(4, 6), Point.Get(8, 6), Point.Get(0, 5), Point.Get(5, 5), Point.Get(1, 4), Point.Get(2, 4), Point.Get(5, 4), Point.Get(6, 4), Point.Get(7, 4), Point.Get(7, 3), Point.Get(1, 2), Point.Get(9, 2), Point.Get(0, 0), Point.Get(7, 0), }; Dictionary <Point, Amazon> amazonsDict = new Dictionary <Point, Amazon> { { Point.Get(2, 8), AmazonPlayer1.Get() }, { Point.Get(6, 6), AmazonPlayer1.Get() }, { Point.Get(3, 3), AmazonPlayer1.Get() }, { Point.Get(7, 2), AmazonPlayer1.Get() }, { Point.Get(3, 9), AmazonPlayer2.Get() }, { Point.Get(4, 7), AmazonPlayer2.Get() }, { Point.Get(3, 1), AmazonPlayer2.Get() }, { Point.Get(6, 1), AmazonPlayer2.Get() } }; PieceGrid grid = new PieceGrid(10, amazonsDict); foreach (Point p in arrowPoints) { grid.PointPieces[p] = ArrowPlayer1.Get(); } Game game = new Game(); game.Begin(null, null, 10); game.CurrentBoard.PieceGrid = grid; AnalysisGraph analysisGraph = new AnalysisGraph(); analysisGraph.BuildAnalysis(game.CurrentBoard.PieceGrid, game.CurrentPlayer); AmazonConsoleRenderer.Render(game, analysisGraph); }