last day (14 days later) » 

08:48
1
A: Execute prints backwards

QuincunxAccording to the specs, I could do this (in Python 2 and probably some others): print "Line4" #This print statement is print "Line3" print "Line2" print "Line1" #print "Line2" #print "Line3" #print "Line4" #This one right here #Meaning that I am only using "those" print statement...

@svick Yes it does. It executes the prints in the reverse order.
The first solution is not bending the rules, it's breaking them: it's clearly stated that <code>Your code will have this form: //some lines of code
/*code*/ print "Line1" /*code*/
/*code*/ print "Line2" /*code*/
/*code*/ print "Line3" /*code*/
/*code*/ print "Line4" /*code*/
//some lines of code</code> This means that you must code them in this order but execute them in the opposite way.
@Vereos Oh, you mean that we cannot edit that code. I thought it could be moved around. How is it now?
Still not good, I'm sorry. As I stated in another comment, the contest is not about printing the strings, but executing the commands in the reverse way (like the title says). You are not actually executing those last three prints since they're comments.
@Vereos Oh but I am executing them. They are simply before the comments as well (those ones are the same).
08:48
@Quincunx No, you are executing another print command that has the same arg, written before the comment. You cannot run a comment.
I'd definitely call that the same statment
You ask for "executing those prints backwards". This is exactly that.
For "backwards" I meant "reversing their order", and "those" was specifically written to indicate those statements and not just a copy of them.
How would you have written this?
You really don't want me to exploit the challenge like this do you...
I'd probably have said, "Those four statements can be the only prints in the code."
Bascially, I mean that the challenge is restricted to using those lines to print.
I see.
How about I just remove that bit and replace it with a new idea I came up with?
Which I think is appropriate
Golfscript: "Line1"
"Line2"
"Line3"
"Line4"
as the program would print those four strings.
But if I added print print print print after the last line, the strings would be printed in reverse order.
08:58
I guess this would be better...? Anyway I guess even the other answer could be accepted as "rule-bending".
Actually, I would put a \n at the end of those strings, to put each printed string on a newline.
The main problem with this is that it is not those lines that do the printing (without the print statements). It is the fact that the program hit the end of the file, so the contents of the stack are printed.
If I remember correctly (please, correct me if I'm wrong), "Line1"..."Line4" would print Line1Line2Line3Line4, right?
So maybe that doesn't count too.....
So I guess they can be seen as print statements
That's right, that's why I'd put \n in the strings, so it would print the strings on a new line.
09:04
I guess that is a perfectly valid answer
I'm not sure they should be counted as print statements, because the strings aren't what is printing. The part that prints is the end_of_file.
Oh...
Exactly
There, I edited out the bad part and edited the better part to make it reasonable. Cya later Vereos.
Cya later!

last day (14 days later) »