#include #include #include #include char buffer[129 * 80]; int head = 0, tail = -1, line_cursor = 80, last_y = 100, i, j, k, ix, iy, p = 0, q, steps, parity = 0, op; float last_x = 40, cx, distance, size0, size1, phase, ta, r, tr, x, y, v0, v1, dy; float Rand(float range) { return (rand() * range) / (float)RAND_MAX; } int GetNextTemplateChar() { if( tail < 0 ) { for(i = 0; i < 129; buffer[i++ * 80 + j] = '\n') for(j = 0; j < 79; buffer[i * 80 + j++] = 'X'); for(i = 0; i < 31; buffer[80 + i++] = ' '); for(tail = 37; i < 48; buffer[80 + i++] = 'X'); buffer[80 + i] = '\n'; } if( line_cursor && buffer[head * 80 + line_cursor - 1] == '\n' ) { for(i = 0; i < 79; buffer[tail * 80 + i++] = 'X'); buffer[tail * 80 + i] = '\n'; tail = -~tail % 128; cx = Rand(70) + 5; distance = sqrt((cx - last_x) * (cx - last_x) + last_y * last_y); if( last_y > 30 && distance > 40 ) { phase = sizeof('X') - 1 ? size0 = 1 + Rand(2), size1 = 12 - size0 + Rand(8), v0 = v1 = 0.5, Rand(2 * M_PI) : (size0 = 17 + Rand(5), size1 = 0, v0 = 0.2, v1 = 0.4); for(ta = r = -0.05; ta < 10 * M_PI; r = size0 + size1 + size1 * 0.5 * sin((ta += 0.05) + phase)) for(tr = 0; tr < r; tr += 0.1) if( (x = cx + tr * cos(ta / 5), dy = tr * sin(ta / 5), y = tail + 108 + (dy > 0 ? v0 * dy : v1 * dy), iy = y + 0.5, iy %= 128, ix = x + 0.5) >= 0 && ix < 79 ) buffer[iy * 80 + ix] = ' '; last_x = cx; last_y = 0; if( sizeof('X') == 1 ) { cx += Rand(size0) - size0 / 2; ix = cx; i = (tail + 128 - 22) % 128; j = (i + 1) % 128; if( ix - 3 > 2 ) buffer[i * 80 + ix - 3] = buffer[j * 80 + ix - 3] = 'X'; if( ix + 2 < 77 ) buffer[i * 80 + ix + 2] = buffer[j * 80 + ix + 2] = 'X'; } } else last_y += 2; head = -~head % 128; line_cursor = 0; } return buffer[head * 80 + line_cursor++]; } void OutputChar(int c) { while( (i = GetNextTemplateChar()) - 'X' ) putchar(i); putchar(c); } void OutputString(const char *s) { for(; *s; OutputChar(*s++)); } int main() { srand(time(NULL)); OutputString("#include" "typedef int O;" "void o(O _){putchar(_);}" "O main()" "{" "O*_[512],**p=_,**d,b,q;" "for(b=0;b++<512;p=_+q)" "_[q=(p-_+1)*9%512]=(O*)p;"); while( (i = getchar()) - EOF ) { q = p; for(steps = 512; abs(p - q) - i; steps--) q = -~q * 9 % 512; op = parity ? 'd' : 'p'; OutputString("o("); if( p > q ) { OutputChar(op); OutputChar('-'); } OutputChar('('); OutputChar(parity ? 'p' : 'd'); OutputChar('='); for(k = 0; k < steps; k++) OutputChar('*'); OutputString("(O**"); for(k = 0; k < steps; k++) OutputChar('*'); OutputChar(')'); OutputChar(op); OutputChar(')'); if( p <= q ) { OutputChar('-'); OutputChar(op); } OutputString(");"); parity ^= 1; p = q; } for(k = 7; k - 6; OutputString(k < 6 ? "{;}" : "")) for(k = 0; k < 6 && buffer[head * 80 + line_cursor + k] == 'X'; k++); OutputString("return+0;}\n"); return 0; }