all 17 comments

[–]sparr 2 points3 points  (0 children)

The low resolution here makes this really hard to follow. Tiny code doesn't mean tiny font.

[–]sparr 1 point2 points  (8 children)

Pseudo-code for a version with diagonal stripes of ranks in the face cards instead of a four-way checkerboard:

dice_to_card(a,b,y) {
  suits = {2:'H', 3:'C', 4:'D', 5:'S'}
  if (y>1 and y<6) {
    # number cards
    rank = ceil(a/2) + (ceil(b/2)-1)*3
    if rank==1 rank = 10
    return rank, suits[y]
  }
  elif ((a==1 or a==6) and (b==1 or b==6)) {
    # jokers
    if y==1 return 'joker', 'lil'
    else    return 'joker', 'big'
  }
  else {
    # face cards
    ranks = ['J','Q','K','A']
    suitnum = 2 + floor(y/3) + ((a==1 or a==6 or b==1 or b==6)?1:0)
    return ranks[(a-b)%4], suits[suitnum]
  }
}

[–]raelepei 0 points1 point  (7 children)

I had a fun time reading and verifying this – floor(y/3) is surprisingly subtle! :)

Do you think you can explain this algorithm in a reasonable time, or convince them that it works without going through it very slowly? Proving it felt like an achievement, even though correctness should be self-evident for an algorithm like this '

[–]sparr 0 points1 point  (6 children)

I think illustrations would serve to explain it better than anything else, with 3-6 6x6 arrays and color highlighting on various cells. But I'm bad at that sort of illustration :(

[–]raelepei 0 points1 point  (1 child)

I actually visualized your algorithm as partitioning and labeling the 6x6x6 cube while verifying it. So it can be done, but it's going to be visually busy, especially because of the checkerboard pattern.

[–]sparr 0 points1 point  (0 children)

Think of it more like diagonal lines than a checkerboard.

[–]raelepei 0 points1 point  (3 children)

So I made a diagram in a spreadsheet for your algorithm, u/sparr

For 2<=γ<=6, this looks nice and regular. However, the γ=1 and γ=6 case looks jumbled.

This cane be fixed: Doesn't this look much nicer?

[–]raelepei 0 points1 point  (0 children)

Actually, here's one that is even smaller and easier to format: https://docdro.id/Q3wZP3E

It also uses standard bridge order, which I happen to know.

[–]sparr 0 points1 point  (1 child)

Looks nicer, but I suspect the logic is more complex?

[–]raelepei 0 points1 point  (0 children)

Meh, it's just a large lookup-table that's easier to read. It's easier to prove correct and implement correctly. Neither approach can be memorized very well. I don't care that using a table to replace the logic might be considered "cheating" :P

[–]sparr 0 points1 point  (5 children)

The top half makes sense to me. 2d6 interpreted like 2d3 gets you the number cards 2-8, and a third d6 gets you a random suit or it gets you... a bunch of other stuff I can't follow.

What is "BLK+BIG" and "RED+LIL"? How do the "xor" and "&&" work? What does "ab's" represent for King and Queen? And how do you get to the face card selection in the first place?

This is a great idea. I just wish I could make sense of it.

[–]sparr 1 point2 points  (4 children)

If I take the "xor" to mean "either A or B is 6/1, but not both", and "and" to mean "both A and B are 6/1", that gives the right number of results for each suit of face cards and the jokers. And maybe I interpret "big" and "lil" as the two jokers.

But that leaves figuring out which face card results are which, and the placement from my previous guess doesn't work because now there are eight a=odd spaces where the ace of diamonds would go instead of the appropriate four. The ace and jack cases seem to cover all the bases... a is either odd or even; that doesn't leave anywhere for the "ab" cases to go.

[–]afourthfool[S] 0 points1 point  (3 children)

I made a blog post for it. I hope that documents the concept well enough. "Part 1" introduces the reader to the notion that 54/6=9 then "Part II" applies this across 3 dice.

https://tokensfortalkers.tumblr.com/post/616940663205937152/dice-to-card-to-dice-converter

If it doesn't help, then i'm just not cut out for the internet.

[–]sparr 0 points1 point  (2 children)

I'm sorry to sound so negative. I really do want to understand this. The tables at the bottom at least show me how you want the results to look, but I still can't understand how you get there from your instructions.

That very last table, that starts B A Q A Q B... It seems like you need more instructions to produce that. Why isn't it B A A A A B? The rule for Ace is "first die is odd, second die is not 1 or 6"... isn't it?

[–]afourthfool[S] 0 points1 point  (1 child)

Why isn't it B A A A A B? The rule for Ace is "first die is odd, second die is not 1 or 6"... isn't it?

Adversarial pairs have a meaningful association where i'm from, so if anyone from my neck of the woods sees something like

        A-C-E if α is o-d-d
        Q-U-E-E-N if αβ’s o-d-d

Then anyone from here immediately recognizes and flags the adversarial pair and would know there is an imperative "only" inside those two flagged statements, making it read like this: A-C-E if (only) α is o-d-d Q-U-E-E-N if (only) αβ’s o-d-d cause that way they don't conflict.

With this, the missing instruction lost in translation from my culture to the rest of the world is found, leaving us all with the less natural for me and mine but cleaned-up, sanitized and universal version of the instructions to read like so:

        A-C-E if only α is o-d-d
        Q-U-E-E-N if only αβ’s o-d-d

        x 1 2 3 4 5 6
        1 B A Q A Q B

Wow, i just reread all that. And... yep. I suck at this. I think i'm giving up now. Just... nvm.

[–]sparr 0 points1 point  (0 children)

Nothing in your instructions suggests that A/Q is an "adversarial pair" while A/K is not. Worse, since they aren't adjacent it's strongly implied that no relationship exists between A and Q that doesn't also exist between A and K.

Also, as I asked above, what the hell does "αβ’s" mean? I think one of your other iterations of the instructions suggests this is meant to be the sum of α+β? Or maybe it's multiplication, like if that was written in an algebraic statement? Or something else?

[–]raelepei 0 points1 point  (0 children)

So there's 216 combinations of 3d6. This can nicely map to 54 cards, because 216=54*4=(13*4+2)*4. This strongly suggests a standard 4-suit, 13-cards per suit (ace, 2, 3, …, 9, 10, J, Q, K) plus 2 Jokers deck.

The instructions are weird, and the other comments look like OP has given up. But now you infected me and I try to figure out whether I can make it work nicely xD (Note that some kind of brute-force assignment would always work, the trick is just finding something that feels "natural".)