Example #1
0
        public void Cell22()
        {
            var estrategies = new BoardVictoryAnalyser(Point.Make(2, 2));

            bool containsOnly = ContainsOnly(estrategies, BoardVictoryAnalyser.ThirdColumn, BoardVictoryAnalyser.ThirdRow, BoardVictoryAnalyser.LeftRightDiagonal);

            Assert.That(containsOnly);
        }
Example #2
0
        public void Cell21()
        {
            var estrategies = new BoardVictoryAnalyser(Point.Make(2, 1));

            bool containsOnly = ContainsOnly(estrategies, BoardVictoryAnalyser.ThirdColumn, BoardVictoryAnalyser.SecondRow);

            Assert.That(containsOnly);
        }
Example #3
0
        public void Cell10()
        {
            var estrategies = new BoardVictoryAnalyser(Point.Make(1, 0));

            bool containsOnly = ContainsOnly(estrategies, BoardVictoryAnalyser.SecondColumn, BoardVictoryAnalyser.FirstRow);

            Assert.That(containsOnly);
        }
Example #4
0
        public void Cell00()
        {
            var estrategies = new BoardVictoryAnalyser(Point.Make(0, 0));

            bool containsOnly = ContainsOnly(estrategies, BoardVictoryAnalyser.FirstColumn, BoardVictoryAnalyser.FirstRow, BoardVictoryAnalyser.LeftRightDiagonal);

            Assert.That(containsOnly);
        }
Example #5
0
        public void Cell11()
        {
            var estrategies = new BoardVictoryAnalyser(Point.Make(1, 1));

            bool containsOnly = ContainsOnly(estrategies, BoardVictoryAnalyser.SecondColumn, BoardVictoryAnalyser.SecondRow,
                                             BoardVictoryAnalyser.RightLeftDiagonal, BoardVictoryAnalyser.LeftRightDiagonal);

            Assert.That(containsOnly);
        }
Example #6
0
        bool ContainsOnly(BoardVictoryAnalyser strategie, params VictoryPatternStrategy[] funcs)
        {
            var others = new List <VictoryPatternStrategy> (BoardVictoryAnalyser.All);

            others.RemoveAll((d) => funcs.Contains(d));

            bool containsOnly = true;

            foreach (var f in funcs)
            {
                containsOnly = containsOnly && strategie.Contains(f);
            }

            foreach (var f in others)
            {
                containsOnly = containsOnly && !strategie.Contains(f);
            }

            return(containsOnly);
        }
Example #7
0
 private Board(Cell[,] rawData, BoardVictoryAnalyser checkStrategie)
 {
     m_board      = rawData;
     VictoryState = checkStrategie.Check(this);
 }