Quine in BlitzMax
BlitzMax Forums/BlitzMax Programming/Quine in BlitzMax
| ||
| A quine is a program, that produces its complete source code as its only output. I wonder what is shortest quine in BlitzMax... I've come to this: q$=Chr$(34);ReadData a$;Print a$+q$+a$+q$;DefData"q$=Chr$(34);ReadData a$;Print a$+q$+a$+q$;DefData" 100 chars, who less? :) |
| ||
| Whats the point? |
| ||
| Print "Print ~"That's pointless~"" |
| ||
| No practical use, just interesting puzzle for solving and brain training. :) q$=Chr(34);ReadData a$;Print a+q+a+q;DefData"q$=Chr(34);ReadData a$;Print a+q+a+q;DefData" Even 90 chars |
| ||
| Why is Dreamora's not valid? |
| ||
| Because it doesn't compile, I'd say. As soon as the second quote mark is reached, the rest is just gibberish from BlitzMax's perspective. |
| ||
| Why is Dreamora's not valid? The output is not identical to the source code. If you run the output it will generate a different result than running the original. Anyway, not a quine, but there are plenty of other pretty amazing pieces of code, like this:
char*M,A,Z,E=40,J[40],T[40];main(C){for(*J=A=scanf(M="%d",&C);
-- E; J[ E] =T
[E ]= E) printf("._"); for(;(A-=Z=!Z) || (printf("\n|"
) , A = 39 ,C --
) ; Z || printf (M ))M[Z]=Z[A-(E =A[J-Z])&&!C
& A == T[ A]
|6<<27<rand()||!C&!Z?J[T[E]=T[A]]=E,J[T[A]=A-Z]=A,"_.":" |"];}
It's a C program to generate mazes, written by John Tromp. ( http://www.iwriteiam.nl/SigProgC.html ) The source itself not only looks like a maze, but is a maze *spelling* the word 'maze'. |