hacker.org Forum Index
RegisterSearchFAQMemberlistUsergroupsLog in
Colon implementation in SH

 
Reply to topic    hacker.org Forum Index » Challenges View previous topic
View next topic
Colon implementation in SH
Author Message
laz0r



Joined: 04 Feb 2010
Posts: 290
Location: Within the depths of Unix

Post Colon implementation in SH Reply with quote
I think something's wrong: when I do
CODE:
code here%54:

As I understand it, it ought to go left so what is executed is:
% []
5 [5]
4 [5,4]
: []
4 [4]
5 [4,5]
% [4,5]
e [4,5]
d [4,5] etc

What I actually get is it attempting to go up - is it that it turns 90 degrees left then? If so, could that be written into the instructions please?

_________________
There is no spoon.
Tue Mar 30, 2010 9:26 pm View user's profile Send private message
Karian



Joined: 09 Jan 2008
Posts: 75

Post Reply with quote
the instructions aren't saying that you will go left, but that you turn left, and this is indeed a turn of 90 degrees. you can see it as a conditional '/' '\' or ' '. It is always relative to the direction you are going.
To be sure what a command is exactly doing, you can always check the php implementation, or experiment with the implementation.
Wed Mar 31, 2010 8:36 am View user's profile Send private message
laz0r



Joined: 04 Feb 2010
Posts: 290
Location: Within the depths of Unix

Post Reply with quote
Thanks!

_________________
There is no spoon.
Wed Mar 31, 2010 10:01 am View user's profile Send private message
laz0r



Joined: 04 Feb 2010
Posts: 290
Location: Within the depths of Unix

Post Reply with quote
New question (sorry!)
Code:

         \
/ w15*48 /
\!


how will this work - does it put spaces in, line breaks etc, down to (5,1) in the code, or is there just this isolated space sitting at (5,1), surrounded by nothing, not even spaces?

_________________
There is no spoon.
Wed Mar 31, 2010 8:52 pm View user's profile Send private message
Karian



Joined: 09 Jan 2008
Posts: 75

Post Reply with quote
I have no clue, and I don't see the use of what you are doing. Why would you want to change a code value that you aren't processing.
If you really want to know, you have ways to find this on yourself. 2 ways spring to mind:
1. You check the implementation of Superhack, and see how it is working. At the same time, you can increase your knowledge about php.
2. Maybe a bit easier, write a program where you try to execute the code value you just inserted, and see how it behaves. For this, I would certainly use the php implementation, if you want to be sure that the result is as expected when you try to use this in a challenge.
Thu Apr 01, 2010 10:48 am View user's profile Send private message
laz0r



Joined: 04 Feb 2010
Posts: 290
Location: Within the depths of Unix

Post Reply with quote
This is just for the purpose of writing an interpreter - I want it to be able to cover things like this (Delphi will throw an access violation if I try to write somewhere which doesn't exist, but no such violation occurs in the PHP implementation). Thanks for the ideas - I couldn't find the PHP source (stupid given that there is a link at the top of the page Smile )

_________________
There is no spoon.
Thu Apr 01, 2010 12:16 pm View user's profile Send private message
laz0r



Joined: 04 Feb 2010
Posts: 290
Location: Within the depths of Unix

Post No-ops in SH Reply with quote
The implementation in PHP takes no-ops as being one cycle; the Javascript implementation just skips them out. Try the third example given:
Code:

9&\0000@\!
  s  /\ @
 /\  || @
 p7  || @
 \/  || |
$====/\=/

The PHP one includes all the '=', '|' etc, while the JS one does not.

_________________
There is no spoon.
Thu Apr 01, 2010 10:17 pm View user's profile Send private message
Karian



Joined: 09 Jan 2008
Posts: 75

Post Reply with quote
have you read the note that comes together with the JavaScript implementation?

Quote:
[NOTE: the JavaScript version is just for casual experimentation on this page, it may not always behave exactly the same as the implementation used to judge the challenge submissions)

Fri Apr 02, 2010 8:41 am View user's profile Send private message
laz0r



Joined: 04 Feb 2010
Posts: 290
Location: Within the depths of Unix

Post Reply with quote
Yes, I have (I just thought perhaps if a bug was found it might be fixed!)

_________________
There is no spoon.
Fri Apr 02, 2010 9:04 am View user's profile Send private message
tails



Joined: 10 Jun 2008
Posts: 191
Location: Tokyo

Post Reply with quote
The example runs exactly the same way on both PHP and JS to me.
What difference do you have?
What do you mean by "include"?
Sat Apr 03, 2010 7:22 am View user's profile Send private message
laz0r



Joined: 04 Feb 2010
Posts: 290
Location: Within the depths of Unix

Post Reply with quote
I'm sorry, I think I must be going bonkers at last - now they run the same. I could have sworn that the JS version just skipped out the no-ops whereas the PHP version included them as an operation (so a thread can be delayed with no-ops in the PHP but not in the JS)

_________________
There is no spoon.
Sat Apr 03, 2010 4:26 pm View user's profile Send private message
Display posts from previous:    
Reply to topic    hacker.org Forum Index » Challenges All times are GMT
Page 1 of 1

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Flowers Online.