From e7767ab8faf062170b1388c81f844d31c358347d Mon Sep 17 00:00:00 2001 From: fdlt3859 Date: Fri, 3 Feb 2023 21:41:08 +0000 Subject: [PATCH] Added greetings and updated UI for RockPprSciss --- src/main/quizproject.c | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/src/main/quizproject.c b/src/main/quizproject.c index d0ac11f..68b566f 100644 --- a/src/main/quizproject.c +++ b/src/main/quizproject.c @@ -1791,10 +1791,16 @@ void v_play_rockpapersciss(){ int player_choice, computer_choice, player_score = 0, computer_score = 0; srand(time(NULL)); + printf("***************************\n"); + printf("Playing Rock,Paper,Scissors!\n"); + printf("***************************\n\n"); + + printf("First to win 3 rounds wins!\n\n"); + while (1) { printf("Enter your choice:\n"); - printf("1. Rock\n2. Paper\n3. Scissors\n"); + printf("1. Rock\n2. Paper\n3. Scissors\n\n"); printf("Your Choice:"); scanf("%d", &player_choice); computer_choice = (rand() % 3) + 1; @@ -1802,16 +1808,16 @@ void v_play_rockpapersciss(){ { if (computer_choice == ROCK) { - printf("Tie! Both picked Rock\n"); + printf("\nTie! Both picked Rock\n\n"); } else if (computer_choice == PAPER) { - printf("You lose! I picked Paper\n"); + printf("\nYou lose! I picked Paper\n\n"); computer_score++; } else { - printf("You win! I picked Scissors\n"); + printf("\nYou win! I picked Scissors\n\n"); player_score++; } } @@ -1819,16 +1825,16 @@ void v_play_rockpapersciss(){ { if (computer_choice == ROCK) { - printf("You win! I picked Rock\n"); + printf("\nYou win! I picked Rock\n\n"); player_score++; } else if (computer_choice == PAPER) { - printf("Tie! Both picked Paper\n"); + printf("\nTie! Both picked Paper\n\n"); } else { - printf("You lose! I picked Scissors\n"); + printf("\nYou lose! I picked Scissors\n\n"); computer_score++; } } @@ -1836,22 +1842,22 @@ void v_play_rockpapersciss(){ { if (computer_choice == ROCK) { - printf("You lose! I picked Rock\n"); + printf("\nYou lose! I picked Rock\n\n"); computer_score++; } else if (computer_choice == PAPER) { - printf("You win! I picked Paper\n"); + printf("\nYou win! I picked Paper\n\n"); player_score++; } else { - printf("Tie! Both picked Scissors\n"); + printf("\nTie! Both picked Scissors\n\n"); } } else { - printf("Invalid choice!\n"); + printf("\nInvalid choice!\n\n"); } if (player_score == 3 || computer_score == 3) { @@ -1860,12 +1866,15 @@ void v_play_rockpapersciss(){ } if (player_score == 3) { - printf("You win the best of three!\n"); + printf("You win the best of three!\n\n"); } else { - printf("I win the best of three!\n"); + printf("I win the best of three!\n\n"); } + printf("******************************************\n"); + printf("Thank you for playing Rock,Paper,Scissors!\n"); + printf("******************************************\n\n"); }