コード例 #1
0
        private int calculateBedSideTableHeuristics(int bedPlace)
        {
            int       counter             = 0;
            ArrayList furnitureArrangment = _room._furniture;

            for (int i = 0; i < furnitureArrangment.Count; i++)
            {
                if (furnitureArrangment[i].GetType() == typeof(BedSideTable))
                {
                    BedSideTable table = (BedSideTable)furnitureArrangment[i];
                    if (table.placeIndex == 8)
                    {
                        counter += 6;
                    }
                    if (bedsideNotByBed(table, bedPlace))
                    {
                        counter += 3;
                    }
                    else
                    {
                        counter -= 2;
                    }
                }
            }
            return(counter);
        }
コード例 #2
0
        /// <summary>
        /// checks if the bedside table is by the bed
        /// </summary>
        private bool bedsideNotByBed(BedSideTable table, int bedPlace)
        {
            int tablePlace = table.placeIndex;

            return(!furnitureByBed(tablePlace, bedPlace));
        }