public void c_ColorPieceLocation()
        {
            var engine = new Engine();

            Assert.AreEqual(ChessPieceColor.White, engine.GetPieceColorAt(3, 6));
            Assert.AreEqual(ChessPieceColor.Black, engine.GetPieceColorAt(0, 0));
        }
 /*
  *Checks is the player is white return true if is.
  */
 public static bool IsWhiteMove(String fn)
 {
     bool move = false;
     Engine Tengine = new Engine(fn);
     string whitemove = "White";
     if (whitemove.Equals(Tengine.ChessBoard.WhoseMove.ToString()))
     {
         move = true;
     }
     return move;
 }
        /*
         * This is the process Driver This class handles all the checkes at the top most level
         * Each failed check throws the exception.
         */
        public static String processChess(String move, String board)
        {
            byte sColumn;
            byte sRow;
            byte dColumn;
            byte dRow;
            char csColumn;
            char scrow;
            char cdColumn;
            char dcrow;
            Engine engine = null;
            String fen;
            /*
             * This if/else checks for the move string throws and exception if null is passed in
             * This also checks and verify if the string is correct format it will throw
             * the exceptions
             */
            if (move != null)
            {
                int space = move.LastIndexOf(" ");
                if (space == -1)
                {
                    throw new System.ArgumentException("The move sting is in the wrong format missing space between moves", "Chess");
                }
                Byte[] bytes = Encoding.ASCII.GetBytes(move.ToLower());
                csColumn = (char)bytes[space - 2];
                sColumn = GetByteFromCharL(csColumn);
                scrow = (char)bytes[space - 1];
                sRow = GetByteFromCharN(scrow);
                cdColumn = (char)bytes[space + 1];
                dColumn = GetByteFromCharL(cdColumn);
                dcrow = (char)bytes[space + 2];

                dRow = GetByteFromCharN((char)bytes[space + 2]);

            }
            else
            {
                throw new System.ArgumentException("The move sting is null", "Chess");
            }

            /*
             * This if/else  checks for the board to be null or not and creates the engine
             */
            if (board != null)
            {
                engine = new Engine(board);

            }
            else
            {
                engine = new Engine();
            }

            String pieceColor = engine.GetPieceColorAt(sColumn, sRow).ToString();
            String moveColor = engine.WhoseMove.ToString();

            /*
             *  Checks the piece color with the move color if they are not the same throws and exception
             */
            if (!pieceColor.Equals(moveColor))
            {
                throw new System.ArgumentException("THE PIECE YOU ARE MOVING IS NOT YOUR COLOR PLEASE MOVE YOUR COLOR", "Chess");
            }

            /*
             *  Check to make sure the move is valid and make sure the FEN is valid
             */
            if (engine.IsValidMove(sColumn, sRow, dColumn, dRow))
            {
                /*
                *     Checks to make sure th move is complete
                */
                if (!engine.MovePiece(sColumn, sRow, dColumn, dRow))
                {
                    throw new System.ArgumentException("MOVED FAILED PLEASE RESEND", "Chess");
                }
            }
            else
            {
                throw new System.ArgumentException("Invalid Move or Malformed FEN", "Chess");
            }

            fen = Fen(false, engine.ChessBoard);
            return fen;
        }
 public static Board board(String Fn)
 {
     Engine engine = new Engine(Fn);
      return engine.ChessBoard;
 }
 public void c_NotValidMove()
 {
     var engine = new Engine();
     Assert.IsFalse(engine.IsValidMove(3, 4, 3, 6));
 }
 public void c_EngineCheck()
 {
     var engine = new Engine();
     Assert.IsNotNull(engine);
     var newengine = new Engine("rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1");
     Assert.IsNotNull(newengine);
 }
 public void c_ValidMove()
 {
     var engine = new Engine();
     Assert.IsTrue(engine.IsValidMove(3, 6, 3, 4));
 }
 public void c_SetMove()
 {
     var engine = new Engine();
     Assert.IsTrue(engine.MovePiece(3, 6, 3, 4));
 }
 public void c_PieceType()
 {
     var engine = new Engine();
     String test = engine.GetPieceTypeAt(2, 0).ToString();
     Assert.AreEqual(ChessPieceType.Rook, engine.GetPieceTypeAt(0, 0));
     Assert.AreEqual(ChessPieceType.Knight, engine.GetPieceTypeAt(1, 0));
     Assert.AreEqual(ChessPieceType.Bishop, engine.GetPieceTypeAt(2, 0));
     Assert.AreEqual(ChessPieceType.Queen, engine.GetPieceTypeAt(3, 0));
     Assert.AreEqual(ChessPieceType.King, engine.GetPieceTypeAt(4, 0));
     Assert.AreEqual(ChessPieceType.Bishop, engine.GetPieceTypeAt(5, 0));
     Assert.AreEqual(ChessPieceType.Knight, engine.GetPieceTypeAt(6, 0));
     Assert.AreEqual(ChessPieceType.Rook, engine.GetPieceTypeAt(7, 0));
     Assert.AreEqual(ChessPieceType.Pawn, engine.GetPieceTypeAt(7, 1));
 }