Example #1
0
        public void Internal_GiveBestMove_GivenFEN(UCIEngine stockfish)
        {
            // back rank mate
            string fen = "k3r3/pp6/8/3NQ3/8/8/3q1PPP/6K1 w - - 0 1";
            string expected = "e5e8";

            string bestMove = stockfish.GiveBestMove (fen);
            Assert.AreEqual (expected, bestMove);

            // smothered mate
            fen = "k2r4/pp6/8/3NQ3/8/8/3q1PPP/6K1 w - - 0 1";
            expected = "d5c7";

            bestMove = stockfish.GiveBestMove (fen);
            Assert.AreEqual (expected, bestMove);
        }
Example #2
0
        private void Internal_AnalysisMode_CanChange(UCIEngine stockfish)
        {
            // back rank mate
            string fen = "k3r3/pp6/8/3NQ3/8/8/3q1PPP/6K1 w - - 0 1";
            string move = "e5e8";

            IScore score = stockfish.GetScore (fen, move);
            Assert.AreEqual (1.0, score.Value);
        }
Example #3
0
 public void IncaseEngineCouldNotBeStarted_ExceptionIsExpected()
 {
     var badEngine = new UCIEngine(new ProcessStartInfo("stuckfish"));
     Assert.Throws<EngineCouldNotBeStartedException>(() => badEngine.Start ());
 }
Example #4
0
        public void Internal_GivenPositionAndAMove_ReturnScore(UCIEngine stockfish)
        {
            // back rank mate
            string fen = "k3r3/pp6/8/3NQ3/8/8/3q1PPP/6K1 w - - 0 1";
            string move = "e5e8";

            IScore score = stockfish.GetScore (fen, move);
            Assert.AreEqual (1.0, score.Value);

            // smothered mate
            fen = "k2r4/pp6/8/3NQ3/8/8/3q1PPP/6K1 w - - 0 1";
            move = "d5c7";

            score = stockfish.GetScore (fen, move);
            Assert.AreEqual (4.0, score.Value);

            // start position
            fen = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1";
            move = "e2e4";

            score = stockfish.GetScore (fen, move);
            Assert.Greater (score.Value, 1);
        }