Пример #1
0
 public void test_generate_sequence_pathsize_1()
 {
     Board b = new Board();
     IMoveStrategy strategy = new KnightMoveStrategy(b);
     SequenceGenerator generator = new SequenceGenerator(b, strategy, 10);
     int count = generator.CountAllSequences();
     Assert.IsTrue(count > 0);
 }
Пример #2
0
 static void Main(string[] args)
 {
     Board b = new Board();
     IMoveStrategy moveStrategy = new KnightMoveStrategy(b);
     SequenceGenerator generator = new SequenceGenerator(b, moveStrategy, 3);
     int numMoves = generator.CountAllSequences();
     Console.WriteLine(numMoves.ToString());
     //Console.ReadLine();
 }
Пример #3
0
        public void test_get_possible_moves()
        {
            Board b = new Board();
            var strategy = new KnightMoveStrategy(b);
            var results = strategy.GetPossibleMoves(Key.H);
            Assert.AreEqual(6, results.Count);

            results = strategy.GetPossibleMoves(Key.A);
            Assert.AreEqual(2, results.Count);
        }
Пример #4
0
        public void test_count_sequences_from_key()
        {
            Board b = new Board();
            IMoveStrategy strategy = new KnightMoveStrategy(b);
            SequenceGenerator generator = new SequenceGenerator(b, strategy, 2);
            int numMoves = generator.CountSequencesFromKey(Key.A, new KeypadSequence().Add(Key.A));

            Assert.AreEqual(2, numMoves);

            numMoves = generator.CountSequencesFromKey(Key.H, new KeypadSequence().Add(Key.H));
            Assert.AreEqual(6, numMoves);
        }