pythonprobabilitygame-theory

Probability of accepting an offer


So I'm creating an Ultimatum game scenario where, essentially, Person A has a sum of cash and offers a percentage to player B who accepts or rejects the offer, if they accept they each receive their agreed shares, if player B rejects then they both get nothing.

What I've done is create some ranges that represent fair, unfair, very fair and very unfair offers but I want to create probabilities that Player B accepts. For example, the code will ask player A to put in their offer, if they offer 12%, this is considered an unfair offer and there is a 30% chance Player B will accept this offer. I'll put the code I've done so far and hopefully you understand what I'm trying to do.

Any help would be greatly appreciated.

very_fair_offer=range(40,51)
fair_offer=range(30,41)
unfair_offer=range(15,31)
very_unfair_offer=range(0,16)



offer= int(input("What percentage will you offer? "))

if offer in very_fair_offer:
    print("Accepted")

elif offer in fair_offer:
    #Low probability to reject#

elif offer in unfair_offer:
    #Decent probability to reject#

elif offer in very_unfair_offer:
    #High probability to reject#

else:
    print("This offer is not valid")

Solution

  • Consider that 30% chance of accepting an offer.

    Let's populate a list with 3 True values and 7 False values:

    odds = [True, True, True, False, False, False, False, False, False, False, False]
    

    And then we'll pick one of them at random and use that to determine if we're accepting.

    from random import choice
    
    if choice(odds):
        print("Accepted")
    else:
        print("Not accepted")
    

    This should "accept" approximately 30% of the time.