Saturday, October 23, 2021

Swiss Micros DM41X and HP Prime: The Exit Game

Swiss Micros DM41X and HP Prime: The Exit Game





Introduction


We have two entities in an area:  A and B.   Unfortunately, that area isn't big enough for A and B to stay.  If both A and B stay, they suffer a loss (think economical loss, but it can apply to morality loss, emotional loss, etc.).   Neither A nor B want to leave and each of them want their opponent to leave instead.  


If A and B both leave, neither have any benefits from staying in the area.


The program EXTGAME/EXITGAME calculates four probabilities:


P(A):  probability A stays if A is indifferent of whether B stays or leaves


K_a =  G_a ÷ (G_a - L_a)


P(B):  probability B stays if B is indifferent of whether A stays or leaves


K_b =  G_b ÷ (G_b - L_b)


P(both):  probability that both A and B stay, given they are indifferent about what their opponent does


P(both) = K_a × K_b


P(neither):  probability that both leave, given they are indifferent about what their opponent does 


P(neither) = (1 - K_a) × (1 - K_b)



DM41X Program:  EXTGAME


01 LBL^T EXTGAME

02 ^T A LOSS?

03 PROMPT

04 STO 01

05 ^T A GAIN?

06 PROMPT

07 STO 02

08 ENTER

09 ENTER

10 RCL 01

11 -

12 /

13 STO 05

14 ^T P<A>=

15 ARCL 05

16 AVIEW

17 STOP

18 ^T B LOSS?

19 PROMPT

20 STO 03

21 ^T B GAIN?

22 PROMPT

23 STO 04

24 RCL 04

25 ENTER

26 ENTER

27 RCL 03

28 -

29 / 

30 STO 06

31 ^T P<B>=

32 ARCL 06

33 AVIEW

34 STOP

35 RCL 05

36 RCL 06

37 *

38 ^T P<BOTH>=

39 ARCL X

40 AVIEW

41 STOP

42 1

43 RCL 05

44 -

45 1

46 RCL 06 

47 -

48 *

49 ^T P<NONE>=

50 ARCL X

51 AVIEW 

52 END



HP Prime Program: EXITGAME


EXPORT EXITGAME()

BEGIN

// 2021-07-30 EWS

MSGBOX("Game of Chicken/Exit: Either A

 or B must leave or they both lose.");


LOCAL la,lb,ga,gb,ka,kb,m;


INPUT({la,ga},"A is indifferent",

{"Loss/B stays: ",

"Gain/B leaves: "});


INPUT({lb,gb},"B is indifferent",

{"Loss/A stays: ",

"Gain/A leaves: "}); 


ka:=ga/(ga-la);

kb:=gb/(gb-lb);


m:=[[la,lb,0,gb],[ga,0,0,0]]; 

  

PRINT();

PRINT("*** Matrix ***");

PRINT2D(m); 

PRINT("*** Results ***");

PRINT("---------------");

PRINT("Prob. A Stays: "+STRING(ka));

PRINT("Prob. B Stays: "+STRING(kb));

PRINT("Prob. Both Stays: "+

STRING(ka*kb));

PRINT("Prob. Both Leave: "+

STRING((1-ka)*(1-kb)));

  

END;



Example


Example:  For players A and B:


A is indifferent:

A's Loss if B Stays:  -45  (DM41X prompt:  A LOSS?)

A's Gain if B Leaves:  +50 (A GAIN?)


B is indifferent:

B's Loss if A Stays: -35 (B LOSS?)

B's Gain if A Leaves: +60 (B GAIN?)


Results:

Probability A Stays:  0.526315789474  (P<A>)

Probability B Stays:  0.631578947368 (P<B>)

Probability both A and B stay:  0.332409972299 (P<BOTH>)

Probability both A and B leave: 0.174515235457 (P<NONE>)






Source:

Ivan Pastine, Tuvana Pastine, Tom Humberstone.  Introducing Game Theory: A Graphic Guide Icon Books Ltd:  London, United Kingdom.  2017  ISBN 9781785780820


Eddie


All original content copyright, © 2011-2021.  Edward Shore.   Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited.  This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author. 


Sharp EL-9300 Programs

Sharp EL-9300 Programs Today’s blog entry takes us to the 1992 Sharp’s EL-9300 graphing calculator. On January 10, 2022, I gave a revi...