当前位置: 首页>>代码示例>>C#>>正文


C# Cell.IsInLastColumn方法代码示例

本文整理汇总了C#中Cell.IsInLastColumn方法的典型用法代码示例。如果您正苦于以下问题:C# Cell.IsInLastColumn方法的具体用法?C# Cell.IsInLastColumn怎么用?C# Cell.IsInLastColumn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Cell的用法示例。


在下文中一共展示了Cell.IsInLastColumn方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: FindPossibleNeighbourCells

        /// <summary>
        /// Based on the position of the given cell it collects its possible neighbour cells
        /// which are candidates to be put in the given cage.
        /// </summary>
        /// <param name="cell">The cell which it searches for the neighbours of.</param>
        /// <param name="cageIndex">The cage index to examine.</param>
        /// <param name="addingNeighbourToCageOfCell">
        /// Whether we want to add a neighbourcell to the cage of the current cell, or
        /// we want to add the current cell into the neighbour's cage.
        /// </param>
        /// <returns>The list of possible neighbour cells.</returns>
        public List<Cell> FindPossibleNeighbourCells(Cell cell, int cageIndex, bool addingNeighbourToCageOfCell)
        {
            possibleNeighbourCells = new List<Cell>();

            if (cell.IsInFirstRow())
            {
                log.Info("Cell is in first row.");
                CollectCell(Direction.DOWN, cell, cageIndex, addingNeighbourToCageOfCell);

                CornerAndThenRowCheck(cell, cageIndex, addingNeighbourToCageOfCell);

                return possibleNeighbourCells;
            }

            if (cell.IsInLastRow())
            {
                log.Info("Cell is in last row.");
                CollectCell(Direction.UP, cell, cageIndex, addingNeighbourToCageOfCell);

                CornerAndThenRowCheck(cell, cageIndex, addingNeighbourToCageOfCell);

                return possibleNeighbourCells;
            }

            if (cell.IsInFirstColumn())
            {
                log.Info("Cell is in first column.");
                CollectCell(Direction.RIGHT, cell, cageIndex, addingNeighbourToCageOfCell);

                CheckUpAndDown(cell, cageIndex, addingNeighbourToCageOfCell);

                return possibleNeighbourCells;
            }

            if (cell.IsInLastColumn())
            {
                log.Info("Cell is in last column.");
                CollectCell(Direction.LEFT, cell, cageIndex, addingNeighbourToCageOfCell);

                CheckUpAndDown(cell, cageIndex, addingNeighbourToCageOfCell);

                return possibleNeighbourCells;
            }

            //If the cell indeces doesn't fit to any previous case, all 4 neighbours of it can be checked.
            CheckToLeftAndRight(cell, cageIndex, addingNeighbourToCageOfCell);

            CheckUpAndDown(cell, cageIndex, addingNeighbourToCageOfCell);

            return possibleNeighbourCells;
        }
开发者ID:picimako,项目名称:SudokU,代码行数:62,代码来源:PossibleNeighbourCellsFinder.cs

示例2: CornerAndThenRowCheck

 private void CornerAndThenRowCheck(Cell cell, int cageIndex, bool addingNeighbourToCageOfCell)
 {
     //i=0: if cell is in the top left corner, i=8: if cell is in the bottom left corner
     if (cell.IsInFirstColumn())
     {
         CollectCell(Direction.RIGHT, cell, cageIndex, addingNeighbourToCageOfCell);
     }
     //i=0: if cell is in the top right corner, i=8: if cell is in the bottom right corner
     else if (cell.IsInLastColumn())
     {
         CollectCell(Direction.LEFT, cell, cageIndex, addingNeighbourToCageOfCell);
     }
     //If cell is in somewhere in the row except the corners
     else
     {
         CheckToLeftAndRight(cell, cageIndex, addingNeighbourToCageOfCell);
     }
 }
开发者ID:picimako,项目名称:SudokU,代码行数:18,代码来源:PossibleNeighbourCellsFinder.cs


注:本文中的Cell.IsInLastColumn方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。