From the course: AI Algorithms for Game Design with Python
Unlock this course with a free trial
Join today to access over 24,800 courses taught by industry experts.
Tree-based decision-making - Python Tutorial
From the course: AI Algorithms for Game Design with Python
Tree-based decision-making
- [Instructor] To play a turn-based game like tic-tac-toe or chess, we are going to use a tree-based decision-making approach. This technique consists of predicting the outcome of all possible player moves, starting at the current state of the game. In this algorithm, we must choose the move that yields the best result for us. Be aware that running this algorithm produces only the next move, not the whole sequence of moves in the future. So this is how tree-based decision-making looks like. Take tic-tac-toe, for example. Let's say the game is about to start and it's our turn. We have the X mark and the opponent has the circle mark. In this first step, we have nine possible moves. We can place our X mark in the top left, top center, top right, all the way down to the bottom right square. Now, notice how this is creating a tree structure. The ellipsis mean that I'm not showing further states horizontally or vertically. That's because this tree will get really, really big. So for each of…
Contents
-
-
-
(Locked)
Some history as motivation3m 46s
-
(Locked)
Different types of games2m 17s
-
(Locked)
Tree-based decision-making2m 28s
-
(Locked)
Time complexity of brute-force approaches2m 56s
-
(Locked)
Time complexity of chess2m 31s
-
The cat trap game3m 36s
-
(Locked)
The Python setting for the cat trap6m 38s
-
(Locked)
Code example: A random cat6m 8s
-
(Locked)
-
-
-
-
-