% monop % Ritar upp spelplanen för Monopol. % Övergångsmatrisen läggs i P, startfördelningen i A. % Om man gör en simulering läggs den i z. % Finn Lindgren 1998-11-11 g=1/16; S=ones(1,6)/6; S=conv(S,S); if 0 % Use old probability matrix J=zeros(41,41); for l=1:28 J(l,2+l:12+l)=S; end; for l=29:38 J(l,1:l-28)=S(40-l:11); J(l,l+2:40)=S(1:11-(l-28)); end; J(39,1:11)=S; J(40,2:12)=S; J(41,:)=J(11,:)*8/18; J(:,41)=J(:,31); J(41,41)=10/18; J(:,31)=zeros(41,1); all=[3 18 34];ch=[8 23 37]; J(1:40,all)=14*J(1:40,all)/16; J(1:40,ch)=10*J(1:40,ch)/16; ral=[1 2];y=[ g*S' g*S']; J(1,ral)=J(1,ral)+y(11,:); J(6:16,ral)=J(6:16,ral)+y; J(22:32,ral)=J(22:32,ral)+y; J(31:40,ral)=J(31:40,ral)+y(1:10,:); rch=[1 12 16 25 40 41];x=[g*S' g*S' g*S' g*S' g*S' g*S']; J(11:21,rch)=J(11:21,rch)+x; J(25:35,rch)=J(25:35,rch)+x; J(36:40,rch)=J(36:40,rch)+x(1:5,:); J(1:6,rch)=J(1:6,rch)+x(6:11,:); else % Use new probability matrix S=[0,S]; dice=toeplitz(zeros(40,1),[0 S zeros(1,40-1-12+40)]); dice=dice(:,1:40)+dice(:,41:80); % double_dice=[0 1 0 1 0 1 0 1 0 1 0 1]/36; % escape=sum(double_dice); % dice=[dice,zeros(40,1);zeros(1,11),double_dice,zeros(1,17),1-escape]; % double_dice=[0 1 0 1 0 1 0 1 0 1 0 1]/36; escape=1/6; dice=[dice,zeros(40,1);zeros(1,11),S*escape,zeros(1,17),1-escape]; jump=eye(41); jump(31,[31,41])=[0,1]; % Allm. allm=zeros(1,41); allm(1)= 1; % Gå allm(2)= 1; % Västerlånggatan allm(12)=0; % S:t Eriksgatan allm(16)=0; % Östra Station allm(25)=0; % Hamngatan allm(40)=0; % Norrmalmstorg allm(41)=1; % Gå i fängelse allm=allm/16; % Totala antalet kort % Chans chans=zeros(1,41); chans(1)= 1; % Gå chans(2)= 0; % Västerlånggatan chans(12)=1; % S:t Eriksgatan chans(16)=1; % Östra Station chans(25)=1; % Hamngatan chans(40)=1; % Norrmalmstorg chans(41)=1; % Gå i fängelse chans=chans/16; % Totala antalet kort jump(3,:)=allm; jump(3,3)=1-sum(allm); jump(18,:)=allm; jump(18,18)=1-sum(allm); jump(34,:)=allm; jump(34,34)=1-sum(allm); jump(8,:)=chans; jump(8,8)=1-sum(chans); jump(23,:)=chans; jump(23,23)=1-sum(chans); jump(37,:)=chans; jump(37,37)=1-sum(chans); if 1 % Tre fängelsetillstånd. dice(42,:)=dice(41,:); dice(43,:)=dice(41,:); dice(:,42)=0; dice(:,43)=0; dice(41,42)=dice(41,41); dice(42,43)=dice(41,41); % dice(43,11)=dice(41,41); dice(43,:)=dice(11,:); dice(41,41)=0; dice(42,41)=0; % dice(43,41)=0; jump(42,42)=1; jump(43,43)=1; end J=dice*jump; end P=J; A=[1 zeros(1,length(P)-1)]; field; timedelay=1;