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 override bool Equals(System.Object obj) { if (obj == null) { return(false); } DefaultStorage <T> ds = obj as DefaultStorage <T>; if (ds == null) { return(false); } if (ds.GetDefault().GetType() != GetDefault().GetType()) { return(false); } if (ds.owner.GetType() != owner.GetType()) { return(false); } if (ds.owner.id != owner.id) { return(false); } if (!ds.dict.SequenceEqual(dict)) { return(false); } return(true); }
public bool BetterEquals(System.Object obj, bool infoset, int playeridx) { if (obj == null) { Console.WriteLine("owner is null"); return(false); } Owner otherowner = obj as Owner; if (otherowner == null) { Console.WriteLine("owner as owner is null"); return(false); } if (GetType() != otherowner.GetType()) { Console.WriteLine("Types not equal"); return(false); } if (this as Player != null && otherowner as Player != null) { Player thisplayer = this as Player; Player otherplayer = otherowner as Player; if (thisplayer.team.id != otherplayer.team.id) { Console.WriteLine("Player Specific Owner failure"); return(false); } } if (this as Team != null && otherowner as Team != null) { Team thisteam = this as Team; Team otherteam = otherowner as Team; for (int i = 0; i < thisteam.teamPlayers.Count; i++) { if (thisteam.teamPlayers[i].id != otherteam.teamPlayers[i].id) { Console.WriteLine("Team player id's not the same"); return(false); } } } //SPECIAL THINGS FOR OTHER OWNERS?? if (!(intBins.Equals(otherowner.intBins))) { //Console.WriteLine("owner intBins not equal"); return(false); } if (!(stringBins.Equals(otherowner.stringBins))) { //Console.WriteLine("owner stringbins not equal"); return(false); } if (infoset) { if (!cardBins.InfoSetEqual(otherowner.cardBins, playeridx)) { return(false); } } else if (!(cardBins.Equals(otherowner.cardBins))) { //Console.WriteLine("owner stringbins not equal"); return(false); } if (!(pointBins.Equals(otherowner.pointBins))) { //Console.WriteLine("owner pointbins not equal"); return(false); } if (name != otherowner.name) { //Console.WriteLine("owner names not equal"); return(false); } if (id != otherowner.id) { //Console.WriteLine("owner ids not equal"); return(false); } return(true); }