fork download
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <stdlib.h>
  4.  
  5. // initialize the tape with 30,000 zeroes
  6. unsigned char tape[30000] = {0};
  7.  
  8. // set the pointer to point at the left-most cell of the tape
  9. unsigned char* ptr = tape;
  10.  
  11.  
  12. void interpret(char* input) {
  13. char current_char;
  14. size_t i;
  15. size_t loop;
  16.  
  17. for (i = 0; input[i] != 0; i++) {
  18. current_char = input[i];
  19. if (current_char == '>') {
  20. ++ptr;
  21. } else if (current_char == '<') {
  22. --ptr;
  23. } else if (current_char == '+') {
  24. ++*ptr;
  25. } else if (current_char == '-') {
  26. --*ptr;
  27. } else if (current_char == '.' ) {
  28. putchar(*ptr);
  29. } else if (current_char == ',') {
  30. *ptr = getchar();
  31. } else if (current_char == '[') {
  32. continue;
  33. } else if (current_char == ']' && *ptr) {
  34. loop = 1;
  35. while (loop > 0) {
  36. current_char = input[--i];
  37. if (current_char == '[') {
  38. loop--;
  39. } else if (current_char == ']') {
  40. loop++;
  41. }
  42. }
  43. }
  44. }
  45. }
  46.  
  47.  
  48. int main() {
  49. interpret("-------------------------------------------------------------------[>[-]<[-]]>[>--------------------------------------------------------[>[-]<[-]]>[>-------------------------------------------------------[>[-]<[-]]>[>------------------------------------------------------[>[-]<[-]]>[>---------------------------------------------------[>[-]<[-]]>[>---------------------------------[>[-]<[-]]>[>>----[---->+<]>++.++++++++.++++++++++.>-[----->+<]>.+[--->++<]>+++.>-[--->+<]>-.[---->+++++<]>-.[-->+<]>---.[--->++<]>---.++[->+++<]>.+[-->+<]>+.[--->++<]>---.++[->+++<]>.+++.[--->+<]>----.[-->+<]>-----.[->++<]>+.-[---->+++<]>.--------.>-[--->+<]>.-[----->+<]>-.++++++++.--[----->+++<]>.+++.[--->+<]>-.-[-->+<]>---.++[--->+++++<]>.++++++++++++++.+++[->+++++<]>.[----->+<]>++.>-[----->+<]>.---[->++<]>-.++++++.[--->+<]>+++.+++.[-]]]]]]]"); // outputs input
  50. return 0;
  51. }
Success #stdin #stdout 0s 4292KB
stdin
Standard input is empty
stdout
AIS3{Th1s_1s_br4iNFUCK_bu7_m0r3_ez}