Advertisement
Guest User

Legends WR Calculator

a guest
May 12th, 2018
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Octave 1.30 KB | None | 0 0
  1. %Sweep over win rates
  2.  
  3. %Win rate
  4. wr = 0.2:0.01:1;
  5. E = zeros(size(wr));
  6.  
  7. %Number of stars to advance, assume 2 serpent stars
  8. nAdv = 6;
  9.  
  10. for wri = 1:length(wr)
  11. %Create the absorbing markov chain. This step isn't strictly necessary, but is
  12. %good for being able to check that things came out correctly
  13.  
  14. M = zeros(nAdv+3); %Matrix is mostly zeros. Need three extra states for two serpent and one rank up state
  15. M(1,1) = 1; %Once rank up is reached that state is final
  16.  
  17. %Fill in the common elements
  18. for i = 2:nAdv+2
  19.   M(i,i-1) = wr(wri);
  20.   M(i,i+1) = 1-wr(wri);  
  21. end
  22.  
  23. %Fill in the last row
  24. M(nAdv+3,nAdv+2:nAdv+3) = [wr(wri),1-wr(wri)];
  25.  
  26. %Display what M is
  27. %disp(M)
  28.  
  29. %Take the non-absorbing submatrix
  30. Q = M(2:nAdv+3,2:nAdv+3);
  31.  
  32. %Figure out the N matrix
  33. N = inv(eye(nAdv+2)-Q);
  34.  
  35. %Take the expected number of games
  36. E(wri) = sum(N(nAdv,:));
  37.  
  38. end
  39.  
  40. figure('Position',[100,100,1000,750])
  41. semilogy(wr*100,E,'LineWidth',2)
  42. xlabel('Deck Win Percentage')
  43. ylabel('Expected Number of Games to Rank Up')
  44. grid on
  45. title('Ranking Up at Rank 4-2')
  46. set(gca,'xtick',[20:10:100])
  47.  
  48. figure('Position',[100,100,1000,750])
  49. plot(wr*100,E,'LineWidth',2)
  50. xlabel('Deck Win Percentage')
  51. ylabel('Expected Number of Games to Rank Up')
  52. grid on
  53. title('Ranking Up at Rank 4-2')
  54. set(gca,'xtick',[20:10:100])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement