Brokener Keys

Discussion of challenges you have already solved
snibril
Posts: 31
Joined: Sun Oct 26, 2008 11:18 pm

Brokener Keys

Post by snibril »

My program only works for numbers with a difference smaller than 300. Has someone a solution without this limitation?
tog
Posts: 70
Joined: Fri Nov 14, 2008 11:23 am
Location: Germany

Post by tog »

I think you could enlarge the difference by just multiplying another 9 :wink: . But I wonder if there is a solution that isn't limited to some range of numbers.
User avatar
efe
Posts: 45
Joined: Sun Oct 26, 2008 10:28 am
Location: germany

Post by efe »

My program is limited by the size of the memory.
It works only for numbers in the range [2..16384].

Due to the cycle limit I had to narrow it down even more to [2..1024].
User avatar
m!nus
Posts: 202
Joined: Sat Jul 28, 2007 6:49 pm
Location: Germany

Post by m!nus »

numbers are 1-256 so no need for bigger limits.
did you do it with lots of spaces aswell?
User avatar
efe
Posts: 45
Joined: Sun Oct 26, 2008 10:28 am
Location: germany

Post by efe »

No, there are no spaces in my program.
It's only 24 instructions long and it can be made even shorter.
snibril
Posts: 31
Joined: Sun Oct 26, 2008 11:18 pm

Post by snibril »

I don't like my solution:

1<0<1<-25*0^*3*+2*c {Spaces till pos. 600}p! {min. 600Spaces}0<p
User avatar
m!nus
Posts: 202
Joined: Sat Jul 28, 2007 6:49 pm
Location: Germany

Post by m!nus »

efe: i'd love to see how your method works, because mine, with its 2KB of spaces isn't very nice.
User avatar
efe
Posts: 45
Joined: Sun Oct 26, 2008 10:28 am
Location: germany

Post by efe »

OK, here is my solution:

Code: Select all

...
It's pretty neat, isn't it? :)

BTW: To print the minimum without :,? and / instructions I only need 18 instructions:

Code: Select all

...
snibril
Posts: 31
Joined: Sun Oct 26, 2008 11:18 pm

Post by snibril »

I had a similar idea, but I didn't find a function that always give me a zero except for one specific value. I didn't think to use the memory for this.
the_impaler
Posts: 61
Joined: Wed Apr 30, 2008 3:31 am

Post by the_impaler »

efe wrote:OK, here is my solution:

Code: Select all

...
It's pretty neat, isn't it? :)

BTW: To print the minimum without :,? and / instructions I only need 18 instructions:

Code: Select all

...
Nice.
I have similar solution but the loop is in other direction and so it's 60 instructions long.

Code: Select all

.....
I had to take special precautions for neighboring numbers and for equal numbers
It works for numbers starting with 1 and with difference no more 1242 to fit into cycle limit.
Last edited by the_impaler on Wed Dec 24, 2008 1:26 am, edited 1 time in total.
Karian
Posts: 75
Joined: Wed Jan 09, 2008 10:21 am

Post by Karian »

I more or less had the same solution as snibril, the same concept anyway. I can find a nice evolution is my solutions for this line of puzzles. They are getting more and more specific to the input that is used in the tests.

For the first puzzle, I had one that even worked with negative numbers, only limitation was that the difference squared is still an integer. I haven't tested it with large numbers myself, but I think it was still making the cycle limit.

For the second one it only worked for positive numbers, but the limitation about the difference dropped. The code was actually a lot nicer then the first challenge, and I don't see any problems with the cycle limit for any size of numbers.

And now for the last one, it is limited to the small range that the test cases are made of. When the range extends, it will become pretty hard to get it working within the cycle limit.
theStack
Posts: 72
Joined: Sun Nov 02, 2008 12:46 am

Post by theStack »

the_impaler wrote: Nice.
I have similar solution but the loop is in other direction and so it's 60 instructions long.
Loop? It is possible to do loops without condition testing? Hm good to know... thanks for the hint :D
Well all I can imagine is infinity loops but somewhen you have to stop.

I had an idea about implementing the challenge's solution quite nice and short but I just thought loops are not possible anyway so I forgot that idea and did it with the dirty filling spaces solution :wink: (mine is >7k, I considered that the differences between the numbers could be quite large)

It's a pity that the codes are not there anymore but I guess they would reveal too much for the "Brokenest keys" challenge :wink:
therethinker
Posts: 144
Joined: Fri Mar 28, 2008 11:29 pm
Location: #hacker.org on Freenode

Post by therethinker »

My code, I guess, was like efes. It **** until it finds a number.

Code: Select all

...
EDIT: After reading the Brokenest Keys thread, apparently this technique gives it away ;-)
jonik555
Posts: 43
Joined: Mon Aug 31, 2009 6:18 pm
Location: Prague

Post by jonik555 »

This I invented for challenge before, and it worked perfectly also in this :D

Code: Select all

20<>11<>32> 2<0^<8*g1+2>56+c        2<<1-<p!
arthur
Posts: 21
Joined: Fri Jul 23, 2010 12:44 pm

Post by arthur »

my solution only works for positive integers
and require the small number smaller than the maximum cycles allowed

Code: Select all

0<1<+60<61<00>01>>>00^<g1+45*c-p
Post Reply