Author |
Message |
laz0r

Joined: 04 Feb 2010 Posts: 290 Location: Within the depths of Unix |
|
Colon implementation in SH |
|
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 |
|
 |
Karian
Joined: 09 Jan 2008 Posts: 75
|
|
|
|
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 |
|
 |
laz0r

Joined: 04 Feb 2010 Posts: 290 Location: Within the depths of Unix |
|
|
|
Thanks!
_________________ There is no spoon. |
|
Wed Mar 31, 2010 10:01 am |
|
 |
laz0r

Joined: 04 Feb 2010 Posts: 290 Location: Within the depths of Unix |
|
|
|
New question (sorry!)
 |
 |
\
/ 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 |
|
 |
Karian
Joined: 09 Jan 2008 Posts: 75
|
|
|
|
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 |
|
 |
laz0r

Joined: 04 Feb 2010 Posts: 290 Location: Within the depths of Unix |
|
|
|
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 )
_________________ There is no spoon. |
|
Thu Apr 01, 2010 12:16 pm |
|
 |
laz0r

Joined: 04 Feb 2010 Posts: 290 Location: Within the depths of Unix |
|
No-ops in SH |
|
The implementation in PHP takes no-ops as being one cycle; the Javascript implementation just skips them out. Try the third example given:
 |
 |
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 |
|
 |
Karian
Joined: 09 Jan 2008 Posts: 75
|
|
|
|
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) |
|
|
Fri Apr 02, 2010 8:41 am |
|
 |
laz0r

Joined: 04 Feb 2010 Posts: 290 Location: Within the depths of Unix |
|
|
|
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 |
|
 |
tails
Joined: 10 Jun 2008 Posts: 191 Location: Tokyo |
|
|
|
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 |
|
 |
laz0r

Joined: 04 Feb 2010 Posts: 290 Location: Within the depths of Unix |
|
|
|
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 |
|
 |
|