Beispiel #1
0
 private bool CanMoveRight(GridRow row)
 {
     // No cells -> No movements
     if (row.All(cell => cell.IsEmpty()))
     {
         return(false);
     }
     // Cells + empty space (except last cell) -> Movement possible
     else if (row.Skip(1).Any(cell => cell.IsEmpty()))
     {
         return(true);
     }
     else
     {
         // Check for any consecutive cells
         for (int col = 0; col <= 2; col++)
         {
             if (row[col] == row[col + 1])
             {
                 return(true);
             }
         }
         return(false);
     }
 }