Advertisement
Guest User

dasdas

a guest
Dec 6th, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. cargo build --release
  2.  
  3. set jobs 8
  4.  
  5. set games 0
  6. set wins 0
  7.  
  8. function process
  9. set enemy_score (cat $argv[1] | jq '.results[0]')
  10. set our_score (cat $argv[1] | jq '.results[1]')
  11.  
  12. if test $enemy_score -eq $our_score
  13. echo 'Draw, Win rate' (math "$wins / $games * 100")%
  14. else if test $enemy_score -gt $our_score
  15. set games (math $games + 1)
  16. echo 'Defeat, Win rate' (math "$wins / $games * 100")%
  17. else
  18. set games (math $games + 1)
  19. set wins (math $wins + 1)
  20. echo 'Victory, Win rate' (math "$wins / $games * 100")%
  21. end
  22. end
  23.  
  24. rm -r /tmp/aicup 2>/dev/null
  25. mkdir /tmp/aicup
  26.  
  27. for job in (seq $jobs)
  28. sed 's/31001/'(math 31001+$job)'/g' config.json > /tmp/aicup/config$job.json
  29. end
  30.  
  31. for game in (seq 100)
  32. for job in (seq $jobs)
  33. ./aicup2019 --batch-mode --config /tmp/aicup/config$job.json --save-results /tmp/aicup/results$job.json 2>/dev/null &
  34. end
  35.  
  36. sleep 0.05
  37. for job in (seq $jobs)
  38. target/release/aicup2019 127.0.0.1 (math 31001 + $job) &
  39. end
  40.  
  41. wait
  42. for job in (seq $jobs)
  43. process /tmp/aicup/results$job.json
  44. end
  45. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement