Browse Source

refactoring: Umbenennen der formalen Parameter von changeLetter() zu verständlicheren Name

remotes/origin/tim
fdai7727 11 months ago
parent
commit
e6c9d0dcb6
  1. 20
      src/main/c/Tim/hangman.c

20
src/main/c/Tim/hangman.c

@ -194,33 +194,33 @@ bool letterGuessed(char selectedLetter, char guessWord[], int length)
}
void changeLetter(char x, char y[], int length, char ptr[])
void changeLetter(char selectedLetter, char guessWord[], int length, char ptrDisplayWord[])
{
for(int i = 0; i<length; i++) {
if(isupper(x)!=0)
if(isupper(selectedLetter) != 0)
{
if (x == y[i]-32 || x == y[i] )
if (selectedLetter == guessWord[i] - 32 || selectedLetter == guessWord[i] )
{
if(i ==0 && isupper(y[0])!=0)
if(i ==0 && isupper(guessWord[0]) != 0)
{
ptr[i] = x;
ptrDisplayWord[i] = selectedLetter;
}
else
{
ptr[i] = x+32;
ptrDisplayWord[i] = selectedLetter + 32;
}
}
}
else
{
if (x == y[i]||x == y[i]+32)
if (selectedLetter == guessWord[i] || selectedLetter == guessWord[i] + 32)
{
if(i == 0 && isupper(y[0])!=0)
if(i == 0 && isupper(guessWord[0]) != 0)
{
ptr[i] = x-32;
ptrDisplayWord[i] = selectedLetter - 32;
}
else {
ptr[i] = x;
ptrDisplayWord[i] = selectedLetter;
}
}
}

Loading…
Cancel
Save