using System.Collections.Generic;
public static void Main()
Console.WriteLine("Options available: (r)oll, (d)ecode");
char action = Console.ReadLine().ToLower().ToCharArray()[0];
if(action == 'r') Roll();
if(action == 'd') Decode();
public static void Roll()
int f = r.Next(0, 32) + 1;
int[] sums = RollStatDice();
for(int i = 0; i < 6; i++)
Console.WriteLine(sums[i]);
encC += i + "d" + (Math.Pow(2, sums[i]) * f);
Console.WriteLine("Your roll code is: " + f + "x" + encC);
public static void Decode()
Console.Write("Enter roll code: ");
string code = Console.ReadLine();
int factor = Convert.ToInt32(code.Split(new char[] { 'x' })[0]);
code = code.Substring((factor + "").Length);
string[] sRolls = code.Split(new string[] { "x","0d","1d","2d","3d","4d","5d" }, StringSplitOptions.RemoveEmptyEntries);
int[] rolls = new int[sRolls.Length];
for(int i = 0; i < rolls.Length; i++)
rolls[i] = Convert.ToInt32(sRolls[i])/factor;
for(int a = 1; a < rolls[i]/2; a++)
if(Math.Pow(2,a) == rolls[i]) rolls[i] = a;
foreach(int i in rolls) Console.WriteLine(i);
Console.WriteLine("ran successfully");
public static void DiceAverages()
List<int> allRolls = new List<int>();
for(int x = 0; x < runs; x++)
int[] sums = RollStatDice();
for(int i = 0; i < 6; i++)
int[] totals = new int[6];
for(int i = 0; i < runs * 6; i++)
totals[i % 6] += allRolls[i];
Console.WriteLine(x/runs);
public static int[] RollStatDice()
string[] rolls = new string[6];
for(int sequence = 0; sequence < 6; sequence++)
for(int roll = 0; roll < 4; roll++)
rolls[sequence] += r.Next(6) + 1;
int[] sorter = new int[4];
for(int x = 0; x < 6; x++)
for(int i = 0; i < 4; i++)
sorter[i] = Convert.ToInt32(rolls[x].Substring(i, 1));