Mercurial > repo
view Something.c @ 7638:25b838ae35f6
<boily> le/rn wat/\xe1\x8a\xa2\xe1\x89\xb5\xe1\x8b\xae\xe1\x8c\xb5\xe1\x8b\xab \xe1\x8b\x8d\xe1\x88\xb5\xe1\x8c\xa5 \xe1\x8b\xa8\xe1\x88\x9a\xe1\x88\xb0\xe1\x88\xab \xe1\x8b\xa8\xe1\x88\x9d\xe1\x8c\x8d\xe1\x89\xa5 \xe1\x8a\xa0\xe1\x8b\xad\xe1\x8a\x90\xe1\x89\xb5 \xe1\x88\xb2\xe1\x88\x86\xe1\x8a\x95\xe1\x8d\xa3 \xe1\x8b\xa8\xe1\x88\x9a\xe1\x88\xb0\xe1\x88\xab\xe1\x8b\x8d\xe1\x88\x9d \xe1\x8a\xa8\xe1\x8c\xa4\xe1\x8d\x8d \xe1\x8a\x90\xe1\x8b\x8d\xe1\x8d\xa2
author | HackBot |
---|---|
date | Sun, 01 May 2016 22:44:03 +0000 |
parents | 3ddb3ea01af1 |
children |
line wrap: on
line source
#include <stdio.h> #include <stdio.h> #include <stdlib.h> #include <string.h> // initialize the tape with 30,000 zeroes unsigned long long int tape[30000] = {0}; unsigned long long int registrar[3] = {0}; // R1, R2, and R3 // set the pointer to point at the left-most cell of the tape unsigned long long int* ptr = tape; void interpret(char* input) { char current_char; size_t i; size_t i2; size_t i3; size_t loop; int i4; time_t t; srand((unsigned) time(&t)); for (i = 0; input[i] != 0; i++) { current_char = input[i]; i4 = rand() % 7; if (i4 == 0) { ++ptr; } else if (i4 == 1) { --ptr; } else if (i4 == 2) { ++*ptr; } else if (i4 == 3) { --*ptr; } else if (i4 == 4) { putchar(*ptr); } else if (i4 == 5) { *ptr = getchar(); } else if (i4 == 6) { continue; } // More commands to come, the CIOL specs are not done } } int main( int argc, char *argv[] ) { interpret(argv[1]); // outputs input return 0; }