Challenge TRICKY001
#1
Posted 09 March 2010 - 01:45 PM
#2
Posted 09 March 2010 - 02:37 PM
Not sure if this is the best way, but it works
#3
Posted 09 March 2010 - 04:03 PM
Can anyone write a version that doesn't need to read from it's own source file?
#4
Posted 09 March 2010 - 07:07 PM
it outputs to file, but you could output to shell instead, if you wanted
#5
Posted 10 March 2010 - 01:18 AM
In the language of your choice: write a program which will output it's own source code.
Question: Does the outputted source code have to be able to then be compiled and repeat the objective? I can get the printing of the sourcecode to work, but I lose all formatting.
See my answer:
Edited by FLW_FTW, 10 March 2010 - 01:20 AM.
#6
Posted 10 March 2010 - 07:38 AM
In the language of your choice: write a program which will output it's own source code.
Question: Does the outputted source code have to be able to then be compiled and repeat the objective? I can get the printing of the sourcecode to work, but I lose all formatting.
See my answer:Spoiler
This is a good attempt and is along the right lines. Ideally the output would be identical to the source file (there's nothing stopping you smooshing the original source file onto one line if you like).
The problem with this solution isn't the formatting though (C ignores whitespace generally so even if a program is all on one line it'll still compile). it's that inside the strings the '\'s you use to escape \"%s\" aren't repeated and that you some quotation marks are lost etc...
Keep working at it, it's close to a full solution.
#7
Posted 18 May 2010 - 01:14 AM
(saved as 'file.py')
#!/usr/bin/env python
print(open('file.py','r').read())
OR if you want to do it the PROPER way:
x='x=%s;x%%`x`';x%`x`
#8
Posted 06 February 2011 - 02:54 AM
BinRev is hosted by the great people at Lunarpages!













