I had never programmed anything in ASM or any of that kind, so the HVM Challenges are quite a new experience for me. I tried the whole evening to beat this challenge and ended up with a 50char braintwist, which did the trick on my local python-HVM, but fortunately the challenge just wouldnt accept my solution: too many instructions.
Thus i leaned back, started the whole thinking all over and came to this solution:
0<1<0<1</*-p!
It just does the trick by abusing crude integer arithmetics. How nice.
Mod
Hi konsi,
congratulations for having such a good start with writing HVM, I remember my solution was not that short and elegant. However it is quite straight-forward if you write down the calculation in the common infix-notation and convert it to reverse polish notation
You can really look forward to the HVM-XOR challenge... that took me quite a while and it was sometimes a real pain in the ass but nothing compares to the feeling when it works finally
congratulations for having such a good start with writing HVM, I remember my solution was not that short and elegant. However it is quite straight-forward if you write down the calculation in the common infix-notation and convert it to reverse polish notation
You can really look forward to the HVM-XOR challenge... that took me quite a while and it was sometimes a real pain in the ass but nothing compares to the feeling when it works finally
i have about the same answer as konsi. it was pretty easy after the HVM was changed to not work with float values anymore.
my before try was to divide the value by the mod and then keep on subtracting 1 while counting until it was <1. the solution then would've been number - counter*mod, but i think it ran out of cycles.
theStack: can you please explain your answer further?
my before try was to divide the value by the mod and then keep on subtracting 1 while counting until it was <1. the solution then would've been number - counter*mod, but i think it ran out of cycles.
theStack: can you please explain your answer further?
I guess you mean the part speaking about the Mod challenge?m!nus wrote: theStack: can you please explain your answer further?
Well, calculating modula in our common infix notation looks like that, assumed that / performs integer division:
mem[0] - ((mem[0] / mem[1]) * mem[1])
And converting that to postfix is just that what konsi did.
Or did you mean the part about calculating XOR?