[Archive!] Pure mathematics, physics, chemistry, etc.: brain-training problems not related to trade in any way - page 316

 

I have a task for programmers (those who are not yet in the course of this task).


Write an MQL script that outputs its source code to a file.

You cannot read from the file.


It is possible not the script itself, but the approach to writing it.

 
I heard about one when I was still learning. The language has to be quite powerful to do that. I doubt it will work for MQL4.
 
on mql is unrealistic, there is no memory work.
 
alsu >>:
на mql нереально, нет работы с памятью.

I think MQL is enough.

"The problem can be solved in any programming language that has the ability to output an arbitrary computable string of text."



 
ihor писал(а) >>

It is not possible to read from the file.

I don't know about MQL, but in VB the solution is this:
Generate a CTRL+PRINTSCR keystroke capturing a screenshot to clipboard. Save the clipboard as a file.

 
Oh, right, I forgot about CharToStr().
Voila, the quine in MQL. Please test it :)))
int start(){string s="int start(){string s=;Print(StringSubstr(s,0,21),CharToStr(34),s,CharToStr(34),StringSubstr(s,21));return(0);}";Print(StringSubstr(s,0,21),CharToStr(34),s,CharToStr(34),StringSubstr(s,21));return(0);}
 

We should add MQLs to the wiki https://ru.wikipedia.org/wiki/Quine:)



 
inevitably:!
 
Brainfuck impressed.
 
alsu >>:
Ах, ну да. Забыл про CharToStr()
Вуаля, квайн на MQL. Прошу тестировать:)))

Sawyer, you're ahead of the curve! I'm working on the same thing. I'm also trying to fit it into one line. So far it's two slashes.

See trailer.

Files: