Example #1
0
        private TransportRobot FindTransporterToSlot(Point location)
        {
            TransportRobot select_robot     = null;
            int            current_distance = 0;

            foreach (TransportRobot robot in _TransporterForSlot.Values)
            {
                if (robot._state == robot_state.free || robot._state == robot_state.returning)
                {
                    int new_distance = AStarPathfinding.ComputeHScore(robot._location.X, robot._location.Y, location.X, location.Y);

                    if (select_robot == null || new_distance < current_distance)
                    {
                        select_robot     = robot;
                        current_distance = new_distance;
                    }
                }
            }

            return(select_robot);
        }
Example #2
0
        public static Robot FindPickerToPick(Rack rack)
        {
            Robot select_robot     = null;
            int   current_distance = 0;

            Dictionary <int, Robot> searchList = rack._storageType.Equals("fold") ? _Pickers : _Hangers;

            foreach (Robot robot in searchList.Values)
            {
                int new_distance = AStarPathfinding.ComputeHScore(robot._location.X, robot._location.Y, rack._location.X, rack._location.Y);
                if (robot._state == robot_state.free || robot._state == robot_state.returning)
                {
                    if (select_robot == null || new_distance < current_distance)
                    {
                        select_robot     = robot;
                        current_distance = new_distance;
                    }
                }
            }

            return(select_robot);
        }