Example #1
0
        void CalcKitchens(InputRooms inputRooms)
        {
            int[] dimsForKitchens = { 8, 12, 16 };

            var resFactor   = (int)(Ceiling(totalResidents / 2d) - 1);
            var dirtyWanted = inputRooms.HasFlag(InputRooms.DirtyKitchen);
            var cleanWanted = inputRooms.HasFlag(InputRooms.CleanKitchen);

            if (dirtyWanted && cleanWanted)
            {
                if (resFactor < dimsForKitchens.Count())
                {
                    KitchenPool += dimsForKitchens[resFactor] * 12; // the Dirty Kitchen
                    Kitchenette  = true;                            // the clean kitchen
                }
                else
                {
                    KitchenPool += dimsForKitchens[resFactor] * 12 * 2;                     // Both kitchens
                }
            }
            else if (dirtyWanted ^ cleanWanted)                 // XOR operator FTW
            {
                KitchenPool += dimsForKitchens[resFactor] * 12; // either kitchen
            }
            else
            {
                Kitchenette = true;
            }
        }
Example #2
0
        void KitchenCtor(int TotalResidents, bool kitchenette, Room livingRoom, Room diningRoom, InputRooms desiredRooms)
        {
            int[] dimsForKitchens = { 8, 12, 16 };             // this part should be part of criteria

            var resFactor   = (int)(Ceiling(TotalResidents / 2d) - 1);
            var dirtyWanted = desiredRooms.HasFlag(InputRooms.DirtyKitchen);
            var cleanWanted = desiredRooms.HasFlag(InputRooms.CleanKitchen);

            if (kitchenette)
            {
                livingRoom.ExtendLength(4);                 // this seems wrong. my livingroom will be infinite
            }
            Room dirtyKitchen;
            Room cleanKitchen;

            if (dirtyWanted && cleanWanted)
            {
                if (resFactor < dimsForKitchens.Count())
                {
                    dirtyKitchen = AddRoom <Kitchen>("Dirty", dimsForKitchens[resFactor] / GridSize, 12 / GridSize);
                    cleanKitchen = livingRoom;

                    PairRooms(dirtyKitchen, diningRoom);
                }
                else
                {
                    dirtyKitchen = AddRoom <Kitchen>("Dirty", dimsForKitchens[resFactor] / GridSize, 12 / GridSize);
                    cleanKitchen = AddRoom <Kitchen>("Clean", dimsForKitchens[resFactor] / GridSize, 12 / GridSize);

                    PairRooms(cleanKitchen, livingRoom);
                    PairRooms(dirtyKitchen, diningRoom);
                }
            }

            else if (dirtyWanted ^ cleanWanted)            // XOR operator FTW
            {
                dirtyKitchen = cleanKitchen = AddRoom <Kitchen>(dimsForKitchens[resFactor] / GridSize, 12 / GridSize);

                PairRooms(diningRoom, dirtyKitchen);
            }
            else
            {
                dirtyKitchen = cleanKitchen = livingRoom;                 // Kitchenette

                if (diningRoom != livingRoom)
                {
                    PairRooms(diningRoom, dirtyKitchen);
                }
            }
        }