|
105 | 105 | {
|
106 | 106 | "data": {
|
107 | 107 | "application/vnd.jupyter.widget-view+json": {
|
108 |
| - "model_id": "aa6c6d7bead14affa18e3cb020fbb382", |
| 108 | + "model_id": "5c0bd0536b5645caa2ddefb56f885ad7", |
109 | 109 | "version_major": 2,
|
110 | 110 | "version_minor": 0
|
111 | 111 | },
|
|
140 | 140 | {
|
141 | 141 | "data": {
|
142 | 142 | "application/vnd.jupyter.widget-view+json": {
|
143 |
| - "model_id": "8cf77297a9314571a07095ef64dd118a", |
| 143 | + "model_id": "b1f7173d976c498b9947ce07601ec44c", |
144 | 144 | "version_major": 2,
|
145 | 145 | "version_minor": 0
|
146 | 146 | },
|
|
167 | 167 | "-----\n",
|
168 | 168 | " | | \n",
|
169 | 169 | "\n",
|
170 |
| - " | |O\n", |
| 170 | + "O| | \n", |
171 | 171 | "-----\n",
|
172 | 172 | " |X| \n",
|
173 | 173 | "-----\n",
|
174 | 174 | " | | \n",
|
175 | 175 | "\n",
|
176 |
| - " | |O\n", |
| 176 | + "O| | \n", |
177 | 177 | "-----\n",
|
178 |
| - " |X|X\n", |
| 178 | + "X|X| \n", |
179 | 179 | "-----\n",
|
180 | 180 | " | | \n",
|
181 | 181 | "\n",
|
182 |
| - " | |O\n", |
| 182 | + "O| | \n", |
183 | 183 | "-----\n",
|
184 |
| - "O|X|X\n", |
| 184 | + "X|X|O\n", |
185 | 185 | "-----\n",
|
186 | 186 | " | | \n",
|
187 | 187 | "\n",
|
188 |
| - "X| |O\n", |
| 188 | + "O| |X\n", |
189 | 189 | "-----\n",
|
190 |
| - "O|X|X\n", |
| 190 | + "X|X|O\n", |
191 | 191 | "-----\n",
|
192 | 192 | " | | \n",
|
193 | 193 | "\n",
|
194 |
| - "X| |O\n", |
| 194 | + "O| |X\n", |
195 | 195 | "-----\n",
|
196 |
| - "O|X|X\n", |
| 196 | + "X|X|O\n", |
197 | 197 | "-----\n",
|
198 |
| - " | |O\n", |
| 198 | + "O| | \n", |
199 | 199 | "\n",
|
200 |
| - "X| |O\n", |
201 |
| - "-----\n", |
202 | 200 | "O|X|X\n",
|
203 | 201 | "-----\n",
|
204 |
| - " |X|O\n", |
205 |
| - "\n", |
206 |
| - "X|O|O\n", |
| 202 | + "X|X|O\n", |
207 | 203 | "-----\n",
|
| 204 | + "O| | \n", |
| 205 | + "\n", |
208 | 206 | "O|X|X\n",
|
209 | 207 | "-----\n",
|
210 |
| - " |X|O\n", |
211 |
| - "\n", |
212 |
| - "X|O|O\n", |
| 208 | + "X|X|O\n", |
213 | 209 | "-----\n",
|
| 210 | + "O|O| \n", |
| 211 | + "\n", |
214 | 212 | "O|X|X\n",
|
215 | 213 | "-----\n",
|
216 | 214 | "X|X|O\n",
|
| 215 | + "-----\n", |
| 216 | + "O|O|X\n", |
217 | 217 | "\n"
|
218 | 218 | ]
|
219 | 219 | }
|
|
273 | 273 | "-----\n",
|
274 | 274 | " | | \n",
|
275 | 275 | "\n",
|
276 |
| - " | |O\n", |
| 276 | + "O| | \n", |
277 | 277 | "-----\n",
|
278 | 278 | " |X| \n",
|
279 | 279 | "-----\n",
|
280 | 280 | " | | \n",
|
281 | 281 | "\n",
|
282 |
| - "Possible actions: [0, 1, 3, 5, 6, 7, 8]\n", |
283 |
| - "> 3\n", |
284 |
| - " | |O\n", |
| 282 | + "Possible actions: [1, 2, 3, 5, 6, 7, 8]\n", |
| 283 | + "> 2\n", |
| 284 | + "O| |X\n", |
285 | 285 | "-----\n",
|
286 |
| - "X|X| \n", |
| 286 | + " |X| \n", |
287 | 287 | "-----\n",
|
288 | 288 | " | | \n",
|
289 | 289 | "\n",
|
290 |
| - " | |O\n", |
| 290 | + "O| |X\n", |
291 | 291 | "-----\n",
|
292 |
| - "X|X|O\n", |
| 292 | + " |X| \n", |
293 | 293 | "-----\n",
|
294 |
| - " | | \n", |
| 294 | + "O| | \n", |
295 | 295 | "\n",
|
296 |
| - "Possible actions: [0, 1, 6, 7, 8]\n", |
297 |
| - "> 8\n", |
298 |
| - " | |O\n", |
| 296 | + "Possible actions: [1, 3, 5, 7, 8]\n", |
| 297 | + "> 3\n", |
| 298 | + "O| |X\n", |
299 | 299 | "-----\n",
|
300 |
| - "X|X|O\n", |
| 300 | + "X|X| \n", |
301 | 301 | "-----\n",
|
302 |
| - " | |X\n", |
| 302 | + "O| | \n", |
303 | 303 | "\n",
|
304 |
| - "O| |O\n", |
| 304 | + "O| |X\n", |
305 | 305 | "-----\n",
|
306 | 306 | "X|X|O\n",
|
307 | 307 | "-----\n",
|
308 |
| - " | |X\n", |
| 308 | + "O| | \n", |
309 | 309 | "\n",
|
310 |
| - "Possible actions: [1, 6, 7]\n", |
| 310 | + "Possible actions: [1, 7, 8]\n", |
311 | 311 | "> 1\n",
|
312 |
| - "O|X|O\n", |
| 312 | + "O|X|X\n", |
313 | 313 | "-----\n",
|
314 | 314 | "X|X|O\n",
|
315 | 315 | "-----\n",
|
316 |
| - " | |X\n", |
| 316 | + "O| | \n", |
317 | 317 | "\n",
|
318 |
| - "O|X|O\n", |
| 318 | + "O|X|X\n", |
319 | 319 | "-----\n",
|
320 | 320 | "X|X|O\n",
|
321 | 321 | "-----\n",
|
322 |
| - " |O|X\n", |
| 322 | + "O|O| \n", |
323 | 323 | "\n",
|
324 |
| - "Possible actions: [6]\n", |
325 |
| - "> 6\n", |
326 |
| - "O|X|O\n", |
| 324 | + "Possible actions: [8]\n", |
| 325 | + "> 8\n", |
| 326 | + "O|X|X\n", |
327 | 327 | "-----\n",
|
328 | 328 | "X|X|O\n",
|
329 | 329 | "-----\n",
|
330 |
| - "X|O|X\n", |
| 330 | + "O|O|X\n", |
331 | 331 | "\n"
|
332 | 332 | ]
|
333 | 333 | }
|
|
350 | 350 | " print(\"Possible actions:\", actions)\n",
|
351 | 351 | " action = int(input(\"> \"))\n",
|
352 | 352 | " assert action in actions\n",
|
353 |
| - " if node is not None and action in node.children:\n", |
354 |
| - " node = node.children[action]\n", |
355 |
| - " elif action not in node.children:\n", |
356 |
| - " node = None\n", |
| 353 | + " if node is not None:\n", |
| 354 | + " node = node.children[action] if action in node.children else None\n", |
357 | 355 | " else:\n",
|
358 | 356 | " if node is not None and len(node.children) > 0:\n",
|
359 | 357 | " action = node.choose_best_action(tree.training)\n",
|
|
0 commit comments