# The 1-2-3-4-5-6-7-8-9 Sunday event

To quote the previous event page,

And as far as the next Sunday is concerned : whosoever brings me a set of nine tools of the same kind, such that the durability of one is 1, and of another 2, and of another 3 and so forth until the ninth's 9, will in exchange receive a unique antique version of that tool, of one million durability. This exchange is only available once for each tool type, and only available for mining tools.

To quote some earlier discussion in #bitcoin-assets,

danielpbarron: mircea_popescu> danielpbarron so you actually got the tools for sunday ? << i got 9 axes and 9 hoes and i'm just now working on adzes (which require a slightly different method)

mircea_popescu: prolly should publishe the whole thing monday. it's not a trivial math problem

danielpbarron: it sorta is trivial

mircea_popescu: you got the actual function to select optimal usage/mixage of tools given a set ?

danielpbarron: yes

mircea_popescu: in lisp ?

danielpbarron: no

mircea_popescu: (probably ideal usage of lisp, check me out phf im doing lisp girls coach over here!)

danielpbarron: well i don't have a function; i have a formula. an equation rather.

mircea_popescu: aha. actually this'd prollybe interesting to our very own gabriel_laddel too.

phf: i misread that as "couch", was not surprised

danielpbarron: it took me a day of thinking about it off and on to come up with

mircea_popescu: (the problem, ftr, is : you get a set of tools, with arbitrary durability. you can mix any set (which floor-averages), and decay any individual tool (fixed rate). make a collection of 9 with durabilities from 1 to 9). in practice the mix operation is cheap and the decay operation expensive. so, find optimal path and prove it's optimal. for bonus points, offer preference criterion (would A or B be more beneficial if added to the set)

danielpbarron: i plug in a few numbers into equation, solve for x, paste my macro x-many times, let it run while i do other stuff

mircea_popescu: tis a hack.

danielpbarron: i might not be doing it optimally. but we need the explored resources anyway; it's not like i'm wasting time doing somethign i wouldn't have done otherwise

mircea_popescu: ah not at all. was just going after the math angle of it for a second.

And well... lo! And behold! He got them!

Daniel Barron managed three sets of nine tools, with durabilities from 1 to 9 each. Pretty impressive, if you ask me.

The other tool types (improved adze, hoe and pick, as well as chetty stick) were never claimed. Still, a cool three million in antiques goes to the dedicated gent in the blue threadbare shirt. Congrats!

PS. The math^{i} part is still open. Got the sexpr ?

- Math means "without practical value or importance" in this context. [↩]

Monday, 3 August 2015

I haven't been able to come up with a 'sexpr' yet, but here's the equation I used to complete the contest:

{starting_quality} - {quality_lost_per_iteration}*x = {desired_end_quality} + {quality_lost_per_use} * y

where an 'iteration' is when you use a tool and then merge it with a stack of the same kind of tool for the purpose of averaging out the qualities in such a way as to lose a point of quality in the rounding down. For the pickaxe and the hoe, this is accomplished with a stack of two, but for the adze it requires a stack of three (because the adze's normal use takes away an even number of quality points and therefor will not lose a point in rounding down unless stacked in odd numbers).

Anyone who seriously attempted this probably already knows that tools degrade as follows:

hoe - 187 per use, 94 per iteration

pickaxe - 175 .. .. 88 ..

adze - 170 .. .. 57 ..

So if you want to end up with say.. a quality '9' pickaxe and you're starting with two at quality 18`200, your equation should be:

18200 - 88*x = 9 + 175*y

which you can re-arrange to get:

x = 175*n + 157

y = 25 - 88*n

substitute '0' for 'n' because we want the first instance of cross-over, and make sure that 'y' doesn't equal a negative number as that would mean you cannot arrive at the desired quality from the designated starting point.

That leaves us with:

x = 157

y = 25

That means you want to /explore and merge 157 times, and then use the tool normally 25 times.

This probably isn't the most efficient method if you're trying to get a certain quality as fast as possible, but if you were going to do a lot of /exploring anyway, it works fine.

Tuesday, 4 August 2015

Pretty good stuff, I say.