Esempio n. 1
0
 public void Make(int n, ComponentsBook c)
 {
     for (int i = 0; i < components[recipes[n].name].Count; i++)
     {
         string s = components[recipes[n].name].ElementAt(i).Key;
         int    a = components[recipes[n].name].ElementAt(i).Value;
         c.GiveComponent(s, a);
     }
 }
Esempio n. 2
0
 public Machine(RecipeBook r, Banks b, SugarPacket s, WaterResourses w, Glasses g, Interfaces i, ComponentsBook c, Card a)
 {
     recipe     = r;
     bank       = b;
     sugar      = s;
     water      = w;
     glass      = g;
     face       = i;
     components = c;
     card       = a;
 }
Esempio n. 3
0
        static void Main(string[] args)
        {
            ComponentsBook c = new ComponentsBook();

            c.ReadComponents("Components.txt");
            RecipeBook r = new RecipeBook();

            r.ReadRecipes("Recipes.txt");
            r.CheckComponents(c);
            Banks          b = new Banks();
            SugarPacket    s = new SugarPacket(100);
            WaterResourses w = new WaterResourses(100);
            Glasses        g = new Glasses(100);
            Interfaces     i = new Interfaces();
            Card           a = new Card("1234", 1000);
            Machine        m = new Machine(r, b, s, w, g, i, c, a);

            m.Start();
        }
Esempio n. 4
0
        public void CheckComponents(ComponentsBook c)
        {
            List <Recipe> NONpossible = new List <Recipe>();

            foreach (Recipe r in recipes)
            {
                for (int i = 0; i < components[r.name].Count; i++)
                {
                    string s = components[r.name].ElementAt(i).Key;
                    int    n = components[r.name].ElementAt(i).Value;
                    if (!c.HasComponent(s, n))
                    {
                        NONpossible.Add(r);
                    }
                }
            }
            foreach (Recipe r in NONpossible)
            {
                recipes.Remove(r);
            }
        }