Saturday, April 30, 2016

My Video Game Status for May 2016

Well, I haven't touched Minecraft in ages, but I'll soon be playing 2 upcoming FPSes:  Battleborn and Overwatch.  (The short version of why I got both is:  I pre-ordered Overwatch before I heard about Battleborn.)  This does mean that I'm almost certainly looking at a long hiatus on TF2, since I have 2 different ways to get my shooter fix. 
My life is currently quite disorganized, which is why, when I've played video games, it's been a lot of quickies:  Hearthstone here, Heroes of the Storm there, but never zenning out on Minecraft or attempting FTL again.  I'm getting things organized, but it's tough, so it's still going to be at least a couple of months before I get back into those again. 
That's all for now.  I'll probably report back on the new shooters at the end of May.  ;)

Regarding The Three Indistinguishable Dice Puzzle: Reasoning

In my previous post, I gave my solution to the problem presented here, but I thought that it would be good to show the logic behind how I got the solution that I got. 
In the quest for an elegant solution, I was playing around with various functions over a,b,c.  One that I thought would be a good starting point was max(a,b,c)+min(a,b,c), since it would give a number 2 through 12 and wouldn't be biased upwards or downwards, since the median of a,b,c was what was being ignored.  I noticed that the distribution of results, if triples were ignored, was, indeed, symmetrical around 7, with 6, 7, and 8 occurring too often by multiples of 6, and with 2, 3, 4, 10, 11, 12 occurring too rarely by multiples of 6.  Of course, on this map, the excess from 6, 7, and 8 was 6 short of the deficit from the rest, but that's made up when we add the triples back in. 
I then looked at the patterns of groups that would result in 6, 7, or 8 and tried to find elegant ways to migrate them to the results that were coming up short.  This was pretty much trial and error, so one thing that I did was aim to end up with a rule saying that three of a kind makes 3, since that would be easy to remember. 
Any set of non-triples a,b,c is either a pair and another digit, which occurs 3 times out of every 216, or three different digits, which occurs 6 times out of every 216, so it was easy to move these things in whole lots of 6, and even to move them in lots of 3.  For instance, the rule that, if max(a,b,c)+min(a,b,c)=7 and a=b or b=c or c=a, then f(a,b,c)=min(a,b,c)+9 actually migrates pair of sets of 3, such as causing f(6,6,1) (or 6,1,6 or 1,6,6) and f(6,1,1) (or 1,6,1 or 1,1,6) to both be 10. 
So, hey, if you want to make a more elegant variation of my solution, mess around with ways to twist a,b,c where 5<max(a,b,c)+min(a,b,c)<9 to give the right number of missing results for 2,3,4,10,11,12 and put the triples somewhere and see if you can make one that uses fewer rules. 
Caveat:  Elegance is a matter of opinion.  I'm pretty sure that what I devised uses the simplest rules (though I could be wrong), so I'd anticipate that the other way to make a more elegant solution would be to have no if conditionals at all, though it probably involves math that's harder to do on the spot.  (I'm almost certain that such a solution would involve modular arithmetic, too, but I haven't actually looked at anyone else's solutions yet.)  So, I'd expect a "more elegant" variant of my solution to get it down to 3 or 2 rules, instead of my current 4. 
OK, have fun with that. 

Thursday, April 28, 2016

Regarding The Three Indistinguishable Dice Puzzle

Recently, YouTube started recommending videos for me from Standup Math S.  Recently, I saw this video which presented an interesting problem.  Basically, it goes like this:  You roll three indistinguishable dice, to the point that you don't even know the order in which they returned results.  However, you want results as if you'd rolled 2d6.  That means not only that the results range from 2 to 12, but also that they be distributed like 2d6, i.e., that the odds of getting 3 be twice the odds of getting 2, that the odds of getting 4 be the same as the odds of getting 2 or 3, etc.  It's clearly possible with a lookup table, but the asker seeks a more elegant solution.

Last Friday at lunch, I came up with a fairly elegant solution, but I've been pretty busy, so I haven't gotten a chance to post it until now.  Here it is:

Let a, b, c represent the results of the dice, each an integer 1-6 inclusive, in any order.

f(a,b,c) =
  • if a=b=c
    • 3
  • if a=b or b=c or c=a and max(a,b,c)+min(a,b,c)=7
    • min(a,b,c) +9
  • a≠b≠c≠a and either a=2i, b=2j, c=2k or a=2i+1, b=2j+1, c=2k+1, where i,j,k∈ℤ
    • 2min(a,b,c)
  • otherwise
    • max(a,b,c) + min(a,b,c)
In layman's terms:
  • If you get triples, then the answer is 3.  
  • If you get doubles where low+high=7, then the answer is low+9 (a.k.a. high+low+low+2).  
  • If you get all 3 even numbers or all 3 odd numbers, then the answer is 2*low.  
  • Otherwise, add the highest and lowest numbers.  
I think that this solution is fairly elegant, even though it's in the form of 4 branches, because it's something easily understood (it doesn't even require exponents or modular arithmetic, let alone anything actually complicated) and 2 of the 3 non-main branches (triples and jumping straights) are fairly rare, all 4 branches are easy to solve, and there's some work overlap:  If you see doubles and add high+low to see if they're 7, if they're not, then you already did the math for your final answer.

And yes, I know that this is terribly informal and I didn't dig up all of the math symbols, but it's been a while since I did serious math, so I'm a bit rusty. 

EDIT 2016/Apr/30:  discovered and removed a touch of redundant text:  I had parenthetically said, in "if a=b or b=c or c=a and max(a,b,c)+min(a,b,c)=7", "(but not a=b=c)", but the max and the min would have different parity, so, duh.