King Rat

Discussion of challenges you have already solved
AMindForeverVoyaging
Forum Admin
Posts: 496
Joined: Sat May 28, 2011 9:14 am
Location: Germany

Post by AMindForeverVoyaging »

rmplpmpl wrote:gosh, did this, but I won't tell you my #s of instructions... for King Mouse I will have to strip it down significantly...
You are certainly not alone, my HVM solutions take up many instructions too. Sucks when you need to get below a certain threshold. :(
User avatar
MatRush
Posts: 33
Joined: Fri May 13, 2011 1:26 pm
Location: China
Contact:

Post by MatRush »

horst wrote:01+0^<0<:1:01-:5?0^<0>0^45*1-:3?1c0<p

I thought 37 instructions weren't that bad until I saw that mouse challenge :shock:
Your code must be:

Code: Select all

01+0^<0<:1:01-:5?0^<0>0^45*1-:2?1c0<p
I think it's a typo~[/code]
User avatar
lamedog
Posts: 3
Joined: Mon Jul 25, 2011 12:00 pm

longer better faster stronger

Post by lamedog »

If you can make it short make it efficient too, this is my long code:

* It doesn't use (abuse) the call stack
* It doesn't write on memory nor damaging the input data
* It uses at most 5 elements of the stack

Code: Select all

0<00^54*:2?3gdp!0^<0^3^:1:2?4g1v2vd1+058*-g
adark
Posts: 9
Joined: Fri Nov 20, 2015 2:04 pm
Contact:

Post by adark »

While I enjoyed writing this, it will definitely be a challenge to do the more brutal short ones.

Here's my code:

Code: Select all

0<10>0^0<<0^82*?:1-3?0<<0<1+0>5cdp
It abuses the call stack to return to the loop counter, doesn't freeze on 0 or negative inputs, and uses at most 5 slots on the stack, when swapping out the largest num.
reesylou
Posts: 2
Joined: Thu Mar 08, 2018 10:41 pm

Post by reesylou »

I am spoiled, in that I usually work with high level languages. I have recently been trying to get my head around using lower level languages and was pretty happy with my solution until I saw some of the ones here (and comments about call stack and efficiency)

Code: Select all

45*9c06-g1-0^0:55*?0^0^1-<1v<:1+1?$0^<1^1->$<p
I'm going to improve this, now I realize I can use the goto jump instead of a subroutine call. Funnily enough, I would have thought the subroutine call would have been "better practice".
Post Reply