Games on Graphs

Two-player games where positions are graph nodes. You analyze winning strategies using backward induction.

62 lessons
180 min

Lessons

1. Intro

(The goal)

3m

2. Positions as States

(Graph as game board)

3m

3. Winning vs Losing Positions

(The simple solution)

3m

4. Terminal Positions

(Where games end)

3m

5. Backward Induction on DAGs

(Reverse topological solve)

3m

6. Why DAGs Are Simple

(No cycles, no draws)

3m

7. Quiz: Winning and Losing Positions

Knowledge check

2m1 problems

8. Games with Cycles

(Draws from cycles)

3m

9. Classifying with Cycles

(Win, lose, or draw)

3m

10. Implementation Pattern

(Minimax BFS pattern)

3m

11. Quiz: Backward Induction

Knowledge check

2m1 problems

12. Problem - Cat and Mouse (Part 1)

(Problem setup)

3m1 problems

13. Problem - Cat and Mouse (Part 2)

(State space modeling)

3m1 problems

14. Problem - Cat and Mouse (Part 3)

(Terminal state marking)

3m1 problems

15. Problem - Cat and Mouse (Part 4)

(BFS propagation)

3m1 problems

16. Problem - Cat and Mouse (Part 5)

(Degree array technique)

3m1 problems

17. Problem - Cat and Mouse (Part 6)

(Drawing states)

3m1 problems

18. Problem - Cat and Mouse (Part 7)

(Time and space cost)

3m1 problems

19. Problem - Cat and Mouse (Part 8)

(Data structures needed)

3m1 problems

20. Problem - Cat and Mouse (Part 9)

(Turn logic details)

3m1 problems

21. Problem - Cat and Mouse (Part 10)

(Edge cases)

3m

22. Problem - Cat and Mouse (Part 11)

(Common pitfalls)

3m1 problems

23. Problem - Cat and Mouse (Part 12)

(Problem summary)

3m1 problems

24. Two-Player vs Single-Player

(Key differences)

3m

25. Nim-Like Games on Graphs

(Sprague-Grundy theory)

3m

26. Computing Grundy Numbers

(MEX computation)

3m

27. When to Use Grundy

(Combined games via XOR)

3m

28. Quiz: Sprague-Grundy Values

Knowledge check

2m1 problems

29. Pursuit-Evasion Games

(Pursuer vs evader)

3m

30. Cops and Robbers on Trees

(Single cop captures)

3m

31. Cops and Robbers on General Graphs

(Cop number of graphs)

3m

32. Problem - Coin Game on DAG (Part 1)

(Problem setup)

3m

33. Problem - Coin Game on DAG (Part 2)

(Losing position rule)

3m

34. Problem - Coin Game on DAG (Part 3)

(Reverse topo processing)

3m

35. Problem - Coin Game on DAG (Part 4)

(Linear time solution)

3m

36. Problem - Coin Game on DAG (Part 5)

(Finding winning moves)

3m

37. Problem - Coin Game on DAG (Part 6)

(Multi-coin variants)

3m

38. Move Ordering Strategies

(Pruning heuristics)

3m

39. Distance to Win

(BFS from terminals)

3m

40. Minimax on Graphs

Alternating maximization an...

3m

41. Alpha-Beta Pruning

(Skipping irrelevant branches)

3m

42. Quiz: Minimax on Graphs

Knowledge check

2m1 problems

43. Memoization for Graph Games

(Avoiding recomputation)

3m

44. Problem - Game on Tree (Part 1)

(Introduction)

3m

45. Problem - Game on Tree (Part 2)

(Minimax on tree structure)

3m

46. Problem - Game on Tree (Part 3)

(Implementation)

3m

47. Problem - Game on Tree (Part 4)

(What you learned)

3m

48. Infinite Games

(Games that never end)

3m

49. Draw Detection Strategies

Identifying non-terminating...

3m

50. Quiz: Draw Detection in Cyclic Games

Knowledge check

2m1 problems

51. Bipartite Game Graphs

(Player positions alternate)

3m

52. Applications in AI

(Game-playing algorithms)

3m

53. Applications in Network Security

(Attacker vs defender games)

3m

54. Applications in Robotics

Path planning with adversaries

3m

55. Stochastic Games

(Adding randomness to games)

3m

56. Complexity of Game Analysis

(Runtime considerations)

3m

57. When to Use Game Theory

(Problem recognition patterns)

3m

58. Common Mistakes

(What to avoid)

3m

59. Quiz: Game State Representation

Knowledge check

2m1 problems

60. Debugging Game Code

(Verification strategies)

3m

61. Extensions and Variants

(Beyond basic games)

3m

62. Section Recap

(What you learned)

3m

Practice Problems

1.
Nim GameLeetCodeeasy
2.
Stick GameCSESeasy
3.
Game RoutesCSESmedium
4.
Permutation GameCodeforcesmedium
5.
Game on TreeCodeforceshard
7.
The Game of ParityCodeforceseasy

Ready to start learning?

Access all 62 lessons with interactive content and progress tracking.