示例#1
0
        public void ApplyReverseMove()
        {
            PieceGrid grid = GetPieceGrid();

            Assert.AreEqual(AmazonPlayer2.Get(), grid.PointPieces[Point.Get(6, 1)]);
            Assert.AreEqual(ArrowPlayer2.Get(), grid.PointPieces[Point.Get(6, 4)]);
            Assert.AreEqual(Open.Get(), grid.PointPieces[Point.Get(5, 0)]);
            Assert.IsTrue(grid.Amazon2Points.Contains(Point.Get(6, 1)));
            Assert.IsFalse(grid.Amazon2Points.Contains(Point.Get(5, 0)));
            grid.ApplyReverseMove(new Move(Point.Get(5, 0), Point.Get(6, 1), Point.Get(6, 4)));
            Assert.AreEqual(Open.Get(), grid.PointPieces[Point.Get(6, 1)]);
            Assert.AreEqual(AmazonPlayer2.Get(), grid.PointPieces[Point.Get(5, 0)]);
            Assert.AreEqual(Open.Get(), grid.PointPieces[Point.Get(6, 4)]);
            Assert.IsTrue(grid.Amazon2Points.Contains(Point.Get(5, 0)));
            Assert.IsFalse(grid.Amazon2Points.Contains(Point.Get(6, 1)));
        }
示例#2
0
        private PieceGrid GetPieceGrid()
        {
            Point[] arrow1Points = { Point.Get(7, 3), Point.Get(1, 6), Point.Get(2, 4), Point.Get(2, 9), Point.Get(3, 8), Point.Get(4, 8), Point.Get(5, 4), Point.Get(5, 5), Point.Get(5, 7), Point.Get(7, 0), Point.Get(7, 7), Point.Get(8, 7), Point.Get(9, 2) };
            Point[] arrow2Points = { Point.Get(0, 0), Point.Get(0, 5), Point.Get(1, 4), Point.Get(2, 6), Point.Get(2, 7), Point.Get(3, 7), Point.Get(4, 6), Point.Get(4, 9), Point.Get(6, 4), Point.Get(6, 7), Point.Get(1, 2), Point.Get(7, 4), Point.Get(8, 6) };
            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 arrow1Points)
            {
                grid.PointPieces[p] = ArrowPlayer1.Get();
            }
            foreach (Point p in arrow2Points)
            {
                grid.PointPieces[p] = ArrowPlayer2.Get();
            }
            return(grid);
        }