Page 1 of 1

Superhack vs HVM

Posted: Tue Mar 09, 2010 7:04 pm
by laz0r
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.

Posted: Tue Mar 09, 2010 7:41 pm
by CodeX
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: Select all

123} 456} 3[789{ 6]111!

Code: Select all

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"

Posted: Tue Mar 09, 2010 8:05 pm
by laz0r
Great, thanks very much!

Posted: Wed Mar 10, 2010 7:40 am
by cutter
CodeX wrote: here's some example code and how the memory would look

Code: Select all

123} 456} 3[789{ 6]111!

Code: Select all

123,,,,,,,,,
,,,456,,,111
789,,,,,,,,,
that 's how the memory would look:

Code: Select all

123,,,,,,,,,,,,
,,,4566,,,,,111
,,,7893,,,,,,,,

Posted: Wed Mar 10, 2010 7:58 am
by CodeX
:oops: forgot about that