Wednesday 30 July 2014

computer puzzle - MathJax looks kool


(This puzzle relies on familiarity with MathJax, the mathematics renderer that is automatically available for use in answers here at Puzzling Stack Exchange. Examples and more information can be found in related puzzles.)



[Spejlet] fór dem ud af hænderne og styrtede ned mod jorden, hvor det gik i hundrede millioner, billioner og endnu flere stykker, ...
               — from Snedronningen (The Snow Queen) by Hans Christian Andersen



The $\small\texttt{\mirror} \raise2.5ex\strut$ code flew out of their hands and crashed to earth, where it broke into hundreds of millions, billions and even —well, actually just fifteen in all — pieces:


\mirror\mirror\mirror{}%#1#1#1#2#2


      $$\require{begingroup}\begingroup\def|look|\endgroup$$


               — translated to MathJax



Please help fit these pieces back together, like a jigsaw puzzle, for a reflective result:


$$|look|kool| \huge\raise-.5ex\strut$$


Spaces and multiple lines are allowed. For a hint and a half, see Davide Cervone’s solution to MathJax reflex. Your browser page might need to be reloaded in order to reset MathJax after errors while testing. A solution should render the result and need not display the assemblage.



Answer





$$\require{begingroup}\begingroup
\def\mirror#1#2
{
#1\mirror#2
%
#1}
\mirror|look|
\endgroup$$


$$\require{begingroup}\begingroup \def\mirror#1#2 { #1\mirror#2 % #1} \mirror|look| \endgroup$$




Trace, with $\, \raise-.4ex{\unicode{8629}} \:$ for line breaks: $$\require{begingroup}\begingroup \def \Type #1#2#3{ \def \Typf % ##1#1##2#1%\Typf##3{\texttt{##1}##3\Typf % ##2#1%\Typf{##3}} \Typf % #3#1%\Typf{#2}#1%\Typf% } \def \RETURN #1 #2\strut{ \texttt{#1} & \kern-1em \Type { } {\kern.3em\raise-.4ex{\unicode{8629}}\kern.2em} { #2} \\[.5ex] \normalsize #1 #2\strut } % \def\mirror#1#2 { & \kern-2em \texttt{\mirror} \, \underline { \texttt {#1} \tiny\strut } \, \underline{ \texttt{#2} \tiny\strut } & \longrightarrow & \RETURN #1\mirror#2 % #1} \small\begin{array}{lrcrl} \mirror|look| \strut \end{array} \endgroup$$


No comments:

Post a Comment

Understanding Stagnation point in pitot fluid

What is stagnation point in fluid mechanics. At the open end of the pitot tube the velocity of the fluid becomes zero.But that should result...