Example #1
0
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(FullMove obj) {
   return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
 }
Example #2
0
        public void SetFenFromGame()
        {
            string newFEN = "";

            for (int i = 21; i < 99; i++)
            {
                if (Pieces[i] != null)
                {
                    if (Pieces[i].GetType() == typeof(Pawn))
                    {
                        if (Pieces[i].Color == "black")
                        {
                            newFEN = newFEN + "p";
                        }
                        else
                        {
                            newFEN = newFEN + "P";
                        }
                    }
                    else if (Pieces[i].GetType() == typeof(Rook))
                    {
                        if (Pieces[i].Color == "black")
                        {
                            newFEN = newFEN + "r";
                        }
                        else
                        {
                            newFEN = newFEN + "R";
                        }
                    }
                    else if (Pieces[i].GetType() == typeof(Knight))
                    {
                        if (Pieces[i].Color == "black")
                        {
                            newFEN = newFEN + "n";
                        }
                        else
                        {
                            newFEN = newFEN + "N";
                        }
                    }
                    else if (Pieces[i].GetType() == typeof(Bishop))
                    {
                        if (Pieces[i].Color == "black")
                        {
                            newFEN = newFEN + "b";
                        }
                        else
                        {
                            newFEN = newFEN + "B";
                        }
                    }
                    else if (Pieces[i].GetType() == typeof(Queen))
                    {
                        if (Pieces[i].Color == "black")
                        {
                            newFEN = newFEN + "q";
                        }
                        else
                        {
                            newFEN = newFEN + "Q";
                        }
                    }
                    else if (Pieces[i].GetType() == typeof(King))
                    {
                        if (Pieces[i].Color == "black")
                        {
                            newFEN = newFEN + "k";
                        }
                        else
                        {
                            newFEN = newFEN + "K";
                        }
                    }
                }
                else if (Pieces[i] == null)
                {
                    //see if last square has a number for the FEN has a number...that's one way to do it.
                    //another way is to count the next suares until the next forward slash and see how many of them are empty
                    int emptySquareCnt = 0;
                    while (Pieces[i] == null)
                    {
                        if (i % 10 == 8)
                        {
                            emptySquareCnt++;
                            break;
                        }
                        emptySquareCnt++;
                        i++;
                    }
                    newFEN = newFEN + emptySquareCnt.ToString();
                }

                if (i % 10 == 8)
                {
                    if (i != 98)
                    {
                        newFEN = newFEN + "/";
                    }
                    i = i + 2;
                }
            }
            string TurnString = "";

            if (Turn == 1)
            {
                TurnString = "w";
            }
            if (Turn == 2)
            {
                TurnString = "b";
            }
            newFEN = newFEN + " " + TurnString + " " + CastleRights + " " + enPassant + " " + Halfmove.ToString() + " " + FullMove.ToString();

            CurrentFEN = newFEN;
        }
Example #3
0
 public void setAmbiguous(FullMove move2) {
   ScidPINVOKE.FullMove_setAmbiguous(swigCPtr, FullMove.getCPtr(move2));
   if (ScidPINVOKE.SWIGPendingException.Pending) throw ScidPINVOKE.SWIGPendingException.Retrieve();
 }
Example #4
0
 public void fillSANInfo(FullMove lastmove) {
   ScidPINVOKE.FastBoard_fillSANInfo(swigCPtr, FullMove.getCPtr(lastmove));
   if (ScidPINVOKE.SWIGPendingException.Pending) throw ScidPINVOKE.SWIGPendingException.Retrieve();
 }