Follow up question to the previous question on drawing Tic-Tac-Toe boards.
This question is similar to this one but since SebGlav created such an understandable and easily customizable figure others could surely benefit from it as well.
The goal is to create a partial game tree of Tic-Tac-Toe to explain the Minimax algorithm similar to the one below. The below figure is from "Artifical Intelligence - A Modern Approach" 1995 by Russel and Norvig.
Edit
After SebGlav informed me that tikzpictures can't be nested I decided to use the solution from the old question mentioned above and was able to create the figure below.

The are still the following problems that I do not know how to solve:
- I would like to add the text on the right, e.g. MAX(X), TERMINAL etc.
- Currently I do not know how to properly display the dots so I wrote "child dots" as placeholders
- The edges of the "child dot" nodes overlap with the board nodes - I assume this is because the text and board nodes are center aligned
Since two of the problems are about the dots I tried to create a Dots style(?) similar to the TTT that was used in the old question.
This is my code:
\documentclass{standalone}
\usepackage{tikz}
\usepackage{forest,calc}
\forestset{
make tab/.style args={#1:#2:#3/#4:#5:#6/#7:#8:#9}{%
content={%
\tabcolsep=.6\tabcolsep
\begin{tabular}{p{\widthof{x}}|p{\widthof{x}}|p{\widthof{x}}}
#1 & #2 & #3\\\hline#4\\\hline#7	
\end{tabular}}},
label position r/.initial=right,
label position b/.initial=below
}
\begin{document}
\begin{forest}
TTT/.style args={#1:#2}{
make tab/.expanded=\forestove{content},
label={\pgfkeysvalueof{/forest/label position #1}:$#2$}
},
TTT*/.style={
make tab=::/::/::,
content/.expand once=%
\expandafter\vphantom\expandafter{\romannumeral-`0\forestov{content}},
draw=none,
append after command={(\tikzlastnode.north) edge (\tikzlastnode.south)},
for descendants={before computing xy={l*=1.2}},
},
Dots/.style={
draw=none,
},
th/.style=thick,
for tree={node options=draw, inner sep=+0pt, parent anchor=south, child anchor=north}
%
[::/::/::, TTT=r:
[x::/::/::, for tree={calign=child, calign child=1},TTT=r:
[x:o:/::/::,TTT=b:
[x:o:x/::/::,TTT=b:
[child dots, Dots
[x:o:x/:o:x/:o:, TTT=b:-1]
]
[child dots, Dots
[x:o:x/o:o:x/x:x:o, TTT=b:0]
]
[child dots, Dots
[x:o:x/:x:/x:o:o, TTT=b:1]
]
[child dots, Dots
[child dots terminal, Dots]
]
]
[x:o:/x::/::, TTT=b:]
[x:o:/:x:/::, TTT=b:]
[child dots, Dots]
]
[x::o/::/::, TTT=b:]
[x::/o::/::, TTT=b:]
[child dots, Dots]
]
[:x:/::/::, TTT=r:]
[::x/::/::, TTT=r:]
[::/x::/::, TTT=r:]
[::/:x:/::, TTT=r:]
[::/::x/::, TTT=r:]
[::/::/x::, TTT=r:]
[::/::/:x:, TTT=r:]
[::/::/::x, TTT=r:]
]
\end{forest}
\end{document}
% [,TTT* % this is just cheating :( to skip a level and go beneath
% [o::/:x:/::, TTT=b:1]
% [:o:/:x:/::, TTT=b:2]
% ]

