Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. main
  2. {
  3. Strategy A[], B[];
  4. input nIters, nStrats, maxTweak, gameRules;
  5.  
  6. A := nStrats random strategies;
  7. B := nStrats random strategies;
  8. for(t=1..nIters)
  9. {
  10. make each A play each B;
  11. for each A and each B
  12. its total score := sum of its scores in its individual games;
  13. sort the A's by total score;
  14. sort the B's by total score;
  15. v := the game's bias in favour of the best A;
  16. write v;
  17. evolveStrategies(A, nStrats, maxTweak);
  18. evolveStrategies(B, nStrats, maxTweak);
  19. }
  20. }
  21.  
  22. evolveStrategies(X, nStrats, maxTweak)
  23. {
  24. keep the best few Xs where they are;
  25. for(each of the others X[i])
  26. {
  27. j := index of one of the best Xs;
  28. X[i] := X[j];
  29. tweak the value of each parameter of X[i] by no more than maxTweak;
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement