hacker.org Forum Index
RegisterSearchFAQMemberlistUsergroupsLog in
Superhack vs HVM

 
Reply to topic    hacker.org Forum Index » Challenges View previous topic
View next topic
Superhack vs HVM
Author Message
laz0r



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

Post Superhack vs HVM Reply with quote
I have a question - in HVM you can jump about in your code with ? and c. Is there such a thing in Superhack? I can't work out what [,],{,} do in SuperHack, either.

_________________
There is no spoon.
Tue Mar 09, 2010 7:04 pm View user's profile Send private message
CodeX



Joined: 17 Oct 2008
Posts: 350

Post Reply with quote
As far as I'm aware you can't jump around in your code like with HVM, that could make things somewhat simpler. The closest you get to ? is s and : for conditionally changing direction but you can't directly jump to places like you can with HVM's ? c and g.

The memory is a 2D space, you start off at 0,0 when the program begins and this is where the operand stack begins too, here's how ][}{ change the stack/memory pointer:
    ] changes the stack pointer by <S0> * 1,0
    [ changes the stack pointer by <S0> * -1,0
    } changes the stack pointer by 0,1
    { changes the stack pointer by 0,-1

usually the stack pointer moves up and down the X axis, here's some example code and how the memory would look
Code:
123} 456} 3[789{ 6]111!

Code:
123,,,,,,,,,
,,,456,,,111
789,,,,,,,,,

Where "," means uninitialized, anything from 0-1024,0-128 that you haven't used ever is also uninitialized and the rest is out of bounds by default. Uninitialized memory counts as 0 but if it's read in with < or you use P but if you try to use it as a an operand to anything else you get stuff like a NaN error for arithmetic and p prints "undefined"
Tue Mar 09, 2010 7:41 pm View user's profile Send private message
laz0r



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

Post Reply with quote
Great, thanks very much!

_________________
There is no spoon.
Tue Mar 09, 2010 8:05 pm View user's profile Send private message
cutter



Joined: 12 Jan 2009
Posts: 17

Post Reply with quote
CodeX wrote:
here's some example code and how the memory would look
Code:
123} 456} 3[789{ 6]111!

Code:
123,,,,,,,,,
,,,456,,,111
789,,,,,,,,,



that 's how the memory would look:

Code:
123,,,,,,,,,,,,
,,,4566,,,,,111
,,,7893,,,,,,,,

Wed Mar 10, 2010 7:40 am View user's profile Send private message
CodeX



Joined: 17 Oct 2008
Posts: 350

Post Reply with quote
Embarassed forgot about that
Wed Mar 10, 2010 7:58 am 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.