static Random random = new Random();
static int CheatToWin()
{
if (random.NextDouble() < 0.9)
return 6;
return random.Next(1, 6);
}
Another customizable way to cheat:
static int IfYouAintCheatinYouAintTryin()
{
List<Tuple<double, int>> iAlwaysWin = new List<Tuple<double, int>>();
iAlwaysWin.Add(new Tuple<double, int>(0.02, 1));
iAlwaysWin.Add(new Tuple<double, int>(0.04, 2));
iAlwaysWin.Add(new Tuple<double, int>(0.06, 3));
iAlwaysWin.Add(new Tuple<double, int>(0.08, 4));
iAlwaysWin.Add(new Tuple<double, int>(0.10, 5));
iAlwaysWin.Add(new Tuple<double, int>(1.00, 6));
double realRoll = random.NextDouble(); // same random object as before
foreach (var cheater in iAlwaysWin)
{
if (cheater.Item1 > realRoll)
return cheater.Item2;
}
return 6;
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…