Page 1 of 1

Colon implementation in SH

Posted: Tue Mar 30, 2010 9:26 pm
by laz0r
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?

Posted: Wed Mar 31, 2010 8:36 am
by Karian
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.

Posted: Wed Mar 31, 2010 10:01 am
by laz0r
Thanks!

Posted: Wed Mar 31, 2010 8:52 pm
by laz0r
New question (sorry!)

Code: Select all

         \
/ 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?

Posted: Thu Apr 01, 2010 10:48 am
by Karian
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.

Posted: Thu Apr 01, 2010 12:16 pm
by laz0r
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 :) )

No-ops in SH

Posted: Thu Apr 01, 2010 10:17 pm
by laz0r
The implementation in PHP takes no-ops as being one cycle; the Javascript implementation just skips them out. Try the third example given:

Code: Select all

9&\0000@\!
  s  /\ @
 /\  || @
 p7  || @
 \/  || |
$====/\=/
The PHP one includes all the '=', '|' etc, while the JS one does not.

Posted: Fri Apr 02, 2010 8:41 am
by Karian
have you read the note that comes together with the JavaScript implementation?
[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)

Posted: Fri Apr 02, 2010 9:04 am
by laz0r
Yes, I have (I just thought perhaps if a bug was found it might be fixed!)

Posted: Sat Apr 03, 2010 7:22 am
by tails
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"?

Posted: Sat Apr 03, 2010 4:26 pm
by laz0r
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)