Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %Sweep over win rates
- %Win rate
- wr = 0.2:0.01:1;
- E = zeros(size(wr));
- %Number of stars to advance, assume 2 serpent stars
- nAdv = 6;
- for wri = 1:length(wr)
- %Create the absorbing markov chain. This step isn't strictly necessary, but is
- %good for being able to check that things came out correctly
- M = zeros(nAdv+3); %Matrix is mostly zeros. Need three extra states for two serpent and one rank up state
- M(1,1) = 1; %Once rank up is reached that state is final
- %Fill in the common elements
- for i = 2:nAdv+2
- M(i,i-1) = wr(wri);
- M(i,i+1) = 1-wr(wri);
- end
- %Fill in the last row
- M(nAdv+3,nAdv+2:nAdv+3) = [wr(wri),1-wr(wri)];
- %Display what M is
- %disp(M)
- %Take the non-absorbing submatrix
- Q = M(2:nAdv+3,2:nAdv+3);
- %Figure out the N matrix
- N = inv(eye(nAdv+2)-Q);
- %Take the expected number of games
- E(wri) = sum(N(nAdv,:));
- end
- figure('Position',[100,100,1000,750])
- semilogy(wr*100,E,'LineWidth',2)
- xlabel('Deck Win Percentage')
- ylabel('Expected Number of Games to Rank Up')
- grid on
- title('Ranking Up at Rank 4-2')
- set(gca,'xtick',[20:10:100])
- figure('Position',[100,100,1000,750])
- plot(wr*100,E,'LineWidth',2)
- xlabel('Deck Win Percentage')
- ylabel('Expected Number of Games to Rank Up')
- grid on
- title('Ranking Up at Rank 4-2')
- set(gca,'xtick',[20:10:100])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement