Skip to content

Instantly share code, notes, and snippets.

View Katzmann1983's full-sized avatar

Jens Humrich Katzmann1983

View GitHub Profile
@Katzmann1983
Katzmann1983 / monte_carlo_tree_search.py
Created May 30, 2023 16:25 — forked from qpwo/monte_carlo_tree_search.py
Monte Carlo tree search (MCTS) minimal implementation in Python 3, with a tic-tac-toe example gameplay
"""
A minimal implementation of Monte Carlo tree search (MCTS) in Python 3
Luke Harold Miles, July 2019, Public Domain Dedication
See also https://en.wikipedia.org/wiki/Monte_Carlo_tree_search
https://gist.github.com/qpwo/c538c6f73727e254fdc7fab81024f6e1
"""
from abc import ABC, abstractmethod
from collections import defaultdict
import math