public int SearchRight(int row, int column, int state, ref SquareList squareList) { int cnt, totalCnt = 0; for (cnt = column + 1; cnt < MaxSide; cnt++) { if (GetSquareState(row, cnt) == state) { squareList.AddNewSquare(row, cnt); totalCnt++; } else { break; } } return(totalCnt); }
public int SearchLeft(int row, int column, int state, ref SquareList squareList) { int cnt, totalCnt = 0; for (cnt = column - 1; cnt >= 0; cnt--) { if (GetSquareState(row, cnt) == state) { squareList.AddNewSquare(row, cnt); totalCnt++; } else { break; } } return(totalCnt); }
public int SearchDownLeft(int row, int column, int state, ref SquareList squareList) { int localRow, localColumn, totalCnt = 0; for (localRow = row + 1, localColumn = column - 1; (localRow > 0) && (localColumn > 0); localRow++, localColumn--) { if (GetSquareState(localRow, localColumn) == state) { squareList.AddNewSquare(localRow, localColumn); totalCnt++; } else { break; } } return(totalCnt); }