King Rat
BTW, lukas, you code has a bug: it terminates when it encounters a 0, so if that's part of the actual data, and the largest number comes afterwards, the result is wrong. But apparently that case does not occur in the tests that determine whether you pass.
And after sitting over this for 3 hours, I can't see for the life of me how to get it down below 29 instructions, let alone 21, seeing how even the simplest operations take 5 or more instructions.
I only managed to get down to 28 by using 0 to terminate and assuming only positive numbers; unfortunately that's not a valid assmption.
And after sitting over this for 3 hours, I can't see for the life of me how to get it down below 29 instructions, let alone 21, seeing how even the simplest operations take 5 or more instructions.
I only managed to get down to 28 by using 0 to terminate and assuming only positive numbers; unfortunately that's not a valid assmption.
-
- Posts: 61
- Joined: Wed Apr 30, 2008 3:31 am
I would say that 3 hours is not that long. It took me a while , may be 3 weeks may be more to find the correct solution for 27. Then I put away HVM challenges and switch to others. Then I came back and got those mice down to 22. The mice problems are good in sense that it's pure coding and no IDE or assembler would help you.brazzy wrote:BTW, lukas, you code has a bug: it terminates when it encounters a 0, so if that's part of the actual data, and the largest number comes afterwards, the result is wrong. But apparently that case does not occur in the tests that determine whether you pass.
And after sitting over this for 3 hours, I can't see for the life of me how to get it down below 29 instructions, let alone 21, seeing how even the simplest operations take 5 or more instructions.
I only managed to get down to 28 by using 0 to terminate and assuming only positive numbers; unfortunately that's not a valid assmption.
Well, it didn't take me too long to discover the 21-solution. So I don't think that many hours or even days are necessary. Of course, if you're stuck, it may be reasonably to stand back and come again later. I also found quinine much harder (and actually needed some days to solve it), because there are many more possibilities to try out.
@brazzy: It's nice and important if you know how to write valid programs. But this is the wrong place for the "correct" way of programming... this is hacker.org: everything that passes the test is a correct solution.
@brazzy: It's nice and important if you know how to write valid programs. But this is the wrong place for the "correct" way of programming... this is hacker.org: everything that passes the test is a correct solution.
- livinskull
- Posts: 22
- Joined: Fri Jun 26, 2009 12:01 pm
- Location: /dev/null
- Contact:
My Code:
Assembled to:
Yes, its kinda big, but im lucky my assembler finally works so far
Code: Select all
preserve 100
var pointer
var tmp
mov tmp, [pointer]
start:
push tmp
push [pointer]
jg next
mov tmp, [pointer]
next:
inc pointer
push 20
push pointer
jg start
pi tmp
Code: Select all
55*4*<<99*92*+2+>99*92*+2+<55*4*<<:1-98+?55*4*<<99*92*+2+>55*4*<1+55*4*>54*55*4*<:1-792+*01-*?99*92*+2+<p
-
- Posts: 8
- Joined: Thu Jul 02, 2009 3:41 pm
My code:
Code: Select all
0<45*>10^<0^45*<:1:3?d4g45*>1+0^45*:01-:158*-?45*<p
Well I'm quite ashamed of mine.
Too long, call stack flooder, etc.
The "21 instructions" challenge is gonna take me some time...
Code: Select all
0<00^991++:75*1-?1+0^2v2v<1^1^:1-01-*7?1vd1v3cd1v3cdp
The "21 instructions" challenge is gonna take me some time...
Another straightforward version:
NOP slides! xD
Code: Select all
0<999++>12g1+0^54*6g54*1+g:62**g 999++<p!0^<999++<:77*4+*g 0^<999++>055*5* -g
My code:
compiled to:
Let's hope there is only one with an instruction limit....
Code: Select all
[9*9]=0;
[9*8]=[[9*9]];
while (4*5>[9*9]) {
if ([[9*9]] > [9*8]) {
[9*8] = [[9*9]];
}
[9*9] = [9*9]+1;
}
printi [9*8];
Code: Select all
99*00^2v>d98*00^2v>d45*99*<:1:92+ ?01 g10:991+*5+ ?99*<<98*<:1:92+ ?01 g10:92*6+ ?98*99*<<0^2v>d0 g99*99*<1+0^2v>d0996+*4+-g98*<p!
look, here comes my quick'n-dirty solution for this one...
it uses a !subroutine! for comparing the s0/s1 values in place ..
44*g!1^1^:1:2?1vd$! 0<1<5c 2<5c 3<5c 4<5c 5<5c 6<5c 7<5c 8<5c 9<5c 91+<5c 92+<5c 93+<5c 94+<5c 95+<5c 96+<5c 97+<5c 98+<5c 99+<5c 99+1+<5c p
lots of bits wasted, but why not, i got enough of them here ... its all for speed and read-ability of course !! ...
happy coding / greets - max.
it uses a !subroutine! for comparing the s0/s1 values in place ..
44*g!1^1^:1:2?1vd$! 0<1<5c 2<5c 3<5c 4<5c 5<5c 6<5c 7<5c 8<5c 9<5c 91+<5c 92+<5c 93+<5c 94+<5c 95+<5c 96+<5c 97+<5c 98+<5c 99+<5c 99+1+<5c p
lots of bits wasted, but why not, i got enough of them here ... its all for speed and read-ability of course !! ...
happy coding / greets - max.
-
- Posts: 33
- Joined: Sat Aug 13, 2011 2:13 pm