public static double matchup(int d1, int d2) { DieStack ds1 = new DieStack(d1); DieStack ds2 = new DieStack(d2); long numTrials = 0; long ds1Wins = 0; do { do { numTrials++; if (ds1.isBetter(ds2)) { ds1Wins++; } } while (ds2.next()); } while (ds1.next()); return (double)ds1Wins / (double)numTrials; }
public bool isBetter(DieStack d) { //Console.WriteLine(this.sum + " versus " + d.sum); return (this.sum > d.sum); }