Esempio n. 1
0
        private void ManagerUpdated(VersusInfo versusInfo)
        {
            Log(Time.time + " Manager updated");
            playingAsWhite = versusInfo.whiteID == playerInfo.id;
            if (versusInfo.gameInProgress)
            {
                // Start new game
                if (gameNumber != versusInfo.gameNumber)
                {
                    myNextMovePlyCount = playingAsWhite ? 0 : 1;
                    gameNumber         = versusInfo.gameNumber;
                    board.LoadStartPosition();
                    var colString = playingAsWhite ? "White" : "Black";
                    Log($"Game {gameNumber} started. Playing as {colString}");
                }

                // If it's my turn to move, and haven't already begun thinking, then start now!
                if (versusInfo.numPly == myNextMovePlyCount && !thinking)
                {
                    var opponentLastMove = new Move(versusInfo.lastMove);
                    if (!opponentLastMove.IsInvalid)
                    {
                        board.MakeMove(opponentLastMove);
                    }
                    StartThinking();
                }
            }
        }
Esempio n. 2
0
 public static void WriteManagerFile(VersusInfo info)
 {
     Write(JsonUtility.ToJson(info), ManagerFilePath);
 }