Python Console-Animation Suite

Lisa Torrey

Summary Apply five core AI algorithms to five classic puzzles and games within a consistent Python framework.
Topics Breadth-first search, A* search, simulated annealing, minimax, and Q-learning.
Audience Undergraduate introduction to artificial intelligence.
Difficulty These are intended to be small programming exercises to demonstrate core algorithms. As examples they should fit within one class period, and as assignments they should fit within one week.
Strengths Working on a range of popular problems keeps students interested, but adopting a consistent approach reduces the cognitive load. Console-based animation allows for visualization without the overhead of a graphics library.
Weaknesses Using classic domains always poses some risk of internet plagiarism.
Dependencies Assumes students can work with classes, strings, tuples, lists, sets, and dictionaries in Python.
Variants Provide more or less starter code. Change the application domain for an algorithm. Ask students to compare related algorithms within a domain. Convert the projects into another programming language.

Exercise 1: Breadth-first search in a maze

Exercise 2: A* search in sliding-block puzzles

Exercise 3: Simulated annealing in N-queens

Exercise 4: Minimax in tic-tac-toe

Exercise 5: Q-learning in pacman