|
1 | | -# `aima-python`: Structure of the Project |
| 1 | +# `aima-python` (Python 3.5) |
2 | 2 |
|
3 | | -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. |
4 | 3 |
|
5 | | -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: |
| 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.) |
6 | 5 |
|
7 | | -- `logic.py`: Implementations of all the pseudocode algorithms in the book. |
8 | | -- `logic_test.py`: A lightweight test suite, using `assert` statements, designed for use with `py.test`. |
| 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/). |
9 | 12 | - `logic.ipynb`: A Jupyter notebook, with examples of usage. Does a `from logic import *` to get the code. |
10 | 13 |
|
11 | 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: |
12 | 15 |
|
13 | 16 | ## Port to Python 3; Pythonic Idioms; py.test |
14 | 17 |
|
15 | 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. |
16 | | -- 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. |
17 | 20 | - Create a `_test.py` file, and define functions that use `assert` to make tests. Remove any old `doctest` tests. |
18 | 21 | In other words, replace the ">>> 2 + 2 \n 4" in a docstring with "assert 2 + 2 == 4" in `filename_test.py`. |
19 | 22 |
|
20 | 23 | ## New and Improved Algorithms |
21 | 24 |
|
22 | | -- Implement functions that were in the third edition of the book but were not yet implemented in the code. Check th [list of pseudocode algorithms (pdf)](http://aima.cs.berkeley.edu/algorithms.pdf) to see what's missing. |
| 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. |
23 | 26 | - As we finish chapters for the new fourth edition, we will share the new pseudocode, and describe what changes are necessary. |
24 | 27 |
|
25 | 28 | - Create a `.ipynb` notebook, and give examples of how to use the code. |
|
0 commit comments