It's A Very Small Word!

Discussion of challenges you have already solved
Post Reply
User avatar
teebee
Posts: 89
Joined: Mon Nov 10, 2008 3:21 pm
Location: Germany

It's A Very Small Word!

Post by teebee »

My solution is 56 instructions long. Is there a smaller one?

Moreover, I could write a program with 58 instructions that prints out 'Hello, Small World!' and does not grow the operand stack larger than 25.
User avatar
teebee
Posts: 89
Joined: Mon Nov 10, 2008 3:21 pm
Location: Germany

Post by teebee »

What about adding a corresponding "King of the Hill" challenge to the "It's A Very Small Word!" and "It's a Very Small World" challenges?
User avatar
teebee
Posts: 89
Joined: Mon Nov 10, 2008 3:21 pm
Location: Germany

Re: It's A Very Small Word!

Post by teebee »

teebee wrote:My solution is 56 instructions long. Is there a smaller one?
Yes, there is a smaller one:

Code: Select all

$ hackvm.py word55.hvm
Hello, Small Word!
--
length of code: 55
number of cycles: 322
operand stack depth: 4
maximum operand stack depth: 20
call stack depth: 1
maximum call stack depth: 9
User avatar
Hippo
Posts: 339
Joined: Sat Feb 01, 2014 12:05 am
Location: Praha 5

Post by Hippo »

Yes, I was shortennig till my Hello, Small World! was 58 op long ... and it was rejected due to "l".
57 op long Hello, Small Word! was no problem than.

Grrr ... teebee ... how do you reduce the code size ... the 2,5 years between posts is a small satisfaction.
User avatar
Hippo
Posts: 339
Joined: Sat Feb 01, 2014 12:05 am
Location: Praha 5

Re: It's A Very Small Word!

Post by Hippo »

teebee wrote:

Code: Select all

$ hackvm.py word55.hvm
Hello, Small Word!
--
length of code: 55
number of cycles: 322
operand stack depth: 4
maximum operand stack depth: 20
call stack depth: 1
maximum call stack depth: 9
Grrr, I am on

Code: Select all

$ hackvm.py word55.hvm
Hello, Small Word!
--
length of code: 55
number of cycles: 338
operand stack depth: 6
maximum operand stack depth: 22
call stack depth: 1
maximum call stack depth: 9
:) only small step divided me from the correct solution decreasing just stack depth by 2.
Seems I calculate number of cycles diferent way than teebee.

Actually, I have 2 solutions with max stack length 19 and code length 55.
(But it's just an easy modification of the solution)
User avatar
TheBigBoss
Posts: 29
Joined: Thu Jun 07, 2012 12:07 pm
Location: Germany

Post by TheBigBoss »

The hardest part was letting the VM stop.
But 55 instructions? :( No way! End of road...
Post Reply