Beispiel #1
0
        public void Death(string name)
        {
            if (!_map.ContainsKey(name))
            {
                return;
            }
            RoyalMember member = _map[name];

            member.Decease();
        }
Beispiel #2
0
        public void Birth(string parentName, string childName)
        {
            if (!_map.ContainsKey(parentName))
            {
                return;
            }
            RoyalMember parent = _map[parentName];
            RoyalMember child  = new RoyalMember(childName, false);

            child.Parent = parent;
            parent.Children.Add(child);
            _map[childName] = child;
        }
Beispiel #3
0
        private void Dfs(RoyalMember current, HashSet <string> order)
        {
            if (current == null)
            {
                return;
            }

            if (current.IsAlive)
            {
                order.Add(current.Name);
            }

            foreach (RoyalMember child in current.Children)
            {
                Dfs(child, order);
            }
        }
Beispiel #4
0
 public ThroneInheritance(string kingName)
 {
     root           = new RoyalMember(kingName, true);
     _map           = new Dictionary <string, RoyalMember>();
     _map[kingName] = root;
 }