Exemple #1
0
        private void CalculateDoorCosts()
        {
            //calculate every possible scenario, every yesno, the outer lines are not nessesary 2,3,7,8
            _Model       tempModel    = Model;//.DeepCopy();
            List <_Line> allLinesFlat = tempModel.AllLinesFlat();

            int[] arr = Enumerable.Range(0, allLinesFlat.Count).ToArray();

            //TODO: we could ommit outside lines
            List <int[]> indicesToSetAsDoors = CFG.printCombination(arr, allLinesFlat.Count, Model.rooms.Count);

            for (int index = 0; index < indicesToSetAsDoors.Count; index++)
            {
                List <_Line> currentLines = new List <_Line>();
                int[]        elementAt    = indicesToSetAsDoors.ElementAt(index);


                if (elementAt.Contains(1) && elementAt.Contains(2) && elementAt.Contains(7) && elementAt.Contains(8))
                {
                    int breakpointint = 0;
                }

                foreach (int i in elementAt)
                {
                    currentLines.Add(allLinesFlat.ElementAt(i));
                }
                tempModel.MakeLineDoor(currentLines);
                Cost c = CostCalculationService.CalculateDoorCost(tempModel);

                DoorActions.Add(new MakeDoor(currentLines, c));
            }

            int breakpoint = DoorActions.Count;
        }
Exemple #2
0
 public override void Step(_Model m)
 {
     m.MakeLineDoor(makeDoor);
 }