#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <math.h>
#include <windows.h>


int main()
{

 int i;
 int d1,d2,d3;
 int d4,d5,d6;
 int d7,d8,d9;
 int time1 = 1500, time2 = 2000;

 char R;
 char HLE;


 float sum1, sum2, sum3;
 float n1, n2, n3;

srand((unsigned)time(0));

 printf("Are you ready for the most awesome Dice Game? (Y/N)\n ");
 scanf(" %c", &R);

 if((R == 'Y')||(R == 'yes')||(R == 'y')||(R == 'Yes')||(R == 'YES')){
     printf("\nAwesome!!!\n\n");
     Sleep(time1);
     system("cls");
     printf("\nHere are the Numbers you got for your first ROLL:\n");
     Sleep(time2);



    d1 = ( rand()%6) + 1;
    printf(" %d \n", d1);

    d2 = ( rand()%6) + 1;
    printf(" %d \n", d2);

    d3 = ( rand()%6) + 1;
    printf(" %d \n", d3);


    sum1 = d1 + d2 + d3;


    printf("You got the first total value: %.1f!!!\n", sum1);
    Sleep(time1);
    printf("\n\nNow make a guess about your next roll will be Higher or Lower or Equal!!(H/L/E)\n");
    scanf(" %c", &HLE);
if(HLE == 'H'){
    Sleep(time1);
    printf("\nHere are the Numbers you got for your next ROLL:\n");

    d4 = ( rand()%6) + 1;
    printf(" %d \n", d4);

    d5 = ( rand()%6) + 1;
    printf(" %d \n", d5);

    d6 = ( rand()%6) + 1;
    printf(" %d \n", d6);


    sum2 = d4 + d5 + d6;
    printf("You got the next total value: %.1f!!!\n", sum2);

    if(sum1 < sum2){
        printf("You WON!!!");
        Sleep(time1);
    }else{
        goto l1;
    }

}else if(HLE == 'L'){
   Sleep(time1);
    printf("\nHere are the Numbers you got for your next ROLL:\n");

   d4 = ( rand()%6) + 1;
    printf(" %d \n", d4);

    d5 = ( rand()%6) + 1;
    printf(" %d \n", d5);

    d6 = ( rand()%6) + 1;
    printf(" %d \n", d6);


    sum2 = d4 + d5 + d6;
    printf("You got the next total value: %.1f!!!\n", sum2);

    if(sum1 > sum2){
        printf("You WON!!!");
        Sleep(time1);
    }else{
        goto l1;
    }
}else{
    Sleep(time1);
    printf("\nHere are the Numbers you got for your next ROLL:\n");

    d4 = ( rand()%6) + 1;
    printf(" %d \n", d4);

    d5 = ( rand()%6) + 1;
    printf(" %d \n", d5);

    d6 = ( rand()%6) + 1;
    printf(" %d \n", d6);


    sum2 = d4 + d5 + d6;
    printf("You got the next total value: %.1f!!!\n", sum2);

    if(sum1 == sum2){
        printf("You WON!!!");
        Sleep(time1);
    }else{
     l1:printf("\nYou can do this!Try AGAIN!!\n");
        printf("\n\nNow make a guess about this roll will be Higher or Lower or Equal!!(H/L/E)\n");
        scanf(" %c", &HLE);
        printf("\nHere are the Numbers you got from your THIRD try:\n");
        Sleep(time1);

    d7 = ( rand()%6) + 1;
    printf(" %d \n", d4);

    d8 = ( rand()%6) + 1;
    printf(" %d \n", d5);

    d9 = ( rand()%6) + 1;
    printf(" %d \n", d6);


    sum3 = d7 + d8 + d9;
    printf("Your total value: %.1f!!!\n", sum3);

    if(HLE == 'H'){
            if(sum2 < sum3){
        printf("\nYou WON!!\nI knew you could do it!!!");
        system("pause");
            }else{
            printf("\nI am SORRY....");
            system("pause");
            }
    }else if(HLE == 'L'){
           if(sum2 > sum3){
        printf("\nYou WON!!\nI knew you could do it!!!");
        system("pause");
           }else{
           printf("\nI am SORRY....");
            system("pause");
           }
    }else{
           if(sum2 == sum3){
        printf("\nYou WON!!\nI knew you could do it!!!");
        system("pause");
           }else{
           printf("\nI am SORRY....");
            system("pause");
           }
    }







    }
}




 }else{
 printf("\nYou got be kidding me!!!\nTry AGAIN!!!\n");
    Sleep(time1);
    system("cls");
    main();
    return(0);
 }
    return 0;
}