示例#1
0
        /// <summary>
        /// Execution of the action by the agent
        /// </summary>
        /// <param name="agent">The agent who executes the action</param>
        /// <returns>An asynchronous task in which the action is performed</returns>
        public override async Task Execute(GoldMineAgent agent)
        {
            await Task.Delay(2000);

            agent.HasGold = false;
            Console.WriteLine(ToString());
        }
示例#2
0
        /// <summary>
        /// We execute the action by the agent
        /// </summary>
        /// <param name="agent">The agent who executes the action</param>
        /// <returns>A, asynchronous task in which the action is executed</returns>
        public override async Task Execute(GoldMineAgent agent)
        {
            await Task.Delay(2000);

            agent.CurrentX = (double)Assignments["param3"];
            agent.CurrentY = (double)Assignments["param4"];
            Console.WriteLine(ToString());
        }
示例#3
0
        /// <summary>
        /// Execution of the action by an agent
        /// </summary>
        /// <param name="agent">The agent who executes the action</param>
        /// <returns>An asynchronous task in which the action is performed</returns>
        public override async Task Execute(GoldMineAgent agent)
        {
            await Task.Delay(5000);

            var toRemove = agent.Environment.GoldMines.First(x => x.X == agent.CurrentX && x.Y == agent.CurrentY);

            agent.Environment.GoldMines.Remove(toRemove);
            agent.HasGold = true;
            Console.WriteLine(ToString());
        }
示例#4
0
        /// <summary>
        /// The main method that starts our program
        /// </summary>
        static void Main(string[] args)
        {
            #region Scenario1
            /////SCENARIO1/////

            //we create an environment and add an agent to that environment
            var environment = new GoldMineEnvironment();
            var agent       = new GoldMineAgent(environment, 5, 5, CommitmentType.Blind);
            agent.Init(new List <Desire <GoldMineAction, GoldMineAgent, GoldMineEnvironment> > {
                new ExploreDesire(), new SellGoldDesire(), new MineGoldDesire()
            }, null);

            while (!Console.KeyAvailable)
            {
                Thread.Sleep(1000);
            }

            #endregion
        }
示例#5
0
 /// <summary>
 /// Execute the action by an agent
 /// </summary>
 /// <param name="agent">The agent who executes the action</param>
 /// <returns>An asynchronous task in which the action is performed</returns>
 public abstract Task Execute(GoldMineAgent agent);