% 1-card poker: each player draws a card from 1 to ncards without % replacement. Player 1 bets 0 or 1. Player 2 bets 0 or 1 (meaning % call/raise or fold/call depending on P1's bet). On 0 followed by % raise, player 1 may fold or call (betting 0 or 1). % How many cards in the deck? ncards = 13; % Constraints on sequences. A's states are [A-K] and [A-K]01 (latter % is any hand after check&raise). A's actions are [A-K][0-1] (sorted % with least-significant character on left) followed by [A-K]01[0-1] % (LSC on left). B's states are [A-K][0-1] (LSC on left) and actions % are [A-K][0-1][0-1] (LSC on left). A = [ eye(ncards) eye(ncards) zeros(ncards, 2*ncards); -eye(ncards) zeros(ncards) eye(ncards) eye(ncards)]; a = [ ones(ncards,1); zeros(ncards,1) ]; B = [ eye(2*ncards) eye(2*ncards) ] ; b = ones(2*ncards,1); % Construct reward matrix, with one element for each pair of an A % sequence and a B sequence. Most sequence pairs are inconsistent % with each other and so get zero reward; there are 5 nonzero blocks % corresponding to a showdown with a pot of 2, A folding, B folding, % and 2 ways of getting to a showdown with a pot of 4 depending on % whether A bet or passed in the first round. zz = zeros(ncards); fold = ones(ncards) - eye(ncards); card = ones(ncards,1) * (1:ncards); showdown = (card > card') - (card' > card); RA = [showdown zz zz zz; zz fold zz zz; zz zz -fold 2*showdown; zz 2*showdown zz zz]; % effect of chance: there are n * (n-1) deals, each with equal % probability. RA = RA / ((ncards-1) * ncards); % B's payoff is negative of A's RB = -RA';