private void determineMultiplier(Darts darts) { /* * Each dart can score from 1 to 20, or the bullseye. * If the dart lands in the outer band, multiply the dart's score by two. * If the dart lands in the inner band, multiply the dart's score by three. * If the dart lands in the outer bullseye, it is scored as 25. * If the dart lands in the inner bullseye, it is scored as 50. */ if (darts.IsInnerBullseye) { PlayerScore += darts.Score * 50; } else if (darts.IsOuterBullseye) { PlayerScore += darts.Score * 25; } else if (darts.IsTriple) { PlayerScore += darts.Score * 3; } else if (darts.IsDouble) { PlayerScore += darts.Score * 2; } else { PlayerScore += darts.Score; } }
public int score() { Darts dart = new Darts(); int throwValue = dart.Throw(); if (throwValue != 0) { if (dart.isMultiplyer()) { return(throwValue *= 2); } if (dart.isMultiplyer()) { return(throwValue *= 3); } } else if (throwValue == 0) { throwValue = dart.bull(); if (throwValue == 1) { return(50); } else { return(25); } } return(throwValue); }
// Public methods. // public void ThrowDarts() { //Random random = new Random(); Darts dartsGame = new Darts(_random); // Loop to represent the 3 darts each player gets to play with for (int i = 0; i < 3; i++) { dartsGame.Throw(); determineMultiplier(dartsGame); } }