Example #1
0
 public bool SetThrowsAndDice(ThrowsAndDice newThrowsAndDice)
 {
     if (!IsVisited)
     {
         ThrowsAndDice = newThrowsAndDice;
         IsVisited     = true;
         return(true);
     }
     else
     {
         return(ThrowsAndDice.UpdateIfBetter(newThrowsAndDice));
     }
 }
Example #2
0
        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);
        }
Example #3
0
        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;
        }
Example #4
0
 public bool SetThrowsAndDice(ThrowsAndDice newThrowsAndDice) {
     if (!IsVisited)
     {
         ThrowsAndDice = newThrowsAndDice;
         IsVisited = true;
         return true;
     }
     else
     {
         return ThrowsAndDice.UpdateIfBetter(newThrowsAndDice);
     }
 }