private List <List <int> > ConvertBoard() { List <List <int> > boardIndexes = new List <List <int> >(); List <ulong> boardList = chessboard.BoardList(); foreach (ulong b in boardList) { boardIndexes.Add(Moves.ConvertBitboard(b)); } return(boardIndexes); }
public void MoveCharEnpassant(int new_index) { ulong enpassant = Moves.GetEnPassant(new_index, chessboard); if (enpassant != 0) { int enp_index = Moves.ConvertBitboard(enpassant)[0]; int enp_rank = enp_index / 8; int enp_file = enp_index % 8; _myboard[enp_rank, enp_file] = '-'; _captured = true; } }
private void DisplayMoves(ulong moves) { ResetColor(); List <int> valid_moves = Moves.ConvertBitboard(moves); foreach (int i in valid_moves) { buttons[i].Background = Brushes.Green; } if (board.DisplayCheck) { DisplayCheck(); } }
public void MoveCharCastle() { if (_castle[0] != 0) { int og_castle = Moves.ConvertBitboard(_castle[1])[0]; int new_castle = Moves.ConvertBitboard(_castle[0])[0]; int og_rank = og_castle / 8; int og_file = og_castle % 8; int new_rank = new_castle / 8; int new_file = new_castle % 8; char piece = _myboard[og_rank, og_file]; _myboard[og_rank, og_file] = '-'; _myboard[new_rank, new_file] = piece; } }
public bool IsCheck(ulong move, int selected, Game.PieceColor color) { List <int> index = Moves.ConvertBitboard(move); MoveBitBoard(selected, index[0]); ulong attacks; ulong king; if (color == Game.PieceColor.White) { king = chessboard.WhiteKing; attacks = Moves.GetAllBlackMoves(chessboard); } else { king = chessboard.BlackKing; attacks = Moves.GetAllWhiteMoves(chessboard); } UndoLastMoveBitBoard(); return((king & attacks) != 0); }