From the course: AI Algorithms for Gaming
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Time complexity of brute force approaches - Python Tutorial
From the course: AI Algorithms for Gaming
Time complexity of brute force approaches
- Now let's briefly talk about the complexity of this brute force approach. Notice that the tree for tic-tac-toe grows with a large branching factor at the beginning, and this branching factor goes down because less moves become possible as the game progresses. So at the first level of this tree, we have to analyze just one state of the game, the current state. Next, we have nine places where we can place our mark. Then the opponent has eight options, then we have seven. And so this number goes down one move at a time. That's why the total number of games we'd have to evaluate to produce the first move in tic-tac-toe is nine factorial. Which is a bit over 360,000. That's not so bad. Pretty much any desktop computer, tablet or smartphone today is capable of computing this whole tree in less than five seconds. And there are even better news. This is a pessimistic estimate. So we may aim for an even…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
Some history as motivation3m 46s
-
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 trap3m 51s
-
(Locked)
Code example: A random cat5m 1s
-
-
-
-
-
-