Example #1
0
 public ChessBoard(ChessBoard c)
 {
     for (int i = 0; i <= pieceIndex.FLAGS; i++)
     {
         white[i] = new BitboardLayer(c.getDict(true)[i]);
         black[i] = new BitboardLayer(c.getDict(false)[i]);
     }
     white_ep = c.getEP(true);
     black_ep = c.getEP(false);
     moveList = new List<int[]>(c.getMoveList());
     moveNum = c.getMoveNum();
     ASG = c.getASG();
 }
Example #2
0
 public int[] getMoveList(ChessBoard cb)
 {
     List<int> retVal = new List<int>();
     var moveList = cb.getMoveList();
     foreach (int[] i in moveList)
     {
         retVal.Add(i[0]);
         retVal.Add(i[1]);
     }
     return retVal.ToArray();
 }
Example #3
0
 public bool matchesMoveList(ChessBoard cb)
 {
     ChessBoard test = new ChessBoard(null, null);
     var moveList = cb.getMoveList();
     for (int i = 0; i < moveList.Count; i++)
     {
         test.movePiece(i % 2 == 0, moveList[i][0], moveList[i][1], true);
     }
     //return cb.equals(test);
     return displayBoard(cb).Equals(displayBoard(test));
 }
Example #4
0
        public string displayBoard(ChessBoard c)
        {
            //for debugging purposes
            //capital letters are white, n's are knights
            char[] whiteLetters = new char[] { 'P', 'R', 'N', 'B', 'Q', 'K' };
            char[] blackLetters = new char[] {  'p', 'r', 'n', 'b', 'q', 'k' };

            char[] retVal = new char[64];
            for (int i = 0; i < 64; i++) retVal[i] = Convert.ToChar("+");
            BitboardLayer[] white = c.getDict(true);
            BitboardLayer[] black = c.getDict(false);
            for (int i = 0; i <= pieceIndex.KING; i++){
                foreach (int j in white[i].getTrueIndicies()) retVal[j] = whiteLetters[i];
                foreach (int j in black[i].getTrueIndicies()) retVal[j] = blackLetters[i];
            }
            string s = "";
            for (int i = 0; i < 64; i++){
                s += retVal[i];
                if (i % 8 == 7) s += "\n";
            }
            var ml = c.getMoveList();
            for (int i = 0; i < ml.Count; i++)
            {
                s += (i % 2 == 0 ? "White" : "Black") + ": [" + ml[i][0] + ", " + ml[i][1] + "]\n";
            }
            return s;
        }