• Melllvar@startrek.website
    link
    fedilink
    English
    arrow-up
    2
    arrow-down
    1
    ·
    edit-2
    1 month ago

    All participants select their own random whole number and publish it to the group. All participants add all the numbers together. The result is either odd or even (heads/tails) and everyone arrives at the same result independently.

        • AndrasKrigare@beehaw.org
          link
          fedilink
          arrow-up
          2
          ·
          1 month ago

          The last person would still decide the outcome. They could keep choosing values for whatever function until it produces their desired result and then post that.

          What you would want instead is for everyone to post a (salted) hash, and after the hashes are posted, reveal what the original numbers were and then publicly add them. Everyone could verify everyone else’s numbers against those hashes.

  • HappyRedditRefugee@lemm.ee
    link
    fedilink
    arrow-up
    1
    ·
    2 months ago
    1. Decide on a random N and what tails (even) and heads (uneven) mean.

    2. Each party generates a random number

    3. Combine the numbers with a conmutative operation of some sort, the harder the operation the better.

    4. Take the hash N times. (Can be done independently by each participant)

    (4.5) optional: for extra robustness, do some hard-to-calculate transformations to the result of 4. (Can be done independently by each party)

    1. The final result is either uneven or even === coin toss. (0 will be treathed as even*.*)

    This is not infalibe, one party could get all the numbers a precalculate a answer to get a specific result but they will need to randomly try numbers. adding some timing constrains, using big numbers and hard operations would make that sort of attack not really practicable.

    Nice question, had fun thinking about it!

  • tetris11@lemmy.ml
    link
    fedilink
    arrow-up
    0
    ·
    edit-2
    1 month ago
    1. Everyone tosses three coins, and posts it in the chat
      • If a player tosses three of the same, they have to toss again.
    2. Everyone chooses the mode coin from their neighbour, and adds it to their stack
    3. Each player, with 3+N coins, picks the mode coin in their own collection.
      • Ideally: the player’s own bias, is outweighed by the other player’s biases.
    4. The final coin is the mode of all players coins.
    spoiler
    from numpy import median
    from pprint import pprint
    
    players = {"p1" : [1,0,1],  ## playing fair
               "p2" : [0,0,1],  ## cheating
               "p3" : [1,1,0],  ## cheating
               "p4" : [1,1,0],  ## cheating
               "p5" : [0,0,1]}   ## playing fair
    print("Initial rolls:")
    pprint(players)
    
    get_mode_coin = lambda x: int(median(x))
    get_all_mode_coins = lambda x: [get_mode_coin(y) for y in x]
    
    for play in players: ## Players add the mode coin from their neigbours
        players[play] = players[play] + get_all_mode_coins(players.values())
    print("First picks:")
    pprint(players)
    
    for play in players: ## Players collapse their collections to mode
        players[play] = [get_mode_coin(players[play])]
    print("Last modes:", players)
    
    print("Final choice:", get_mode_coin([x for x in players.values()]))
    

    Which as you can see, is no better than simply picking the median coin from the initial rolls. I thank you for wasting your time.

    • Dkarma@lemmy.world
      link
      fedilink
      arrow-up
      1
      ·
      1 month ago

      First person gets a box showing heads tails. Once that is picked player 2 is shown a flip coin button. This isn’t fucking hard except the sync between apps which you do via db on the back end.

  • Revan343@lemmy.ca
    link
    fedilink
    arrow-up
    0
    ·
    edit-2
    1 month ago

    Coin flipping

    Suppose Alice and Bob want to resolve some dispute via coin flipping. If they are physically in the same place, a typical procedure might be:

    Alice “calls” the coin flip,
    Bob flips the coin,
    If Alice’s call is correct, she wins, otherwise Bob wins.

    If Alice and Bob are not in the same place a problem arises. Once Alice has “called” the coin flip, Bob can stipulate the flip “results” to be whatever is most desirable for him. Similarly, if Alice doesn’t announce her “call” to Bob, after Bob flips the coin and announces the result, Alice can report that she called whatever result is most desirable for her. Alice and Bob can use commitments in a procedure that will allow both to trust the outcome:

    Alice “calls” the coin flip but only tells Bob a commitment to her call,
    Bob flips the coin and reports the result,
    Alice reveals what she committed to,
    Bob verifies that Alice’s call matches her commitment,
    If Alice’s revelation matches the coin result Bob reported, Alice wins.
    For Bob to be able to skew the results to his favor, he must be able to understand the call hidden in Alice’s commitment. If the commitment scheme is a good one, Bob cannot skew the results. Similarly, Alice cannot affect the result if she cannot change the value she commits to.