Page 2 of 2
Posted: Sat Jan 05, 2013 11:30 am
by sascha27
Inspired by the first example I solved it with
0,s/x?\?/x?\!
___\,=/ \P=/
Posted: Sun Nov 10, 2013 9:16 pm
by trofi
The "memory pointers" description is not quite clear.
Would be nice to have real VM source available.
The
http://www.hacker.org/sh/shphp.phps gives 404 here:
Code: Select all
Not Found
The requested URL /sh/shphp.phps was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Thanks!
Posted: Wed Dec 25, 2013 1:03 am
by megabreit
I posted it to pastebin. Get it here:
http://pastebin.com/AyEQ8xid
String Reversal
Posted: Mon Feb 27, 2017 2:48 pm
by a.goth
teebee wrote:One-liners are often the key to shorter solutions. The following program of size 21 passes all the test cases:
Even smaller and without restrictions:
Just felt like posting it, because using an '@' instruction within a loop is such a nice and hugely useful trick to minimize code size.
Posted: Fri Nov 08, 2019 10:02 am
by yes-man
At first I looked at the SHVM documentation and instantly hated all of it. Put it away for a few years.
Now, that I tried it, it's kinda fun. Definitely more than the HVM.
I took a pretty straight forward approach to this one. But looking at the other solutions, I'm already learning.
* first loop reads stuff (and copies it for comparison)
* then it increases the counter (if stuff != 0)
* if it was, double jump (clear stack top) into second loop
* second loop decreases counter (jump to ! if 0) and prints
/%____,x?\?/_20<x?\!
\>02+1<02/_\P>02-1/
I can see the beauty of the other zero-termination solutions because they don't need a counter.
The deal with @ in the loop to reset is also quite nice.