You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Python code for the book *Artificial Intelligence: A Modern Approach.*
4
-
When complete, this project will cover all the major topics in the book, for each topic, such as `logic`, we will have the following [Python 3.5](https://www.python.org/downloads/release/python-350/) files in the main branch:
5
3
6
-
-`logic.py`: Implementations of all the pseudocode algorithms in the book.
7
-
-`logic_test.py`: A lightweight test suite, using `assert` statements, designed for use with `py.test`.
4
+
Python code for the book *Artificial Intelligence: A Modern Approach.* We're loooking for one student sponsored by Google Summer of Code (GSoC) to work on this project; if you want to be that student, make some good contributions here (by looking throush the "Issues" and resolving some), and submit an application. (And we're always looking for solid contributors who are not affiliated with GSoC.)
5
+
6
+
## Structure of the Project
7
+
8
+
When complete, this project will have [Python 3.5](https://www.python.org/downloads/release/python-350/) code for all the pseudocode algorithms in the book. For each major topic, such as `logic`, we will have the following files in the main branch:
9
+
10
+
-`logic.py`: Implementations of all the pseudocode algorithms, and necessary support functions/classes/data.
11
+
-`logic_test.py`: A lightweight test suite, using `assert` statements, designed for use with [`py.test`](http://pytest.org/latest/).
8
12
-`logic.ipynb`: A Jupyter notebook, with examples of usage. Does a `from logic import *` to get the code.
9
13
10
-
Until we get there, we will support a legacy branch, `aima3python2` (for the third edition of the textbook and for Python 2 code). To prepare code for the new master branch, the following two steps should be taken
14
+
Until we get there, we will support a legacy branch, `aima3python2` (for the third edition of the textbook and for Python 2 code). To prepare code for the new master branch, the following two steps should be taken:
11
15
12
16
## Port to Python 3; Pythonic Idioms; py.test
13
17
14
18
- Check for common problems in [porting to Python 3](http://python3porting.com/problems.html), such as: `print` is now a function; `range` and `map` and other functions no longer produce `list`s; objects of different types can no longer be compared with `<`; strings are now Unicode; it would be nice to move `%` string formating to `.format`; there is a new `next` function for generators; integer division now returns a float; we can now use set literals.
15
-
- Replace poor idioms with proper Python. For example, we have many functions that were taken directly from Common Lisp, such as the `every` function: `every(callable, items)` returns true if every element of `items` is callable. This is good Lisp style, but good Python style would be to use `all` and a generator expression: `all(callable(f) for f in items)`. Eventually, fix all calls to these legacy Lisp functions and then remove the functions.
19
+
- Replace old Lisp-based idioms with proper Python idioms. For example, we have many functions that were taken directly from Common Lisp, such as the `every` function: `every(callable, items)` returns true if every element of `items` is callable. This is good Lisp style, but good Python style would be to use `all` and a generator expression: `all(callable(f) for f in items)`. Eventually, fix all calls to these legacy Lisp functions and then remove the functions.
16
20
- Create a `_test.py` file, and define functions that use `assert` to make tests. Remove any old `doctest` tests.
17
-
In other words, replace the ">>> 2 + 2" in a docstring with "assert 2 + 2 == 4" in `filename_test.py`.
21
+
In other words, replace the ">>> 2 + 2 \n 4" in a docstring with "assert 2 + 2 == 4" in `filename_test.py`.
18
22
19
23
## New and Improved Algorithms
20
24
21
-
- Implement functions that were in the third edition of the book but were not yet implemented in the code.
22
-
- As we finish chapters for the new fourth edition, we will share the pseudocode, and describe what changes are necessary.
25
+
- Implement functions that were in the third edition of the book but were not yet implemented in the code. Check the [list of pseudocode algorithms (pdf)](http://aima.cs.berkeley.edu/algorithms.pdf) to see what's missing.
26
+
- As we finish chapters for the new fourth edition, we will share the new pseudocode, and describe what changes are necessary.
23
27
24
28
- Create a `.ipynb` notebook, and give examples of how to use the code.
25
29
@@ -47,7 +51,7 @@ Beyond the above rules, we use [Pep 8](https://www.python.org/dev/peps/pep-0008)
47
51
# Choice of Programming Languages
48
52
49
53
Are we right to concentrate on Java and Python versions of the code? I think so; both languages are popular; Java is
50
-
fast enough for our purposes, and has reasonable type declarations (but can be verbose); Python is popular and has a very direct mapping to the pseudocode in the book (ut lacks type declarations and can be solw). The [TIOBE Index](http://www.tiobe.com/tiobe_index) says the top five most popular languages are:
54
+
fast enough for our purposes, and has reasonable type declarations (but can be verbose); Python is popular and has a very direct mapping to the pseudocode in the book (but lacks type declarations and can be slow). The [TIOBE Index](http://www.tiobe.com/tiobe_index) says the top five most popular languages are:
0 commit comments