Im currently solving a binary bomb. Within there is a phase with the following code:
bool phase_bird(const char* guess)
{
char c;
c=blackBoxC();
appendChar(c);
mute(true);
c=blackBoxC();
appendChar(c);
c=blackBoxC();
appendChar(c);
mute(false);
c=blackBoxC();
appendChar(c);
c=blackBoxC();
appendChar(c);
mute(false);
c=blackBoxC();
appendChar(c);
c=blackBoxC();
appendChar(c|3);
c=blackBoxC();
appendChar(c|5);
c=blackBoxC();
appendChar(c|9);
return stringMatches(guess);
}
what i know so far is that:
blackBoxC() returns a char
appendChar() appends the char to the char array which will be compared to the user input
- mute() while true stops appendChar() from working
i currently know that the chars returned by blackBoxC() are yxFUOXizu, with only yUOXkizv appending.
i also know that the last three chars are changed from izv to k^?^? as a result of the bitwise OR.
HOWEVER, it seemed all straight forward id simply just enter yUOXk^?^? as my guess. BUT the guess was invaild and the bomb exploded. I didnt realise that entering these DEL char would actually delete some of my input.
changing it from yUOXk^?^? to yUO
Now each invaild guess actually cuases me to loose marks, which is a problem! i have no idea what method they are using to compare the char arrays, but im assuming it is probably strcmp().
This means that even if i was to for example change my input to yUOXkkk^?^? the strings would still be different lengths.
If anyone has any input on how to solve this problem id love to hear it!
regards