Go Game: Expert AI & RAVE Integration


Enhanced AI Challenge & MCTS Optimizations

This release significantly improves the AI's playing strength by introducing an "Expert" difficulty level and incorporating the RAVE (Rapid Action Value Estimation) heuristic into the Monte Carlo Tree Search (MCTS) algorithm. The Hint functionality now also leverages these expert-level calculations for stronger suggestions.

✨ New Features

  1. "Expert" AI Difficulty Level:
    • Players can now select an "Expert" difficulty for AI opponents (in Player vs AI and AI vs AI modes).
    • This level features:
      • Significantly increased MCTS simulation iterations (e.g., 5,000+).
      • Increased thinking time per move (e.g., 7.5+ seconds).
      • Integration of RAVE (AMAF) for more efficient learning during MCTS playouts.
    • Aims to provide a much more challenging AI for experienced players.
    • UI elements (Settings dialog dropdowns) and the game info panel have been updated to include and display "Expert".
  2. RAVE (Rapid Action Value Estimation) / AMAF (All Moves As First) in MCTS:
    • The core MCTS algorithm has been updated to include RAVE.
    • During MCTS playouts, all moves made by a player now contribute (with a bias) to the evaluation of those moves as potential children in the MCTS tree, allowing faster identification of promising moves.
    • Introduced a raveBiasConstant to balance standard UCB1 and RAVE scores.
    • MCTSNode now stores raveVisits and raveWins.
    • The transposition table now also caches RAVE statistics.
  3. Expert-Powered Hint Button:
    • The "Hint" button now utilizes the "Expert" AI configuration (increased simulations, time, and RAVE) for stronger, albeit slower, suggestions.
    • The button text temporarily changes to "Thinking (Expert)..." during calculation.

🛠️ Improvements & Changes

  • Centralized AI Configuration: Created getMCTSConfigForDifficulty function to manage MCTS parameters (iterations, time limit, RAVE usage, RAVE bias) for each difficulty level, simplifying tuning.
  • MCTS Playouts Return Moves: simulateRandomPlayout now returns the sequence of moves from the playout to facilitate RAVE backpropagation.
  • SGF Import Robustness: Minor improvements to SGF parsing for pass moves on large boards (e.g., "tt").
  • MCTS Code Clarity: Added refactoring and comments to MCTS selection and backpropagation for RAVE logic.
  • Help Text Update: In-game help dialog updated to describe the "Expert" AI, RAVE, and enhanced Hint functionality.

🐛 Bug Fixes

  • AI Opponent Difficulty in PvA (Save/Load/Apply Settings): Ensured correct assignment of AI opponent difficulty in Player vs AI mode based on player color and selected "AI Opponent Difficulty".
  • Ko State Simulation: Ensured simulateMoveMCTS correctly generates newKoStateForNextPlayer based on the board state before a single-stone capture.

⚠️ Known Issues & Considerations

  • Performance of "Expert" AI: "Expert" AI and hints are computationally intensive, leading to noticeably longer move/hint times. This is an expected trade-off.
  • RAVE Bias Tuning: The raveBiasConstant (currently 350 for Expert) is heuristic; further empirical testing could refine it.
  • No "Smarter Playouts" Yet: Playouts remain purely random (among legal moves). Future enhancements could add lightweight heuristics.

🚀 Future Ideas

  • Implement "smarter" (heuristic-guided) random playouts.
  • Investigate WebAssembly for critical MCTS components to boost performance.
  • Add more sophisticated pattern recognition (e.g., opening books, basic life-and-death).
  • Allow advanced users to customize MCTS parameters for AI/Hints.

Files

go.zip Play in browser
1 day ago

Leave a comment

Log in with itch.io to leave a comment.