示例#1
0
        /// <summary>
        /// Return the first unconsumed resource found, or throw exception if no unconsumed resources exist.
        /// </summary>
        /// <param name="world"></param>
        /// <returns></returns>
        private Point LocateResource(World world)
        {
            if (!nextResourcePosition.IsEmpty)
            {
                return nextResourcePosition;
            }

            foreach (IResource res in world.Resources())
            {
                if (!res.IsConsumed())
                    return res.Position();
            }

            throw new NoValidResourcesException();
        }