Superhack vs HVM

Post Reply
User avatar
laz0r
Posts: 290
Joined: Thu Feb 04, 2010 4:18 pm
Location: Within the depths of Unix

Superhack vs HVM

Post 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.
There is no spoon.
User avatar
CodeX
Posts: 350
Joined: Fri Oct 17, 2008 5:28 pm

Post 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"
User avatar
laz0r
Posts: 290
Joined: Thu Feb 04, 2010 4:18 pm
Location: Within the depths of Unix

Post by laz0r »

Great, thanks very much!
There is no spoon.
cutter
Posts: 17
Joined: Mon Jan 12, 2009 12:50 pm

Post 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,,,,,,,,
User avatar
CodeX
Posts: 350
Joined: Fri Oct 17, 2008 5:28 pm

Post by CodeX »

:oops: forgot about that
Post Reply