Everyone tosses three coins, and posts it in the chat
If a player tosses three of the same, they have to toss again.
Everyone chooses the mode coin from their neighbour, and adds it to their stack
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.
The final coin is the mode of all players coins.
from numpy import median
from pprint import pprint
players = {"p1" : [1,0,1], ## playing fair"p2" : [0,0,1], ## cheating"p2" : [1,1,0], ## cheating"p3" : [1,1,0], ## cheating"p4" : [0,0,1]} ## playing fairprint("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.
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.
from numpy import median
from random import choice
from pprint import pprint
# Functions
get_mode_coin = lambda x: int(median(x))
defpick(player, wants):
for neighbor in players:
if player != neighbor:
neighbor_purse = players[neighbor]["purse"]
if wants:
if wants in neighbor_purse: # Cheat
players[play]["purse"] = players[play]["purse"] + [wants]
continue
players[play]["purse"] = players[play]["purse"] + [choice(neighbor_purse)]
# Main
players = {"p1" : {"purse": [1,0,1], "wants": False}, ## playing fair"p2" : {"purse": [0,0,1], "wants": 0}, ## cheating"p3" : {"purse": [1,1,0], "wants": 1}, ## cheating"p4" : {"purse": [1,1,0], "wants": 0}, ## cheating"p5" : {"purse": [0,0,1], "wants": False}} ## playing fairfor play in players: ## Players pick a desired coin from each of their neighbours
pick(play, players[play]["wants"])
print("First picks:")
pprint(players)
for play in players: ## Players collapse their collections to mode
players[play] = [get_mode_coin(players[play]["purse"])]
print("Last modes:", players)
print("Final choice:", get_mode_coin([x for x in players.values()]))
from numpy import median from pprint import pprint players = {"p1" : [1,0,1], ## playing fair "p2" : [0,0,1], ## cheating "p2" : [1,1,0], ## cheating "p3" : [1,1,0], ## cheating "p4" : [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.
The last player (or server) still can choose a result, because it knows other tosses before making it’s own.
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.
Second attempt that factors in cheating.
spoiler
from numpy import median from random import choice from pprint import pprint # Functions get_mode_coin = lambda x: int(median(x)) def pick(player, wants): for neighbor in players: if player != neighbor: neighbor_purse = players[neighbor]["purse"] if wants: if wants in neighbor_purse: # Cheat players[play]["purse"] = players[play]["purse"] + [wants] continue players[play]["purse"] = players[play]["purse"] + [choice(neighbor_purse)] # Main players = {"p1" : {"purse": [1,0,1], "wants": False}, ## playing fair "p2" : {"purse": [0,0,1], "wants": 0}, ## cheating "p3" : {"purse": [1,1,0], "wants": 1}, ## cheating "p4" : {"purse": [1,1,0], "wants": 0}, ## cheating "p5" : {"purse": [0,0,1], "wants": False}} ## playing fair for play in players: ## Players pick a desired coin from each of their neighbours pick(play, players[play]["wants"]) print("First picks:") pprint(players) for play in players: ## Players collapse their collections to mode players[play] = [get_mode_coin(players[play]["purse"])] print("Last modes:", players) print("Final choice:", get_mode_coin([x for x in players.values()]))
So, my method doesn’t work