Tianshou/test/multiagent/test_tic_tac_toe.py
n+e fc251ab0b8
bump to v0.4.3 (#432)
* add makefile
* bump version
* add isort and yapf
* update contributing.md
* update PR template
* spelling check
2021-09-03 05:05:04 +08:00

22 lines
442 B
Python

import pprint
from tic_tac_toe import get_args, train_agent, watch
def test_tic_tac_toe(args=get_args()):
if args.watch:
watch(args)
return
result, agent = train_agent(args)
assert result["best_reward"] >= args.win_rate
if __name__ == '__main__':
pprint.pprint(result)
# Let's watch its performance!
watch(args, agent)
if __name__ == '__main__':
test_tic_tac_toe(get_args())