public static void MakeMove(int col) { var boardState = 1UL >> 7; var board = (boardState + Position.BottomMaskCol(col)) & Position.ColumnMask(col); var boardString = Utils.BitboardToString(board); Console.WriteLine(boardString); }
public static int ColumnPlayed(ulong move) { for (int i = 0; i < 7; i++) { var res = Position.ColumnMask(i) & move; if (res != 0) { return(i); } } throw new ArgumentNullException(); }
private void PrintColumnPlayed(ulong move, Player player) { for (int i = 0; i < 7; i++) { var res = Position.ColumnMask(i) & move; if (res != 0) { SB.AppendLine($"{player} played in column {i + 1}"); Console.WriteLine($"{player} played in column {i + 1}"); break; } } }
public IEnumerable <ulong> GetMoves() { for (int i = 0; i < 7; i++) { var col = ColumnOrder[i]; //var isValid = (Mask & columnValue) != columnValue; if (CanPlay(col)) { var columnValue = Position.ColumnMask(col); var count = BitOperations.PopCount(columnValue & Mask); var move = BitTesting.RowMask(count) & columnValue; yield return(move); } } }
public static void ColumnTest(int col) { var boardString = Utils.BitboardToString(Position.ColumnMask(col)); Console.WriteLine(boardString); }