Page 1 of 2
'Mod' Challenge
Posted: Sat Jul 12, 2008 6:54 pm
by m!nus
I wrote my code which should work, but it outputs that:
Code: Select all
5 test(s) passed
'...' is incorrect.
Is it because of a cycle limitation?
another question: the HVM used to verify the challenge solutions, is it the phyton version or is it even in php?
Posted: Sat Jul 12, 2008 8:16 pm
by adum
hi m!nus -- hmmn, when you take too many cycles it should say something like:
HVM run ERROR: too many cycles: 10002 (PC=1, STACK_SIZE=1)
but yeah, you only have 10k for this one. so you have to be a little smart =)
the hvm on submission is a PHP version. it _should_ behave the same as the python, but if it doesn't, we'd like to debug that. do you see something inconsistent?
adum
Posted: Sat Jul 12, 2008 10:37 pm
by m!nus
oh yeah, the HVM error is there, but it disappears in wrong interpreted html
you should do htmlspecialchars() on the output maybe
Posted: Sat Jul 12, 2008 11:56 pm
by adum
mmn, good idea
thanks,
adum
Posted: Sun Jul 13, 2008 10:45 am
by tails
I regularly use JavaScript version of HVM. Solving 'Fast Mod' was very hard with it.

Posted: Tue Jul 15, 2008 12:10 am
by therethinker
I too use a JS version of HVM. However, I modified it so that it stored the trace in a variable then displayed them once the program finished, which drastically increased speed.
I didn't have trouble w/ Fast Mod at all. My solution to the prior challenge worked.

Posted: Tue Jul 15, 2008 12:28 am
by tails
Great, therethinker!
It may be a spoiler, but my difficulty was that "32/" becomes 1.5 (not 1) on the JS version HVM on IE6. I tried to manage to write a floor function. :-)
Posted: Tue Jul 15, 2008 4:44 am
by palm162
What is HVM i m not to smart yet
Posted: Tue Jul 15, 2008 1:59 pm
by therethinker
tails, as far as the JS version goes, it appears to have several implementation bugs. I know I found another earlier on, but I cannot recall. (I also think the program explanation should at least touch upon the call stack.)
I happened to get lucky w/ Fast Mod, I guess
palm162:
http://www.hacker.org/hvm/
Posted: Tue Jul 15, 2008 2:57 pm
by m!nus
i tried to convert the python HVM to PHP but it didnt work though, had no time to fix it yet
Posted: Tue Jul 15, 2008 4:12 pm
by therethinker
Curiously, has anyone written a higher-level language and a to-HVM compiler? Back when it was just strlen & the Small World challenges, it didn't make much sense to do it, but with newly added ones, it might not be so stupid.
(I wouldn't want your implementation, I'm just curious if its been done.)
Posted: Wed Jul 16, 2008 12:03 am
by adum
i think bok has fixed the hvm javascript bugs now.
i just got my hvm assembler working. doing the jumps by hand is such a huge pain. i know at least one other solver has written a tool. this is one thing we don't want shared on the forums. but sharing an hvm implementation in a different lang (like someone did for C#) is just fine.
adum
Posted: Wed Jul 16, 2008 4:17 am
by therethinker
Oh, I agree, I know I wouldn't want my assembler public.
Posted: Wed Jul 16, 2008 1:45 pm
by m!nus
therethinker wrote:Curiously, has anyone written a higher-level language and a to-HVM compiler? Back when it was just strlen & the Small World challenges, it didn't make much sense to do it, but with newly added ones, it might not be so stupid.
(I wouldn't want your implementation, I'm just curious if its been done.)
thanks for the idea, i'm gonna try making one, now that i have finally time again

Posted: Fri Jul 25, 2008 9:43 am
by ajay
tails wrote:I regularly use JavaScript version of HVM. Solving 'Fast Mod' was very hard with it.
