Automated testing with local engine?

Hi everyone,

Currently I am using the local engine manually with the windows powerShell. It works fine to test one or two matchs.

Is there a way to lauch the engine directly from a python file, recover the results of the match and display them after? It could be usefull to test all my algos against each other.

Thanks a lot for any lead you would have!

3 Likes

There could be a few approaches you could take.

One one be to save results in your algo itself. For example by modifying this part in algocore.py:

elif stateType == 2:
β€œβ€"
This is the end game message. This means the game is over so break and finish the program.
β€œβ€"
debug_write(β€œGot end state quitting bot.”)
break

See this post for more details on how to play with the game_state outside of the start of the turn in this thread: Terminal Game Q&A
After getting the end state you could save who won to some persistent local file and then parse that for analysis. You could do more complex analysis this way too.

You could also make a wrapper program or script that runs a bunch of games and parses the standard out from the game. Like some python program that just calls the run_match script over and and over and scans the output for who won by searching for β€œPLAYER 1 WINS!” for example.

2 Likes

Thank you very much! This helps :slight_smile:

1 Like