Fix occasional crash on bot timeout during match
This commit is contained in:
parent
cc3f49319b
commit
1d2368295c
1 changed files with 4 additions and 1 deletions
|
@ -23,6 +23,7 @@ namespace ChessChallenge.Application
|
||||||
}
|
}
|
||||||
|
|
||||||
// Game state
|
// Game state
|
||||||
|
Random rng;
|
||||||
int gameID;
|
int gameID;
|
||||||
bool isPlaying;
|
bool isPlaying;
|
||||||
Board board;
|
Board board;
|
||||||
|
@ -60,6 +61,7 @@ namespace ChessChallenge.Application
|
||||||
tokenCount = GetTokenCount();
|
tokenCount = GetTokenCount();
|
||||||
Warmer.Warm();
|
Warmer.Warm();
|
||||||
|
|
||||||
|
rng = new Random();
|
||||||
moveGenerator = new();
|
moveGenerator = new();
|
||||||
boardUI = new BoardUI();
|
boardUI = new BoardUI();
|
||||||
board = new Board();
|
board = new Board();
|
||||||
|
@ -77,7 +79,7 @@ namespace ChessChallenge.Application
|
||||||
{
|
{
|
||||||
// End any ongoing game
|
// End any ongoing game
|
||||||
EndGame(GameResult.DrawByArbiter, log: false, autoStartNextBotMatch: false);
|
EndGame(GameResult.DrawByArbiter, log: false, autoStartNextBotMatch: false);
|
||||||
gameID++;
|
gameID = rng.Next();
|
||||||
|
|
||||||
// Stop prev task and create a new one
|
// Stop prev task and create a new one
|
||||||
if (RunBotsOnSeparateThread)
|
if (RunBotsOnSeparateThread)
|
||||||
|
@ -275,6 +277,7 @@ namespace ChessChallenge.Application
|
||||||
{
|
{
|
||||||
isPlaying = false;
|
isPlaying = false;
|
||||||
isWaitingToPlayMove = false;
|
isWaitingToPlayMove = false;
|
||||||
|
gameID = -1;
|
||||||
|
|
||||||
if (log)
|
if (log)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue