Skip to main content
deleted 376 characters in body
Source Link
Justin
  • 21.3k
  • 9
  • 67
  • 114

According 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 statements

But because that is just boring, hereHere is my attempt in Befunge:

"4"21p"3"22p"2"23p"1"24pv
" 1eniL",,,,,,   v      >
" 2eniL",,,,,,  v>
" 3eniL",,,,,, v>
" 4eniL",,,,,,@>

" 1eniL",,,,,, is a print statement; it prints Line1 .

This works by modifying the code, overwriting the numbers in the print statements before they are executed.

Output:

Line4 Line3 Line2 Line1 

However, since it unfortunately looks like that is not allowed (it is not executing the statements in reverse order, but modifying them), this works:

 v
" 1eniL",,,,,,@>
" 2eniL",,,,,, ^>
" 3eniL",,,,,,  ^>
" 4eniL",,,,,,   ^>
 >                ^

According 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 statements

But because that is just boring, here is my attempt in Befunge:

"4"21p"3"22p"2"23p"1"24pv
" 1eniL",,,,,,   v      >
" 2eniL",,,,,,  v>
" 3eniL",,,,,, v>
" 4eniL",,,,,,@>

" 1eniL",,,,,, is a print statement; it prints Line1 .

This works by modifying the code, overwriting the numbers in the print statements before they are executed.

Output:

Line4 Line3 Line2 Line1 

However, since it unfortunately looks like that is not allowed, this works:

 v
" 1eniL",,,,,,@>
" 2eniL",,,,,, ^>
" 3eniL",,,,,,  ^>
" 4eniL",,,,,,   ^>
 >                ^

Here is my attempt in Befunge:

"4"21p"3"22p"2"23p"1"24pv
" 1eniL",,,,,,   v      >
" 2eniL",,,,,,  v>
" 3eniL",,,,,, v>
" 4eniL",,,,,,@>

" 1eniL",,,,,, is a print statement; it prints Line1 .

This works by modifying the code, overwriting the numbers in the print statements before they are executed.

Output:

Line4 Line3 Line2 Line1 

However, since it unfortunately looks like that is not allowed (it is not executing the statements in reverse order, but modifying them), this works:

 v
" 1eniL",,,,,,@>
" 2eniL",,,,,, ^>
" 3eniL",,,,,,  ^>
" 4eniL",,,,,,   ^>
 >                ^
added 146 characters in body
Source Link
Justin
  • 21.3k
  • 9
  • 67
  • 114

According 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 statements

But because that is just boring, here is my attempt in Befunge:

"4"21p"3"22p"2"23p"1"24pv
" 1eniL",,,,,,   v      >
" 2eniL",,,,,,  v>
" 3eniL",,,,,, v>
" 4eniL",,,,,,@>

" 1eniL",,,,,, is a print statement; it prints Line1 .

This works by modifying the code, overwriting the numbers in the print statements before they are executed.

Output:

Line4 Line3 Line2 Line1 

However, since it unfortunately looks like that is not allowed, this works:

 v
" 1eniL",,,,,,@>
" 2eniL",,,,,, ^>
" 3eniL",,,,,,  ^>
" 4eniL",,,,,,   ^>
 >                ^

According to the specs, I could do this:

print "Line4"
print "Line3"
print "Line2"
print "Line1"

But because that is just boring, here is my attempt in Befunge:

"4"21p"3"22p"2"23p"1"24pv
" 1eniL",,,,,,   v      >
" 2eniL",,,,,,  v>
" 3eniL",,,,,, v>
" 4eniL",,,,,,@>

" 1eniL",,,,,, is a print statement; it prints Line1 .

This works by modifying the code, overwriting the numbers in the print statements before they are executed.

Output:

Line4 Line3 Line2 Line1 

However, since it unfortunately looks like that is not allowed, this works:

 v
" 1eniL",,,,,,@>
" 2eniL",,,,,, ^>
" 3eniL",,,,,,  ^>
" 4eniL",,,,,,   ^>
 >                ^

According 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 statements

But because that is just boring, here is my attempt in Befunge:

"4"21p"3"22p"2"23p"1"24pv
" 1eniL",,,,,,   v      >
" 2eniL",,,,,,  v>
" 3eniL",,,,,, v>
" 4eniL",,,,,,@>

" 1eniL",,,,,, is a print statement; it prints Line1 .

This works by modifying the code, overwriting the numbers in the print statements before they are executed.

Output:

Line4 Line3 Line2 Line1 

However, since it unfortunately looks like that is not allowed, this works:

 v
" 1eniL",,,,,,@>
" 2eniL",,,,,, ^>
" 3eniL",,,,,,  ^>
" 4eniL",,,,,,   ^>
 >                ^
Source Link
Justin
  • 21.3k
  • 9
  • 67
  • 114

According to the specs, I could do this:

print "Line4"
print "Line3"
print "Line2"
print "Line1"

But because that is just boring, here is my attempt in Befunge:

"4"21p"3"22p"2"23p"1"24pv
" 1eniL",,,,,,   v      >
" 2eniL",,,,,,  v>
" 3eniL",,,,,, v>
" 4eniL",,,,,,@>

" 1eniL",,,,,, is a print statement; it prints Line1 .

This works by modifying the code, overwriting the numbers in the print statements before they are executed.

Output:

Line4 Line3 Line2 Line1 

However, since it unfortunately looks like that is not allowed, this works:

 v
" 1eniL",,,,,,@>
" 2eniL",,,,,, ^>
" 3eniL",,,,,,  ^>
" 4eniL",,,,,,   ^>
 >                ^