private static bool captureKernel(BoardBase board, List <Tuple <byte, byte> > captureList, byte row, byte col, WColor color) { WColor flipColor = ColorUtils.Flip(color); if (!BoardUtil.CheckBounds(board.Size, row, col)) { return(true); } else if (board[row, col] == flipColor) { return(true); } else if (board.GetMark(row, col) == Mark.MARK1) { return(true); } else if (board[row, col] == WColor.EMPTY) { return(false); } else { captureList.Add(new Tuple <byte, byte>(row, col)); board.Mark(row, col, Mark.MARK1); return( captureKernel(board, captureList, (byte)(row + 1), col, color) && captureKernel(board, captureList, (byte)(row - 1), col, color) && captureKernel(board, captureList, row, (byte)(col + 1), color) && captureKernel(board, captureList, row, (byte)(col - 1), color) ); } }
public static bool CheckMove(BoardBase status, WColor turn, byte row, byte col) { BoardStatus toCheck = new BoardStatus(status.Size); toCheck.Board = new BoardBase(status); toCheck.Turn = turn; bool ret = Move(ref toCheck, row, col); return(ret); }
private static List <Tuple <byte, byte> > Capture(BoardStatus newStatus, byte row, byte col, WColor color) { var capturedStones = new List <Tuple <byte, byte> >(); BoardBase bbTemp = new BoardBase(newStatus.Board); if (!captureKernel(bbTemp, capturedStones, row, col, color)) { capturedStones.Clear(); } return(capturedStones); }
public BoardBase(BoardBase b) : base(b) { }
public BoardStatus(BoardStatus bs) { Board = new BoardBase(bs.Board); Turn = bs.Turn; }
public BoardStatus(byte size) { Board = new BoardBase(size); Turn = WColor.EMPTY; }