# HG changeset patch # User HackBot # Date 1461889854 0 # Node ID 4f3b80f966b3771237ae83c535f37bca759e78b5 # Parent a8780de2da16d80d5e95957fc10dc6be9c667e10 ` rm 6TL7V2mM BGTV9E93 UZ3ESUfL cdxuhHRs waDs9gmT yn9LVhJv # littering is a crime diff -r a8780de2da16 -r 4f3b80f966b3 6TL7V2mM --- a/6TL7V2mM Fri Apr 29 00:24:49 2016 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ -#include -#include -#include -#include - - -// 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; - - for (i = 0; input[i] != 0; i++) { - current_char = input[i]; - i4 = rand() % 11; - 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; -} \ No newline at end of file diff -r a8780de2da16 -r 4f3b80f966b3 BGTV9E93 --- a/BGTV9E93 Fri Apr 29 00:24:49 2016 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,119 +0,0 @@ -#include -#include - -#include -#include -#include -#include -// 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; - char i4; - - for (i = 0; input[i] != 0; i++) { - current_char = input[i]; - if (current_char == 'p') { - ++ptr; - } else if (current_char == 'P') { - --ptr; - } else if (current_char == '+') { - ++*ptr; - } else if (current_char == '-') { - --*ptr; - } else if (current_char == 'o' ) { - putchar(*ptr); - } else if (current_char == 'i') { - - *ptr = getchar(); - - } else if (current_char == '[') { - continue; - } else if (current_char == ']' && *ptr) { - loop = 1; - while (loop > 0) { - current_char = input[--i]; - if (current_char == '[') { - loop--; - } else if (current_char == ']') { - loop++; - } - } - } else if (current_char == '/') { //push the value under the pointer to the register specified by the next value under the pointer - ++ptr; - if (*ptr > 2) { - --ptr; - } else { - char temp1 = *ptr; - --ptr; - registrar[temp1] = *ptr; - } - } else if (current_char == '\\') { //Same as /, except popped - ++ptr; - if (*ptr > 2) { - --ptr; - } else { - char temp1 = *ptr; - --ptr; - *ptr = registrar[temp1]; - } - } else if (current_char == 'a') { //Add R1 to R2 and put the sum in R3 - registrar[2] = registrar[0] + registrar[1]; - } else if (current_char == 's') { //Subtract R1 from R2 and put the diffrence in R3 - registrar[2] = registrar[0] - registrar[1]; - } else if (current_char == 'd') { // Divide R1 by R2 and put the quotient in R3 - if (registrar[1] == 0) { - printf("Division by zero occured, Ending!"); - break; - } - registrar[2] = registrar[0] / registrar[1]; - } else if (current_char == 'm') { // Multiply R1 by R2 and put the result in R3 - registrar[2] = registrar[0] * registrar[1]; - } else if (current_char == '*') { // Terminate - break; - } else if (current_char == 'j') { // Jump forward n spaces - - for (i2 = *ptr; i2 != 0; i2--) { - i++; - current_char = input[i]; - } - } else if (current_char == 'J') { // Jump backword n spaces - for (i2 = *ptr; i2 != 0; i2--) { - i--; - current_char = input[i]; - } - } else if (current_char == 'r') { //prints out the data in the source until it hits a ; - i++; - - i3 = i; - for (input[i3];input[i3] != ';';i3++){ - putchar(input[i3]); - i++; - - } - - } else if (current_char == 'R') { - i++; - - putchar(input[i]); - } - // More commands to come, the CIOL specs are not done - } -} - - -int main( int argc, char *argv[] ) { - - interpret(argv[1]); // outputs input - return 0; -} \ No newline at end of file diff -r a8780de2da16 -r 4f3b80f966b3 UZ3ESUfL --- a/UZ3ESUfL Fri Apr 29 00:24:49 2016 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -#include -#include -#include -#include - - -// 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; - for (i = 0; input[i] != 0; i++) { - current_char = input[i]; - srand((unsigned) time(&t)); - i4 = rand() % 11; - 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; -} \ No newline at end of file diff -r a8780de2da16 -r 4f3b80f966b3 cdxuhHRs --- a/cdxuhHRs Fri Apr 29 00:24:49 2016 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,111 +0,0 @@ -#include -#include -#include - -void initialize(char english[], char piglatin[]); -void readinput(char english[]); -int countwords(char english[]); -void convert(int words, char english[], char piglatin[]); -void writeoutput(char piglatin[]); - -main( ) -{ - char english[80], piglatin[80]; - int words; - printf("\nPig Latin Translator in C\n\n"); - printf( "Type \ 'END\' when finished\n\n"); - - do - { - /* processing a new line of text */ - initialize(english, piglatin); - readinput(english); - - /* testing stopping condition */ - if (toupper(english[0]) == 'E' && toupper(english[1]) == 'N' && toupper(english[2]) == 'D') - break; - - /* count the number of words in the line */ - words = countwords(english); - - /* Now Pig Latin Translator in C converts English to Pig Latin */ - convert(words, english, piglatin); - writeoutput(piglatin); - } - while (words >= 0); - printf("\naveHa aa icena ayda (Have a nice day)\n"); -} - - -/* initializing character arrays with blank spaces */ -void initialize(char english[], char piglatin[]) -{ - int count; - for (count = 0; count < 80; ++count) - english[count] = piglatin[count] = ' '; - return; -} - - -/* reading one line of text in English */ -void readinput(char english[]) -{ - int count = 0; - char c; - while (( c = getchar()) != '\n') - { - english[count] = c; - ++count; - } - return; -} - - -/* scanning the given message or line of text and determining the number of words in it */ -int countwords(char english[]) -{ - int count, words = 1; - for (count = 0; count < 79; ++count) - if (english[count] == ' ' && english[count + 1] != ' ') - ++words; - return (words); -} - - -/* now Pig Latin translator in C coverts each word into Pig Latin */ -void convert(int words, char english[], char piglatin[]) -{ - int n, count; - int m1 = 0; /* m1 indicates the position of beginning of each word */ - int m2; /* m2 indicates the end of the word */ - - /* convert each word */ - for (n = 1; n <= words; ++n) - { - /* locating the end of the current word */ - count = m1 ; - while (english[count] != ' ') - m2 = count++; - - /* transposing the first letter of each word and adding 'a' at the end */ - for (count = m1 ; count < m2; ++count) - piglatin[count + (n - 1)] = english[count + 1]; - piglatin[m2 + (n - 1)] = english[m1]; - piglatin[m2 + n] = 'a'; /* adding 'a' at the end */ - - /* reseting the initial marker */ - m1 = m2 + 2; - } - return; -} - - -/* now Pig Latin translator in C displays the line of English text in Pig Latin */ -void writeoutput(char piglatin[]) -{ - int count = 0; - for (count = 0; count < 80; ++count) - putchar(piglatin[count]); - printf("\n"); - return; -} \ No newline at end of file diff -r a8780de2da16 -r 4f3b80f966b3 waDs9gmT --- a/waDs9gmT Fri Apr 29 00:24:49 2016 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -#include -#include -#include -#include - - -// 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; - for (i = 0; input[i] != 0; i++) { - current_char = input[i]; - srand((unsigned) time(&t)); - 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; -} \ No newline at end of file diff -r a8780de2da16 -r 4f3b80f966b3 yn9LVhJv --- a/yn9LVhJv Fri Apr 29 00:24:49 2016 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,73 +0,0 @@ -#include -#include -#include -#include - - -// 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; - - for (i = 0; input[i] != 0; i++) { - current_char = input[i]; - i4 = rand() % 11; - 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; - } else if (i4 == 7 && *ptr) { - loop = 1; - while (loop > 0) { - current_char = input[--i]; - if (current_char == '[') { - loop--; - } else if (current_char == ']') { - loop++; - } - } - } else if (i4 == 8) { // Jump forward n spaces - - for (i2 = *ptr; i2 != 0; i2--) { - i++; - current_char = input[i]; - } - } else if (i4 == 9) { // Jump backword n spaces - for (i2 = *ptr; i2 != 0; i2--) { - i--; - current_char = input[i]; - } - } - // More commands to come, the CIOL specs are not done - } -} - - -int main( int argc, char *argv[] ) { - - interpret(argv[1]); // outputs input - return 0; -} \ No newline at end of file