Skip to content

Instantly share code, notes, and snippets.

@umnikos
Last active August 8, 2019 20:15
Show Gist options
  • Save umnikos/613b757b7971aad0c529f990017da651 to your computer and use it in GitHub Desktop.
Save umnikos/613b757b7971aad0c529f990017da651 to your computer and use it in GitHub Desktop.
bff brainf**k interpreter crashing
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+[<[>>+>+<<<-]>>>[<<<+>>>-]<+>>++[<++++++++++>-]<++++>>+<<<[>>+<<-]>>[>-]>[><<<<+>[-]>>->]<+<<[>-[>-]>[><<<<+>[-]+>>->]<+<<-]>[-]>-<<<[>>+[<[>>+>+<<<-]>>>[<<<+>>>-]<+>++++++++++>>+<<<[>>+<<-]>>[>-]>[><<<<+>[-]>>->]<+<<[>-[>-]>[><<<<+>[-]+>>->]<+<<-]>[-]>-<<<[<<[>>>+>+<<<<-]>>>>[<<<<+>>>>-],<[<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>-]>[<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>-]<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>[[>>]+[<<]>>-]+[>>]<[-]<[<<]>[>[>>]<+<[<<]>-]>[>>]<<[-<<]>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>[>>>+>+<<<<-]>>>>[<<<<+>>>>-]+[<+>-]<<<<[-]>>>[<<<+>>>-]<[-]<+>]<-]<[-],<<<<[-]>>>>[<<<<+>>>>-]>+[<[>>+>+<<<-]>>>[<<<+>>>-]<+>+++++>>+<<<[>>+<<-]>>[>-]>[><<<<+>[-]>>->]<+<<[>-[>-]>[><<<<+>[-]+>>->]<+<<-]>[-]>-<<<[<<[>>>+>+<<<<-]>>>>[<<<<+>>>>-],<[<<<<<<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<<<<<<<<<<<<<<+>>>>>>>>>>>>>>>>>>>>>>>>>-]<<<<<<<<<<<<<<<<<<<<<<<<<<<>>[[>>]+[<<]>>-]+[>>]<[<[<<]>+<>>>>>>>>>>>>>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<<<<<<<<<<<<>>[>>]<-]<[<<]>[>[>>]<+<[<<]>-]>[>>]<<[-<<]>>>>>>>>>>>>>>>>>>>>>>>>>[->-<]+>[<->[-]]<[>+<[-]]+>[<->-]+<[<<<<[-]>>>>>>[<<<<<<+>>>>>>-]<-<[-]]>[-]<<<<[>>>+>+<<<<-]>>>>[<<<<+>>>>-]+[<+>-]<<<<[-]>>>[<<<+>>>-]<[-]<+>]<-]<[-]<[>+>+<<-]>>[<<+>>-]+<[>>+<<<<<<<[-]>>>>>>>[<<<<<<<+>>>>>>>-]<-<[-]]>[-]<<<<<[>>>>+>+<<<<<-]>>>>>[<<<<<+>>>>>-]+[<+>-]<<<<<[-]>>>>[<<<<+>>>>-]<[-]<[-]<+>]<-]<[-]<[>+>+<<-]>>[<<+>>-]>++++[<++++++++++>-]<++++++++<[>>+>+<<<-]>>>[<<<+>>>-]<[<+>-]<.[-]<[-]<[-]++++++++++.[-]<<<[>>>+>+<<<<-]>>>>[<<<<+>>>>-]+[<+>-]<<<<[-]>>>[<<<+>>>-]<[-]<+>]<-]<[-]
1010110010 10110
1110111011 10011
1010110010 10110
1110111011 10011
1010110010 10110
1110111011 10011
1010110010 10110
1110111011 10011
1010110010 10110
1110111011 10011
1010110010 10110
1110111011 10011
1010110010 10110
1110111011 10011
1010110010 10110
1110111011 10011
1010110010 10110
1110111011 10011
1010110010 10110
1110111011 10011
1010110010 10110
1110111011 10011
1010110010 10110
1110111011 10011
int is_contained(int[] a, int[] b) {
int full_match = 0;
for (int i=0;,i<6,i=i+1;) { // 6 different offsets
bool match = true;
for (int j=0;,j<5,j=j+1;) { // every character in a and b must match
if (a[j+i] != b[j]) {
match = false;
}
}
if (match) {
full_match = 1;
}
}
return full_match;
}
int a[10];
int b[5];
int trash = 0;
for (int i=0;,i<24,i=i+1;) {
for (int j=0;,j<10,j=j+1;) {
a[j] = read_char();
}
trash = read_char();
for (int j=0;,j<5,j=j+1;) {
b[j] = read_char();
}
/*
for (int j=0;,j<10,j=j+1;) {
write_char(a[j]);
}
for (int j=0;,j<5,j=j+1;) {
write_char(b[j]);
}
*/
trash = read_char();
write_char('0'+is_contained(a, b));
write_char(10);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment