Skip to content

Commit 0bc31d6

Browse files
committed
better MCTS visualization
1 parent b9d7038 commit 0bc31d6

5 files changed

Lines changed: 391 additions & 133 deletions

File tree

src/ai/mcts-visualizer.css

Lines changed: 82 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,40 +6,105 @@
66
* https://opensource.org/licenses/MIT.
77
*/
88

9+
.mcts {
10+
display: flex;
11+
flex-direction: column;
12+
}
13+
14+
.mcts .description {
15+
text-align: right;
16+
padding: 50px;
17+
}
18+
919
.mcts-tree {
20+
height: 100%;
21+
display: flex;
22+
flex-direction: row;
23+
align-items: center;
24+
justify-content: flex-end;
25+
}
26+
27+
.mcts-tree .preview {
28+
display: flex;
29+
justify-content: center;
30+
text-align: center;
31+
height: 300px;
32+
width: 300px;
33+
padding: 10px;
34+
}
35+
36+
.mcts-node-preview {
1037
display: flex;
1138
flex-direction: column;
1239
align-items: center;
40+
list-style: none;
41+
text-align: left;
42+
font-size: 12px;
43+
border-radius: 10px;
44+
padding: 20px;
45+
}
46+
47+
.mcts-tree .parents {
48+
display: flex;
49+
flex-direction: row;
50+
align-items: center;
51+
justify-content: flex-end;
1352
}
1453

1554
.mcts-tree .children {
1655
display: grid;
1756
font-weight: bold;
18-
grid-template-columns: repeat(4, 1fr);
57+
grid-template-columns: repeat(1, 1fr);
1958
grid-gap: 10px;
20-
transform: scale(0.6);
2159
}
2260

23-
.mcts-node {
24-
cursor: pointer;
25-
font-size: 20px;
26-
border-radius: 10px;
27-
background: #eee;
28-
width: 200px;
29-
padding: 20px;
61+
.mcts-action-wrapper {
62+
display: flex;
63+
flex-direction: row;
64+
align-items: center;
3065
}
3166

32-
.mcts-root {
33-
margin-top: 20px;
34-
cursor: default;
67+
.mcts-action {
68+
color: #888;
69+
font-size: 11px;
70+
font-weight: normal;
3571
background: #ddd;
36-
border: 2px solid #aaa;
72+
height: 25px;
73+
line-height: 25px;
74+
padding-left: 10px;
75+
padding-right: 10px;
3776
}
3877

39-
.mcts-node:hover {
40-
background: #ddd;
78+
.arrow-right {
79+
width: 0;
80+
height: 0;
81+
border-top: 20px solid transparent;
82+
border-bottom: 20px solid transparent;
83+
border-left: 20px solid #ddd;
84+
margin-right: 30px;
4185
}
4286

43-
.mcts-node li {
44-
list-style: none;
87+
.mcts-node {
88+
cursor: pointer;
89+
overflow: hidden;
90+
font-size: 14px;
91+
border-radius: 100%;
92+
margin-right: 30px;
93+
border: 1px solid #ccc;
94+
width: 30px;
95+
height: 30px;
96+
line-height: 30px;
97+
padding: 10px;
98+
color: #bbb;
99+
background: #444;
100+
text-align: center;
101+
}
102+
103+
.mcts-node.clickable {
104+
color: #777;
105+
background: #eee;
106+
}
107+
108+
.mcts-node.clickable:hover {
109+
background: #ddd;
45110
}

0 commit comments

Comments
 (0)