Example #1
0
        public string GetFen()
        {
            var sb = new StringBuilder();

            sb.Append(Board.GetFenCode(FenMode.Classical));
            sb.Append(" ");

            sb.Append(WhosTurn == PlayerAffiliation.White ? 'w' : 'b');
            sb.Append(" ");

            var fenWhite = White.GetFenCastle();
            var fenBlack = Black.GetFenCastle();

            if (fenWhite == string.Empty && fenBlack == string.Empty)
            {
                sb.Append("-");
            }
            else
            {
                sb.Append(fenWhite);
                sb.Append(fenBlack);
            }
            sb.Append(" ");

            sb.Append("-");
            sb.Append(" ");

            sb.Append(HalfmovesSinceLastCaptureOrPawn);
            sb.Append(" ");

            sb.Append(Movecounter);
            sb.Append(" ");

            return(sb.ToString());
        }