Home - nikoladimitroff/Adder GitHub Wiki
Adder is a Python library providing implementations of many common algorithms in AI such as searching in the solution space and decision-making using propositional / first-order logic (and many more coming). Most of the algorithms are based on the leading book in AI, some were modified by me to fit better.
I've prepared several small demos to show off the library. You can find all of them under /demos
but instead of delving in the source code you can run python main.py <demo_name> [<demo_args]
to run one. Here's the current list:
-
python main.py snake [board-size] [obstacle-count]
Starts an automated game of snake on a randomly generated board.^
marks the snake's head,&
marks its tail,#
is used for obstacles,@
stands for the fruit. The snake avoids collisions with itself, the walls and the obstacles using A*. The demo may sometimes freeze when run on large boards, -
python main.py picture eagle|toucan|winnie
Another usage of A*, this time it solves an N-Puzzle15-puzzle using an ASCII art depicting an eagle, a toucan or Winnie the Pooh depending on your argument. -
python main.py resolutionkb
An interactive terminal that allows you to build a propositional knowledge base. Usehelp
to see all the available commands. Here's how a sample session could look like:
tell it_is_winter => cold_day
tell should_go_out <=> !cold_day
tell it_is_winter
ask cold_day # True
ask should_go_out # False
The rest of the demos will be described soon as well.
Clone this repo or install it via PyPi. Adder is split in modules, import the one that you care about:
import adder.logic as logic
kb = logic.KnowledgeBase("A <=> B")
print(kb.ask("B")) # False
kb.tell("A")
print(kb.ask("B")) # True
For a full list of the current and future functionality, see this page.
For more information on the API provided by Adder check the rest of the wiki or contact me at [email protected] for information.