int iDie1, iDie2;
iDie1 = rollDice();
iDie2 = rollDice();
int iSum = iDie1 + iDie2;
String sRoll = "You rolled " + iDie1 + "+" + iDie2 + "=" + iSum + ".\n";
String sOutput = "";
int iPoint = 0;
int iRollCount = 0;
if(iSum == 7 || iSum == 11)
{
sOutput = sRoll + "You win because you got a natural :)\n";
}
else if(iSum == 2 || iSum == 3 || iSum == 12)
{
sOutput = sRoll + "You lost because you got a crap out :(\n";
}
else if(iRollCount == 0)
{
iPoint = iSum;
sOutput = sRoll + "Point is: " + iPoint + ".\n";
iRollCount++;
}
else if(iRollCount != 0 && iPoint == iSum)
{
sOutput = sRoll + "You win because your roll matches point ;)\n";
}
else if(iRollCount != 0 && iSum == 7)
{
sOutput = sRoll + "You lost because your roll matches 7 :(\n";
}
else
{
sOutput = sRoll;
}
writeMessage(sOutput);