public bool InfoSetEqual(CardStorage s2, int playeridx) { foreach (string k in dict.Keys) { CardCollection collection1 = dict[k]; if (collection1.type == CCType.VISIBLE || collection1.type == CCType.MEMORY || (collection1.type == CCType.INVISIBLE && owner.GetType() == typeof(Player) && owner.id == playeridx) || (owner.GetType() == typeof(Team) && ((Team)owner).IsMember(playeridx))) { if (s2.dict.Keys.Contains(k)) { if (!collection1.Equals(s2.dict[k])) { return(false); } } else { return(false); } } else { if (dict[k].Count != s2.dict[k].Count) { return(false); } } } return(true); }
public override bool Equals(System.Object obj) { //System.Console.WriteLine("INTO CARDSTORAGE EQUALITY"); if (obj == null) { return(false); } CardStorage cs = obj as CardStorage; if (cs == null) { return(false); } if (cs.owner.GetType() != owner.GetType()) { Console.WriteLine("Owner types not equal"); return(false); } if (cs.owner.id != owner.id) { Console.WriteLine("Owner names not equal"); return(false); } if (!cs.dict.SequenceEqual(dict)) { //Console.WriteLine("Dictionary of Card Collections not equal"); return(false); } return(true); }
public readonly int id; // index of Owner in the CardGame list for its type public Owner(string name, int id) { // Use 0, "", and an empty PointMap for defaults intBins = new DefaultStorage <int>(0, this); stringBins = new DefaultStorage <string>("", this); pointBins = new DefaultStorage <PointMap>(new PointMap(new List <ValueTuple <string, string, int> >()), this); cardBins = new CardStorage(this); // Record the name and id this.name = name; this.id = id; }