Advertisement
Guest User

Untitled

a guest
Dec 6th, 2016
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.34 KB | None | 0 0
  1. //A pizza is just a list of FoodTypes
  2. //It has one crust, one sauce, one cheese, in that order
  3. //It also has 0-5 toppings at the end, but those can be in any order
  4.  
  5.  
  6. public enum FoodTypes
  7. {
  8.     CrustRegular, CrustWheat,
  9.     SauceRed, SauceWhite, SaucePink,
  10.     CheeseMozz, CheeseCheddar,
  11.     Pepperoni, Sausage, Bacon, Chicken, MeatBalls, Pepper, Onions, Mushroom, Tomato, Olives
  12. }
  13.  
  14.  
  15.     //This comparison is special
  16.     //It returns false it's impossible to make the given pizza in the recipe by adding more ingredients
  17.     //So a recipie of {CrustRegular}, {SauceRed}
  18.     public bool ComparePartial(List<FoodTypes> recipe, List<FoodTypes> given)
  19.     {
  20.        
  21.         if (recipe.Count < given.Count) {
  22.             return false;
  23.         }
  24.         //Compare the bread.
  25.  
  26.  
  27.         return true;
  28.     }  
  29.  
  30.     private bool IsCheese(FoodTypes food)
  31.     {
  32.         return (food == FoodTypes.CheeseCheddar || food == FoodTypes.CheeseMozz);
  33.     }
  34.  
  35.     private bool IsCrust(FoodTypes food)
  36.     {
  37.         return (food == FoodTypes.CrustRegular || food == FoodTypes.CrustWheat);
  38.     }
  39.  
  40.     private bool IsTopping(FoodTypes food)
  41.     {
  42.         return (food >= FoodTypes.Pepperoni);
  43.     }
  44.  
  45.     private bool IsSauce(FoodTypes food)
  46.     {
  47.         return (food == FoodTypes.SaucePink || food == FoodTypes.SauceRed || food == FoodTypes.SauceWhite);
  48.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement