Diff of /doc/source/logic_programming/plans.txt [0176eb] .. [4dca5a] Maximize Restore

  Switch to side-by-side view

--- a/doc/source/logic_programming/plans.txt
+++ b/doc/source/logic_programming/plans.txt
@@ -156,15 +156,24 @@
 Running the Example
 ========================
 
+.. This code is hidden.  It will add '' to sys.path, change to the doc.examples
+   directory and store the directory path in __file__ for the code section
+   following:
+   >>> import sys
+   >>> if '' not in sys.path: sys.path.insert(0, '')
+   >>> import os
+   >>> os.chdir("../../examples")
+   >>> __file__ = os.getcwd()
+
 The plan is created as a byproduct of proving_ the goal:
 
     >>> from pyke import knowledge_engine
-    >>> engine = knowledge_engine.engine('doc.examples')
+
+    >>> engine = knowledge_engine.engine(__file__)
     >>> engine.activate('plan_example')
-    >>> no_vars, plan1 = engine.prove_1('plan_example', 'transfer',
-    ...                                 (('bruce', 'checking'),
-    ...                                  ('bruce', 'savings')),
-    ...                                 0)
+    >>> no_vars, plan1 = \
+    ...   engine.prove_1_goal(
+    ...     'plan_example.transfer((bruce, checking), (bruce, savings))')
 
 ``plan1`` is now a program to transfer X amount
 from 'bruce', 'checking' to 'bruce', 'savings'.  Using the above rule names
@@ -198,10 +207,10 @@
 
 Let's create a second program:
 
-    >>> no_vars, plan2 = engine.prove_1('plan_example', 'transfer',
-    ...                                 (('bruce', 'checking'),
-    ...                                  ('my_other_bank', 'bruce', 'savings')),
-    ...                                 0)
+    >>> no_vars, plan2 = \
+    ...   engine.prove_1_goal(
+    ...     'plan_example.transfer((bruce, checking), '
+    ...                           '(my_other_bank, bruce, savings))')
 
 ``plan2`` is now a program to transfer X amount
 from 'my_other_bank', 'bruce', 'checking' to 'bruce', 'savings'.
@@ -224,10 +233,10 @@
 
 And the final use case:
 
-    >>> no_vars, plan3 = engine.prove_1('plan_example', 'transfer',
-    ...                                 (('my_other_bank', 'bruce', 'checking'),
-    ...                                  ('bruce', 'savings')),
-    ...                                 0)
+    >>> no_vars, plan3 = \
+    ...   engine.prove_1_goal(
+    ...     'plan_example.transfer((my_other_bank, bruce, checking), '
+    ...                           '(bruce, savings))')
     >>> plan3(150)
     get 150 from bank my_other_bank acct bruce checking
     withdraw 150 from central_accts ach_recv_acct