Guest User

Untitled

a guest
Oct 31st, 2013
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. close all, clear all
  2. %Form two vectors of the stats in (HP, speed, Atk, SpAtk, Def, SpDef)
  3. P1=[1 1 1 1 1 0];
  4. P2=[1 1 1 1 1 0];
  5. %Items (have it equal to the stat you want to keep, 7 for Everstone, 8 for
  6. %knot)
  7. item1 = 7;
  8. item2 = 8;
  9.  
  10.  
  11. % P1 = zeros(1,6);
  12. % P2 = zeros(1,6);
  13. % P1(P1t)=1;
  14. % P2(P2t)=1;
  15. P1=P1*31;
  16. P2=P2*31;
  17.  
  18. size=100000;
  19. PIVs = [P1;P2];
  20. IVs = zeros(size,6);
  21. items = [item1 item2];
  22. if sum(items == 8)>0
  23. parenttraits = 5;
  24. else
  25. parenttraits = 3;
  26. end
  27.  
  28. for i = 1:size
  29. traitskept = randperm(6);
  30. loopl=6;
  31. parenttraitsl = parenttraits;
  32. if sum(items<=6)>0
  33. IVs(i,items(items<=6))= PIVs(items<=6,items(items<=6));
  34. parenttraitsl = parenttraits-1;
  35. traitskept(traitskept==items(items<=6))=[];
  36. loopl=5;
  37. end
  38. for j = 1:parenttraitsl
  39. IVs(i,traitskept(j))=PIVs(randi(2),traitskept(j));
  40. end
  41. for j=(parenttraitsl+1):loopl
  42. IVs(i,traitskept(j))=randi(32)-1;
  43. end
  44. end
  45. PerfectIVs = (IVs==31);
  46. PerfectIVs = sum(PerfectIVs,2);
  47. for i=1:6
  48. perfectIVprob(i) = sum(PerfectIVs>=i)/size;
  49. end
  50. round(perfectIVprob*100)/100
Advertisement
Add Comment
Please, Sign In to add comment