Page 1 of 1

Debugging tie breakers

Posted: 31 March 2021, 19:04
by KuWizard
Hi everyone!
I had nightmares when I was implementing a tie breaker and then fixing bugs in it :(
The problem is that you cannot replay a game which is finished and my game finishes straightaway after a tie breaker (obviously). I need to create a new game, amend players scores in DB and then play one round for each player for game to be in the state when at least 2 players have a tie to check if bug is fixed. It usually takes up to 2 minutes for 1 iteration which is annoying after 10th iteration of bugfixing. Is there a way to do this faster? Is there a way to return back to the game after it was finished using saved states?

Re: Debugging tie breakers

Posted: 31 March 2021, 19:20
by Archduke
You can run PHP functions from chat on studio (https://en.doc.boardgamearena.com/Tools ... BGA_Studio), so I'd suggest making a function which gives the players resources/puts the game into a lategame state. Alternatively, you could run the end game scoring directly, and then just check score_aux after doing that.

Re: Debugging tie breakers

Posted: 31 March 2021, 19:27
by KuWizard
Thanks, Archduke, will try to do a PHP function, I forgot about this ability :)

Re: Debugging tie breakers

Posted: 31 March 2021, 19:54
by cpasbanal
You can also try to dump and export a database state _just before_ game ends with the PHPMyAdmin then create a new game and import.

You can then debug the very same end game score to challenge and debug your ties.



Another way to debug end game states, is to

Code: Select all

die('end of game')
and

Code: Select all

var_dump($interesting_var)
before to see how are the scores or interesting variables. It can help challenging _without_ ending the game.

Re: Debugging tie breakers

Posted: 31 March 2021, 20:01
by KuWizard
Thanks, cpasbanal, will try to dump the DB state!