public bool SetThrowsAndDice(ThrowsAndDice newThrowsAndDice) { if (!IsVisited) { ThrowsAndDice = newThrowsAndDice; IsVisited = true; return(true); } else { return(ThrowsAndDice.UpdateIfBetter(newThrowsAndDice)); } }
public bool UpdateIfBetter(ThrowsAndDice otherThrowsAndDice) { var thisThrows = this.DiceEyes == 0 ? this.Throws + 1 : this.Throws; var otherThrows = otherThrowsAndDice.DiceEyes == 0 ? otherThrowsAndDice.Throws + 1 : otherThrowsAndDice.Throws; if (thisThrows > otherThrows) { this.Throws = otherThrowsAndDice.Throws; this.DiceEyes = otherThrowsAndDice.DiceEyes; return(true); } else if (thisThrows == otherThrows && this.DiceEyes > otherThrowsAndDice.DiceEyes && otherThrowsAndDice.DiceEyes > 0) { this.DiceEyes = otherThrowsAndDice.DiceEyes; return(true); } return(false); }
public bool UpdateIfBetter(ThrowsAndDice otherThrowsAndDice) { var thisThrows = this.DiceEyes == 0 ? this.Throws + 1 : this.Throws; var otherThrows = otherThrowsAndDice.DiceEyes == 0 ? otherThrowsAndDice.Throws + 1 : otherThrowsAndDice.Throws; if (thisThrows > otherThrows) { this.Throws = otherThrowsAndDice.Throws; this.DiceEyes = otherThrowsAndDice.DiceEyes; return true; } else if (thisThrows == otherThrows && this.DiceEyes > otherThrowsAndDice.DiceEyes && otherThrowsAndDice.DiceEyes > 0) { this.DiceEyes = otherThrowsAndDice.DiceEyes; return true; } return false; }
public bool SetThrowsAndDice(ThrowsAndDice newThrowsAndDice) { if (!IsVisited) { ThrowsAndDice = newThrowsAndDice; IsVisited = true; return true; } else { return ThrowsAndDice.UpdateIfBetter(newThrowsAndDice); } }