Пример #1
0
        private void Start_()
        {
            Robots.Clear();

            ThreadPool.QueueUserWorkItem(new WaitCallback(QueueShowRobot_Thread));

            SyncState.State   = SyncStates.WAIT;
            SyncState.Message = "QueueShowRobot";
            Connection.QueueTask(true, new Action(() => SyncStateChange?.Invoke(this, SyncState)));
        }
Пример #2
0
        /// <summary>
        /// public method that deploys robots off the production line.
        /// Clears down the production line in the factory and returns all robots to the caller.
        /// </summary>
        /// <returns>Returns an <see cref="IList{T}"/> of <see cref="IRobot"/> types.</returns>
        public IList <IRobot> DeployRobots()
        {
            // Copy robots to a new IList - Ready for deployment
            IList <IRobot> robotsToDeploy = new List <IRobot>(Robots);

            // Clear the current production line
            Robots.Clear();

            // Deploy!
            return(robotsToDeploy);
        }
Пример #3
0
        public void RandomizeStartOrder()
        {
            var tempRobots = Robots.Select(r => r).ToList();

            Robots.Clear();

            var random = new Random();

            while (tempRobots.Count > 0)
            {
                var min   = 0;
                var max   = tempRobots.Count;
                var index = random.Next(min, max);
                Robots.Add(tempRobots[index]);
                tempRobots.Remove(tempRobots[index]);
            }
        }
Пример #4
0
 /// <summary>
 ///     Initialize the board with width and height to create play area.
 ///     Can be re-run to clear the board
 /// </summary>
 /// <exception cref="System.Exception">Throws when width and height are invalid </exception>
 public void InitializeBoard(int width, int height)
 {
     Robots.Clear();
     _board.InitializePlayArea(width, height);
 }