The goal is to have working code for all the algorithms in the book in
a variety of languages. So far, we have Java, Lisp and Python
versions of most of the algorithms. There is also some old code in
C++, C# and Prolog, but these are not being maintained. We also have
a directory full of data files. Let
peter@norvig.com know what
languages you'd like to see, and if you're willing to help.
Supported Implementations
We offer the following three language choices, plus a selection of data that works with all the implementations:
Unsupported Implementations
Implementation Choices
What languages are instructors recommending? To get an approximate
idea, I gave the query
norvig russell "Modern Approach" along with
the names of various languages and looked at the estimated counts of results on
various dates:
Language  23 Sep 2004  2 Feb 2005  15 Jun 2007  6 Jan 2010


none  8,080  20,100  75,200  150,000

java  1,990  4,930  44,200  37,000

c++  875  1,820  35,300  105,000

lisp  844  974  30,100  19,000

prolog  789  2,010  23,200  17,000

python  785  1,240  18,400  11,000

Of course, neither recall nor precision is perfect for these queries,
nor is the estimated number of results guaranteed to be accurate,
but they offer a rough estimate of popularity. Also, the links in the table
let you investigate individual courses using each language.
Index of Pseudocode in Book
Fig.  Page  Name (in Book)  Kind


2  32  Environment  type
 2.1  33  Agent  fn
 2.3  34  TableDrivenVacuumAgent  fn
 2.7  45  TableDrivenAgent  fn
 2.8  46  ReflexVacuumAgent  fn
 2.10  47  SimpleReflexAgent  fn
 2.12  49  ReflexAgentWithState  fn
 3.1  61  SimpleProblemSolvingAgent  fn
 3  62  Problem  type
 3.2  63  Romania  data
 3  69  Node  type
 3.7  70  TreeSearch  fn
 3  71  Queue  type
 3.9  72  TreeSearch  fn
 3.13  77  DepthLimitedSearch  fn
 3.14  79  IterativeDeepeningSearch  fn
 3.19  83  GraphSearch  fn
 4  95  BestFirstSearch  fn
 4  97  A*Search  fn
 4.5  102  RecursiveBestFirstSearch  fn
 4.11  112  HillClimbing  fn
 4.14  116  SimulatedAnnealing  fn
 4.17  119  GeneticAlgorithm  fn
 4.20  126  OnlineDFSAgent  fn
 5  137  CSP  type
 5.3  142  BacktrackingSearch  fn
 5.7  146  AC3  fn
 5.8  151  MinConflicts  fn
 6.3  166  MinimaxDecision  fn
 6.7  170  AlphaBetaSearch  fn
 7  195  KB  type
 7.1  196  KBAgent  fn
 7.7  205  Propositional Logic Sentence  type
 7.10  209  TTEntails  fn
 7  215  Convert to CNF  fn
 7.12  216  PLResolution  fn
 7.14  219  PLFCEntails?  fn
 7.16  222  DPLLSatisfiable?  fn
 7.17  223  WalkSAT  fn
 7.19  226  PLWumpusAgent  fn
 9  273  Subst  fn
 9.1  278  Unify  fn
 9.3  282  FOLFCAsk  fn
 9.6  288  FOLBCAsk  fn
 9.14  307  Otter  fn
 11.2  380  Airportproblem  data
 11.3  381  SpareTireProblem  data
 11.4  383  ThreeBlockTower  data
 11  390  PartialOrderPlanner  fn
 11.11  396  CakeProblem  data
 11.13  399  Graphplan  fn
 11.15  403  SATPlan  fn
 12.1  418  JobShopProblem  data
 12.3  421  JobShopProblemWithResources  data
 12.6  424  HouseBuildingProblem  data
 12.10  435  AndOrGraphSearch  fn
 12.22  449  ContinuousPOPAgent  fn
 12.23  450  Doublestennis  data
 13.1  466  DTAgent  fn
 13  469  Discrete Probability Distribution  fn
 13.4  477  EnumerateJointAsk  fn
 14.10  509  EliminationAsk  fn
 14.12  512  PriorSample  fn
 14.13  513  RejectionSampling  fn
 14.14  515  LikelihoodWeighting  fn
 14.15  517  MCMCAsk  fn
 15.4  546  ForwardBackward  fn
 15.6  552  FixedLagSmoothing  fn
 15.15  566  ParticleFiltering  fn
 16.8  603  InformationGatheringAgent  fn
 17.4  621  ValueIteration  fn
 17.7  624  PolicyIteration  fn
 18.5  658  DecisionTreeLearning  fn
 18.10  667  AdaBoost  fn
 18.14  672  DecisionListLearning  fn
 19.2  681  CurrentBestLearning  fn
 19.3  683  VersionSpaceLearning  fn
 19.8  696  MinimalConsistentDet  fn
 19.12  702  FOIL  fn
 20.21  742  PerceptronLearning  fn
 20.25  746  BackPropLearning  fn
 21.2  768  PassiveADPAgent  fn
 21.4  769  PassiveTDAgent  fn
 21.8  776  QLearningAgent  fn
 22.2  796  NaiveCommunicatingAgent  fn
 22.7  801  ChartParse  fn
 23.1  837  ViterbiSegmentation  fn
 24.21  892  Align  fn



Index of Programming Exercises in Book
Ex.  Page  Description


2.7  57  Environment simulator for vacuum world (partially implemented)
 3.9  90  Missionaries and Cannibals
 3.10  91  Successor function for 8puzzle
 3.11  91  Iterative Lengthening Search
 3.14  91  Path connecting two web pages
 3.1516  91  Shortest path in plane with polygonal obstacles
 3.19  93  Search agents for vacuum world
 4.4  134  Suboptimal admissible but inconsistent h(n)
 4.8  135  Travelling Salesperson via Minimum Spanning Tree
 4.10  135  Improved 8puzzle heuristics
 4.15  136  Local search to solve Travelling Salesperson
 4.16  136  Compare hillclimbing, annealing on 8puzzle, 8queens
 4.17  136  Hillclimbing for robot navigation
 4.18  136  Compare A* and RBFS on 8puzzle
 5.7  159  Compare CSP algorithms on mapcoloring
 5.12  159  Find minimal cycle cutset
 6.4  191  Move generator and evaluation functions for board games
 6.6  191  Expectiminimax and *alphabeta for games with chance nodes
 7.15  239  Extend PLWumpusAgent to track all facts within the KB
 8.11  269  Tell and Ask facts about family tre ein Fig. 8.5
 8.17  270  Define addition for nbit numbers; verify adder is correct.
 9.14  317  Sorting in Prolog
 9.15  318  Recursive rewrite rules (demodulators) in Logic programming
 12.16  460  Modify AndOrGraphsearch to generate a cyclic plan
 14.12  536  Relational Probabilistic Model of Soccer League
 16.5  611  Determine utility of money for subjects
 16.8  611  Model of airportsiting problem
 17.6  647  Policy iteration on 4x3 (and larger) world
 17.7  647  Find threshold values for R(s)
 18.12  677  DecisionTreeLearning with missing attribute values
 19.5  711  Inverse resolution in Logic Programming
 20.15  761  Perceptron and Decisiontree learning on a data set
 21.1  788  Compare algorithms for passive learning agent
 21.7  789  Exploring RL agent that uses direct utility estimation
 21.11  789  Two RL agents learning to play a game
 21.12  789  Reinforce and Pegasus algorithms for 4x3 world
 22.10  832  Chartparsing with a packed tree representation
 22.11  832  Chartparsing with a partial packed tree representation
 23.1  861  Stylometry: determining authorship
 23.2  861  Statistics of ngram models
 23.3  861  Detection of spam email
 23.7  862  Regular expression or program to extract company names
 25.2  943  Monte Carlo localization
 25.4  943  Voronoi diagram

