コード例 #1
0
ファイル: Grid.cs プロジェクト: ddemland/Games
        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);
        }
コード例 #2
0
ファイル: Grid.cs プロジェクト: ddemland/Games
        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);
        }
コード例 #3
0
ファイル: Grid.cs プロジェクト: ddemland/Games
        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);
        }