private void Reset() { agent.EndEpisode(); Destroy(agent.gameObject); agent = Instantiate(agentPrefab); agent.Init(board, 0); board.ResetPieces(); }
public void GameOver(Game game) { switch (game.winner) { case Winner.White: if (whiteAI) { whiteAgent?.AddReward(1); } if (blackAI) { blackAgent?.AddReward(-1); } break; case Winner.Black: if (whiteAI) { whiteAgent?.AddReward(-1); } if (blackAI) { blackAgent?.AddReward(1); } break; case Winner.Draw: if (whiteAI) { whiteAgent?.AddReward(0); } if (blackAI) { blackAgent?.AddReward(0); } break; case Winner.None: if (whiteAI) { whiteAgent?.AddReward(0); } if (blackAI) { blackAgent?.AddReward(0); } break; } if (whiteAI && whiteAgent != null) { whiteAgent.EndEpisode(); Destroy(whiteAgent.gameObject); } if (blackAI && blackAgent != null) { blackAgent.EndEpisode(); Destroy(blackAgent.gameObject); } gameOver = true; // Reset(); }