コード例 #1
0
		public bool Apply(GameState state, PlayerQueue queue)
		{
			var ball = state.Current.Ball;

			if (ball.HasOwner || state.Current.OwnPlayers.Any(player => player.CanPickUpBall)) { return false; }

			var catchUp = state.CatchUps.FirstOrDefault(c => queue.Contains(c.Player));

			if (catchUp != null)
			{
				queue.Dequeue(Actions.Move(catchUp.Player, catchUp.Position));
			}
			return catchUp != null;
		}
コード例 #2
0
        public bool Apply(GameState state, PlayerQueue queue)
        {
            var ball = state.Current.Ball;

            if (ball.HasOwner || state.Current.OwnPlayers.Any(player => player.CanPickUpBall))
            {
                return(false);
            }

            var catchUp = state.CatchUps.FirstOrDefault(c => queue.Contains(c.Player));

            if (catchUp != null)
            {
                queue.Dequeue(Actions.Move(catchUp.Player, catchUp.Position));
            }
            return(catchUp != null);
        }
コード例 #3
0
        public bool Apply(GameState state, PlayerQueue queue)
        {
            foreach (var role in Roles)
            {
                role.Apply(state, queue);
            }

            var zones = Zones.Create(state);

            foreach (var zone in zones.SingleOccupiedByOwn)
            {
                var player = zone.Own.FirstOrDefault();
                if (queue.Contains(player))
                {
                    queue.Dequeue(Actions.Move(player, zone.Target));
                }
            }
            foreach (var zone in zones.NotOccupiedByOwn)
            {
                var closedBy = zone.Target.GetClosestBy(queue);

                if (closedBy != null)
                {
                    queue.Dequeue(Actions.Move(closedBy, zone.Target));
                }
            }
            if (zones.BallOwnerZone != null)
            {
                var closedBy = zones.BallOwnerZone.Target.GetClosestBy(queue);

                if (closedBy != null)
                {
                    queue.Dequeue(Actions.Move(closedBy, zones.BallOwnerZone.Target));
                }
            }

            foreach (var player in queue.ToList())
            {
                queue.Dequeue(Actions.Wait(player));
            }
            return(true);
        }
コード例 #4
0
		public bool Apply(GameState state, PlayerQueue queue)
		{
			foreach (var role in Roles)
			{
				role.Apply(state, queue);
			}
			
			var zones = Zones.Create(state);

			foreach (var zone in zones.SingleOccupiedByOwn)
			{
				var player = zone.Own.FirstOrDefault();
				if (queue.Contains(player))
				{
					queue.Dequeue(Actions.Move(player, zone.Target));
				}
			}
			foreach (var zone in zones.NotOccupiedByOwn)
			{
				var closedBy = zone.Target.GetClosestBy(queue);

				if (closedBy != null)
				{
					queue.Dequeue(Actions.Move(closedBy, zone.Target));
				}
			}
			if (zones.BallOwnerZone != null)
			{
				var closedBy = zones.BallOwnerZone.Target.GetClosestBy(queue);

				if (closedBy != null)
				{
					queue.Dequeue(Actions.Move(closedBy, zones.BallOwnerZone.Target));
				}
			}

			foreach (var player in queue.ToList())
			{
				queue.Dequeue(Actions.Wait(player));
			}
			return true;
		}