109 lines
2.8 KiB
Plaintext
109 lines
2.8 KiB
Plaintext
#include <stdio.h>
|
|
int main(){
|
|
int ptr=0, i=0, cell[7];
|
|
for( i=0; i<7; ++i) cell[i]=0;
|
|
ptr+= 1;
|
|
if(ptr>=7) perror("Program pointer overflow");
|
|
cell[ptr]+= 8;
|
|
while(cell[ptr])
|
|
{
|
|
ptr-= 1;
|
|
if(ptr<0) perror("Program pointer underflow");
|
|
cell[ptr]+= 9;
|
|
ptr+= 1;
|
|
if(ptr>=7) perror("Program pointer overflow");
|
|
cell[ptr]-= 1;
|
|
}
|
|
ptr-= 1;
|
|
if(ptr<0) perror("Program pointer underflow");
|
|
putchar(cell[ptr]);
|
|
ptr+= 2;
|
|
if(ptr>=7) perror("Program pointer overflow");
|
|
cell[ptr]+= 1;
|
|
ptr+= 1;
|
|
if(ptr>=7) perror("Program pointer overflow");
|
|
cell[ptr]+= 1;
|
|
ptr+= 1;
|
|
if(ptr>=7) perror("Program pointer overflow");
|
|
cell[ptr]+= 2;
|
|
ptr+= 1;
|
|
if(ptr>=7) perror("Program pointer overflow");
|
|
while(cell[ptr])
|
|
{
|
|
cell[ptr]-= 1;
|
|
}
|
|
cell[ptr]+= 1;
|
|
ptr-= 1;
|
|
if(ptr<0) perror("Program pointer underflow");
|
|
while(cell[ptr])
|
|
{
|
|
ptr+= 1;
|
|
if(ptr>=7) perror("Program pointer overflow");
|
|
while(cell[ptr])
|
|
{
|
|
cell[ptr]-= 1;
|
|
ptr+= 1;
|
|
if(ptr>=7) perror("Program pointer overflow");
|
|
cell[ptr]+= 1;
|
|
ptr-= 2;
|
|
if(ptr<0) perror("Program pointer underflow");
|
|
cell[ptr]+= 4;
|
|
ptr+= 1;
|
|
if(ptr>=7) perror("Program pointer overflow");
|
|
}
|
|
ptr-= 2;
|
|
if(ptr<0) perror("Program pointer underflow");
|
|
}
|
|
ptr+= 1;
|
|
if(ptr>=7) perror("Program pointer overflow");
|
|
putchar(cell[ptr]);
|
|
cell[ptr]+= 7;
|
|
putchar(cell[ptr]);
|
|
putchar(cell[ptr]);
|
|
cell[ptr]+= 3;
|
|
putchar(cell[ptr]);
|
|
ptr+= 2;
|
|
if(ptr>=7) perror("Program pointer overflow");
|
|
cell[ptr]+= 7;
|
|
putchar(cell[ptr]);
|
|
ptr-= 3;
|
|
if(ptr<0) perror("Program pointer underflow");
|
|
while(cell[ptr])
|
|
{
|
|
while(cell[ptr])
|
|
{
|
|
cell[ptr]-= 1;
|
|
}
|
|
ptr-= 1;
|
|
if(ptr<0) perror("Program pointer underflow");
|
|
while(cell[ptr])
|
|
{
|
|
cell[ptr]-= 1;
|
|
}
|
|
ptr+= 1;
|
|
if(ptr>=7) perror("Program pointer overflow");
|
|
}
|
|
ptr-= 1;
|
|
if(ptr<0) perror("Program pointer underflow");
|
|
cell[ptr]+= 15;
|
|
putchar(cell[ptr]);
|
|
ptr+= 2;
|
|
if(ptr>=7) perror("Program pointer overflow");
|
|
putchar(cell[ptr]);
|
|
cell[ptr]+= 3;
|
|
putchar(cell[ptr]);
|
|
cell[ptr]-= 6;
|
|
putchar(cell[ptr]);
|
|
cell[ptr]-= 8;
|
|
putchar(cell[ptr]);
|
|
ptr+= 2;
|
|
if(ptr>=7) perror("Program pointer overflow");
|
|
cell[ptr]+= 1;
|
|
putchar(cell[ptr]);
|
|
ptr+= 1;
|
|
if(ptr>=7) perror("Program pointer overflow");
|
|
cell[ptr]+= 4;
|
|
putchar(cell[ptr]);
|
|
return 0;
|
|
}
|