Skip to content

Instantly share code, notes, and snippets.

@Sasszem
Last active December 18, 2020 17:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Sasszem/8e1d9caaa145f01c97af29ba8b31f3c8 to your computer and use it in GitHub Desktop.
Save Sasszem/8e1d9caaa145f01c97af29ba8b31f3c8 to your computer and use it in GitHub Desktop.
Easy one this time. Give an input that makes it print "you won"!
#include <stdio.h>
/*
##########
# Solves #
##########
- (Derisis13) nope, OBOE, fixed it just after K0B4MB1
- K0B4MB1
- sparrow
- KosmX
*/
struct {
int is_admin;
int memory[256];
int ptr;
} state = {0, {0}, 128};
int main() {
printf("Szuper-mega-uber-parancsertelmezo!\n");
printf("Irjad be a parancsokat ide, en meg vegrehajtom oket!\n");
while (1) {
printf("$ ");
char x;
while(scanf("%c", &x), x!='\n') {
switch (x) {
case '+':
state.memory[state.ptr]++;
break;
case '-':
state.memory[state.ptr]--;
break;
case 'p':
printf("%d\n", state.memory[state.ptr]);
break;
case 'i':
scanf("%d", &(state.memory[state.ptr]));
break;
case 'D':
if (state.is_admin==42) {
printf("Y O U W O N ! ");
return 0;
}
else printf("Nincs jogod ehhez!!\nNe rosszalkodj mert a sarokba allitalak!\n");
break;
case '>':
state.ptr++;
break;
case '<':
state.ptr--;
break;
case 'E':
printf("Bye!\n");
return 0;
}
}
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment