game theory for software developers at the boulder jug
TRANSCRIPT
Game Theoryfor Software Developers
by Matthew McCullough, Ambient Ideas, LLC
Matthew McCullough @matthewmccull
The Big Picture
4 Basic Elements
� Players� Strategies� Payoffs� Common knowledge
Games
Business
Economics
Game theory is...
Strategic interactive decision making
Strategy dependent on the choices of others
Economics as science
“Good fortune is what happens when opportunity meets with planning”
--Thomas Alva Edison
The Company
MacroCode
Consultancy
Underbid
Signaling
Stotting
Bid Low for the 1st Month
Build theNew Business
Decision Tree
C:1
Red
1/2 1:1
Raise
2:1
Meet2 -2
Pass1 -1
Fold1 -1
Black
1/2 1:2
Raise
2:1
Meet-2 2
Pass1 -1
Fold-1 1
C:1
Red
1/2 1:1
Raise
2:1
Meet2 -2
Pass1 -1
Fold1 -1
Black
1/2 1:2
Raise
2:1
Meet-2 2
Pass1 -1
Fold-1 1
C:1
Red
1/2 1:1
Raise
2:1
Meet2 -2
Pass1 -1
Fold1 -1
Black
1/2 1:2
Raise
2:1
Meet-2 2
Pass1 -1
Fold-1 1
C:1
Red
1/2 1:1
Raise
2:1
Meet2 -2
Pass1 -1
Fold1 -1
Black
1/2 1:2
Raise
2:1
Meet-2 2
Pass1 -1
Fold-1 1
Bounded Rationality
Beauty Contest
Beauty Contest Rules
� Guess between 1 and 100� Winner has the number at 70% of
the average guess
University Employees
The Red Button
The $2 Button: Rules� Gather 100 friends� Everyone starts with a $100 prize� Everyone gets a button� If you push, it deletes $2 from
everyone else's prize� Everyone gets one button push
appx. 30% push
Worried about retribution
The $2 Button: New Rules� Gather 100 random players� Everyone starts with a $100 prize� Everyone gets a button� If you push, it deletes $2 from
everyone else's prize� Everyone gets one button push� If you push, you cut your losses
in half
appx. 70% push
Framed as defense
Bilateral Anterior Insular Cortex
� What if everyone had a meet and greet in advance?
� What if everyone knew each other?� What if everyone was a family
member?
Red Button Coalitions?
Hiring
Incentives
Motivating others to do what we want them to with rewards
Aligning the other player's desires with ours
credibleincredible
vs
Big sale, 80% off for a limited time only!**
$20 per resume
$1000 if hired
One shot?
Iterative?
Rules
Don't push changes after Thursday
Don't disable your anti-virus software
Must have 100% test coverage
Unintended Consequences
� Some quantity of rules are what make a game playable
� Don't capriciously create new rules at the last moment
Scoring for the other Team� 1994: Barbados vs. Grenada� Must win by 2 goals to advance� B2:G1� Goals count double in overtime� Grenada began defending Barbados'
goal
Team Colors
Penny Altruism
Ultimatum Game
Ultimatum Game Rules
� The purse is provided by a bank� Players are not allowed to
communicate� There is only one decision to be
made� There are 100 strategies
Alice Bob
Bank
Ultimatum
Offer 100
Accept
100,0
Decline
0,0
Offer 99 Offer 98 Offer 30 Offer 10
Accept Decline Accept DeclineAccept DeclineAccept Decline
99,1 0,0 0,010,900,030,700,098,2
Alic
eBo
b
Fair
70/30 split
Observed
Commission
Between ages of 3 & 5
Anonymously
Offer: 1 to 10
No Way Back
Strategically removing options
Prisoner's Dilemma
Alice Defects Alice Stays Silent
Bob Defects -4,-4 0,-5
Bob Stays Silent -5,0 -1,-1
Dev Tests Dev Shirks
QA Tests -1,-1 -1,0
QA Shirks 0,-1 -2,-2
Testing
Centipede Game
100% Test Coverage
Monty Hall
Bayes Formula
Birthday Attack
� With 26 people in the room, what is the chance that someone has January 1st as their birthday?
Birthday Attack
� With 26 people in the room, what is the chance that any two share a birthday?
Retailer Selection
Red/Black Cards
Red/Black Negotiations
� 23 Red Cards with instructor� 23 Cards with students� What kind of deal do you hold out
for?
Alice loses three cards
Red/Black Negotiations
� 20 Red Cards with instructor� 23 Cards with students� What kind of deal do you hold out
for?
Acquisition
No!
Threat?
Commitment
Doomsday Device
Poison Pill
Brinksmanship
Chicken
What is it?
� Playing at high stakes� By not offering any small response,
scaring the other player of the consequences of the big response
Chicken
� Best way to play is to throw out the steering wheel
� But the other player must visibly take notice of that action
Partnerships
Incremental value
Shapley Value
Factory
Factory Sizes
� Small: $60,000� Medium: $90,000� Large: $130,000
Advertising
Warranty
Signaling
Quality
Lifetime
Google Adwords
Price
Thomas Schelling
Schelling points
Schelling Points� Grand Central Station in New York� 99¢ on the App Store� $39.95 for FPS games� DVD releases on Tuesday� Comic books releases on Wednesday� Theater film releases on Friday
How do they occur?
� Publicity � Competition� Frequency� Tradition
Etsy
Schelling Number
Schelling Number
� Write down an two-digit odd number in which both the digits are different
Vendor Trouble
Late
Fire them?
We need 10 of 12
Lemons
George Akerlof
Balancing Act
PeachesLemons PeachesPeaches
Pay
Balancing Act
PeachesLemons PeachesPeaches
Pay
Balancing Act
Peaches
Lemons
PeachesPeaches
Pay
Balancing Act
PeachesLemons Peaches
Pay
Balancing Act
PeachesLemons Peaches
Pay
Lemons
Balancing Act
Pay
Peaches
LemonsPeaches
Lemons
Balancing Act
PeachesLemons Peaches
Pay
Lemons
Grim Trigger
This is going to be our last project...
AliceBetrays
AliceCo-operates
BobBetrays 5,5 0,5
BobCo-operates 5,0 1,1
make it sequential
Co-operate Co-operate Co-operate Co-operate Co-operate Co-operate Co-operate Co-operate
Co-operate Co-operate Co-operate Co-operate Co-operate Co-operate Co-operate Betray
Co-operate Co-operate Co-operate Co-operate Co-operate Co-operate Betray
Co-operate Co-operate Co-operate Co-operate Co-operate Betray
Co-operate Co-operate Co-operate Co-operate Betray
Co-operate Co-operate Co-operate Betray
Co-operate Co-operate Betray
Co-operate Betray
Betray
Simultaneous Shoe Bidding
What would you bid for this pair of shoes?
What would you bid if you only had a 50% chance of
getting the other shoe?
XKCD 601: Game Theory
Game Theoryfor Software Developers
by Matthew McCullough, Ambient Ideas, LLC
References: Software
� Gambit� http://www.gambit-project.org/doc/index.html� http://www.gambit-project.org/doc/samples.html
� Game Theory Explorer� http://gametheoryexplorer.appspot.com/builder/
References: Research
� The Teaching Company: Game Theory Video Course� http://www.thegreatcourses.com/tgc/courses/Course_Detail.aspx?cid=1426� Professor Scott P. Stevens, Ph.D.
The Pennsylvania State UniversityJames Madison University
� Bookmarks� http://www.delicious.com/matthew.mccullough/gametheory
� Range Voting� http://rangevoting.org/TBlecture.html
� Market for Lemons� http://en.wikipedia.org/wiki/Market_for_lemons� http://nobelprize.org/nobel_prizes/economics/laureates/2001/akerlof-article.html� http://www.springerlink.com/content/h3h8530156276515/� http://hydrogen.its.ucdavis.edu/eec/education/EEC-classes/eeclimate/class-
readings/akerlof-the%20market%20for%20lemons.pdf
References: Blogs
� Mind Your Decisions� http://mindyourdecisions.com/blog/
� Game Theory Strategies� http://www.gametheorystrategies.com/
� Twitter, Barry Hughes� https://twitter.com/#!/gamethry
References: Books
� Theory of Games and Economic Behavior� http://en.wikipedia.org/wiki/Theory_of_Games_and_Economic_Behavior� http://press.princeton.edu/titles/7802.html� http://www.amazon.com/Economic-Behavior-Commemorative-Princeton-Editions/
dp/0691130612/ref=sr_1_1?ie=UTF8&qid=1310015156&sr=8-1� Rock, Paper, Scissors: Game Theory in Everyday Life
� http://www.amazon.com/Rock-Paper-Scissors-Theory-Everyday/dp/0465009387/ref=sr_1_2?ie=UTF8&qid=1310490759&sr=8-2
� The Art of Strategy: A Game Theorist's Guide to Success in Business and Life� http://www.amazon.com/Art-Strategy-Theorists-Success-Business/dp/0393337170/
ref=pd_bxgy_b_text_c� Co-Opetition : A Revolution Mindset That Combines Competition and Cooperation :
The Game Theory Strategy That's Changing the Game of Business� http://www.amazon.com/Co-Opetition-Revolution-Combines-Competition-
Cooperation/dp/0385479506/ref=pd_sim_b_1
References: People
� John von Neumann� http://en.wikipedia.org/wiki/John_von_neumann
� Thomas Schelling� http://en.wikipedia.org/wiki/Thomas_Schelling
� John Forbes Nash� http://en.wikipedia.org/wiki/John_Forbes_Nash
� John Harsanyi� http://en.wikipedia.org/wiki/John_Harsanyi
Photo Credits� 100 Dollar Bill Roll
� http://www.flickr.com/photos/85473033@N00/3367543296� Pennies
� http://flic.kr/p/6ucLDE� http://flic.kr/p/6u8BEa
� Earth� http://flic.kr/p/9DTDXi
� Dice� http://flic.kr/p/9g1aZc
� Cards� http://flic.kr/p/4UwZc6� http://flic.kr/p/6FKnGu� http://flic.kr/p/4V67rx
� Happy Hour� http://www.flickr.com/photos/beleaveme/3276175127/
� Prison� http://flic.kr/p/38wBWq
Other Ideas
� Bounded Rationality� 2-3 event horizon
� Typing� Pooling or separating equilibria
� Prisoner's Dilemma with an Arbiter� Tragedy of the Commons
� Air pollution� Mass transit tickets� Overfishing
� Volunteer's Dilemma� Witnessing a crime