Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- main
- {
- Strategy A[], B[];
- input nIters, nStrats, maxTweak, gameRules;
- A := nStrats random strategies;
- B := nStrats random strategies;
- for(t=1..nIters)
- {
- make each A play each B;
- for each A and each B
- its total score := sum of its scores in its individual games;
- sort the A's by total score;
- sort the B's by total score;
- v := the game's bias in favour of the best A;
- write v;
- evolveStrategies(A, nStrats, maxTweak);
- evolveStrategies(B, nStrats, maxTweak);
- }
- }
- evolveStrategies(X, nStrats, maxTweak)
- {
- keep the best few Xs where they are;
- for(each of the others X[i])
- {
- j := index of one of the best Xs;
- X[i] := X[j];
- tweak the value of each parameter of X[i] by no more than maxTweak;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement