A project originally devoleped for an artificial intelligence programming course teached by Augusto Baffa at the Pontificial Catholic University of Rio de Janeiro. Prolog-based implementation of a decision tree algorithm that identifies animals by asking simple yes or no questions.
Link to the presentation video
To run this code, you need to install SWI-PROLOG which can be downloadead Clicking Here.
To start the algorithm, you'll need to execute the file main.pl using SWI-PROLOG, and than run the 'start.' command. Remember to put a dot in the end of all your answers, it's prolog command sintaxe.
The decision data structure is represented by a binary tree. Each node of the tree represents a question which separates an animal or a subsection of animals from another. The leaves of the tree represents animals, stored in the decision memory(in the saved_tree.txt file). This data structure is used in the decision making process, so the algorithm can guess the user's animal.
This is an example of a decision tree structure:
tree(guessTree,
t('É um mamífero?',
t('Tem listras?',
t('Zebra', nil, nil),
t('Ele ruge?',
t('Ele hiberna?',
t('Urso',nil,nil),
t('Leão',nil,nil),
)
t('Cavalo',nil,nil))
),
),
t('É um passaro?',
t('Ele voa?',
t('Águia', nil, nil),
t('Pinguim', nil, nil)
),
t('Ele tem pernas?',
t('Lagarto',nil,nil),
t('Cobra',nil,nil)
)
)
)
).