コード例 #1
0
        public void PegBoardGetPegNeighboursFrom33Test()
        {
            // Arrange
            var pegBoard = PegBoard.FromSource(TestBoardSource.CreateDefault());

            // Act
            var actual = pegBoard.GetPegUpNeighboursFrom(Peg.Create(3, 3));

            // Assert
            Assert.AreEqual(2, actual.Count());
            Assert.IsTrue(actual.Contains(Peg.Create(1, 3)));
            Assert.IsTrue(actual.Contains(Peg.Create(2, 4)));
        }
コード例 #2
0
        public void PegBoardGetPegNeighboursFromBoardTest()
        {
            // Arrange
            var pegBoard = PegBoard.FromSource(TestBoardSource.CreateDefault());

            // Act
            var actual = pegBoard.GetPegUpNeighboursFrom(Peg.Create(4, 0));

            // Assert
            Assert.AreEqual(1, actual.Count());
            Assert.IsTrue(actual.Contains(Peg.Create(3, 1)));
            Assert.AreEqual(Peg.PegProbality, actual.ElementAt(0).Probability);
        }
コード例 #3
0
        public void PoorManMemoizingPegsSolutionResolveTest()
        {
            // Arrange
            var pegBoard          = PegBoard.FromSource(TestBoardSource.CreateDefault());
            var pegsBoardIterator = PoorManMemoizingPegsSolution.Create(pegBoard);

            // Act
            pegsBoardIterator.Resolve();
            var actual = pegsBoardIterator.GetBestPositions();

            // Assert
            Assert.IsNotNull(actual);
            Assert.AreEqual(Peg.Create(1, 1), actual.ElementAt(0));
            Assert.AreEqual(0.625, actual.ElementAt(0).Probability);
        }