public static string PosToString(this int pos) { int file = BitboardUtils.GetFile(pos); int rank = BitboardUtils.GetRank(pos); char c = (char)(97 + file); return(c.ToString() + (rank + 1)); }
/// <summary> /// Gets a list of tuples with piece information: square index, player, piece type. /// For use by the GUI. /// </summary> /// <returns></returns> public List <Tuple <int, int, PieceType> > GetPiecesList() { List <Tuple <int, int, PieceType> > pieces = new List <Tuple <int, int, PieceType> >(); for (int pl = 0; pl < 2; pl++) { for (int i = 0; i < 6; i++) { ulong piecesBB = Pieces[pl, i]; while (piecesBB > 0) { int sqInd = BitboardUtils.PopLSB(ref piecesBB); Tuple <int, int, PieceType> piece = new Tuple <int, int, PieceType>(sqInd, pl, (PieceType)i); pieces.Add(piece); } } } return(pieces); }
public static string PosToString(this ulong bb) { int sqInd = BitboardUtils.BitScanForward(bb); return(sqInd.PosToString()); }