コード例 #1
0
ファイル: GameAnalyzer.cs プロジェクト: PierreLemmel/Bot2048
 private bool CanMoveDown(GridColumn column)
 {
     // No cells -> No movements
     if (column.All(cell => cell.IsEmpty()))
     {
         return(false);
     }
     // Check if there is an empty cell to move
     else if (column.Skip(1).Any(cell => cell.IsEmpty()))
     {
         return(true);
     }
     else
     {
         // Check for any consecutive cells
         for (int row = 0; row <= 2; row++)
         {
             if (column[row] == column[row + 1])
             {
                 return(true);
             }
         }
         return(false);
     }
 }