Esempio n. 1
0
        private ActorsCountInfo PopulateActorInfo(int index, Dictionary <int, ActorsCountInfo> map)
        {
            if (map.ContainsKey(index))
            {
                return(map[index]);
            }

            var info = new ActorsCountInfo()
            {
                Location = new ActorLocationInfo()
                {
                    Index = index,
                },
                ActiveActors = new List <ActorId>(),
            };

            map[index] = info;
            return(info);
        }
Esempio n. 2
0
            public ActorsCountInfo GetActorLocation()
            {
                var current = currentPlacementActor;
                var start   = current;

                var infos        = GetCurrentLocations();
                int startIndex   = infos.FindIndex(x => x.Location == currentPlacementActor.Location);
                int currentIndex = startIndex;

                do
                {
                    var info = infos[currentIndex];
                    if (info.HasMoreSpace())
                    {
                        currentPlacementActor = info;
                        return(currentPlacementActor);
                    }

                    currentIndex = (currentIndex + 1) % infos.Count;
                } while (startIndex != currentIndex);

                currentPlacementActor = null;
                return(currentPlacementActor);
            }