/// <summary> /// Using the data currently stored, attempt to work out whether the /// move was a "surprise" and such for the AI /// </summary> /// <param name="move">The move in question</param> /// <param name="who">The player who made it</param> /// <returns>The agent's reaction</returns> private void react(Move move, Player who) { float averageSims = (who == Player.First ? firstAverageSims : secondAverageSims); var moves = (who == Player.First ? firstMoves : secondMoves); if (moves == null) return; FMove m; try { m = moves[move]; } catch (Exception e) { Debug.LogWarning("Sync issue"); Debug.Log(move); var ms = new Move[moves.Count]; moves.Keys.CopyTo(ms, 0); Debug.Log(Tools.Stringify<Move>.Array(ms)); return; } Debug.Log(m.Who); if (m.Who != who) return; if ((m.Simulations < averageSims * 0.8f && who != player) || (who == player && !move.Equals(myBestMove))) { Debug.Log("SURPRISED"); surprised.Enable(); } }