Cloud Stack Ninja

I am creating a simple rock paper scissors game for computing 1 and I would like to know how to make it not case sensitive. For example it all works fine with r, p and s but I would like it to work for R, P and S as well.

edit: got rid of image because that is a nono apparently, sorry I am new here.

 else if (player1 == 'r','R' && player2 == 's','S') {
    printf("\nPlayer-1 wins! Rock breaks scissors!");
}
else if (player1 == 's','S' && player2 == 'r','R') {
    printf("\nPlayer-2 wins! Rock breaks scissors!");
}
 else if (player1 == 's','S' && player2 == 'p','P') {
    printf("\nPlayer-1 wins! Scissors cut paper!");
}
else if (player1 == 'p','P' && player2 == 's','S') {
    printf("\nPlayer-2 wins! Scissors cut paper!");
}
else if (player1 == 'r','R' && player2 == 'p', 'P') {
    printf("\nPlayer-2 wins! Paper covers rock!");
}
else if (player1 == 'p','P' && player2 == 'r','R') {
    printf("\nPlayer-1 wins! Paper covers rock!");
}


Read more here: https://stackoverflow.com/questions/64396314/case-issue-in-rock-paper-scissors

Content Attribution

This content was originally published by Nyosit at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: