Database Querying for Biductive Computing

This assignment uses Prolog and the biductive computing paradigm to allow a user to query a Pokémon database, i.e., a Pokédex. Your task is to write rules that encode the various game rules (gen VI / XY) regarding breeding. See below for the exact rules (in English rather than code) that need to be encoded.

Refer to the code linked at the bottom of this page. Write your code in a new file The file has been pre-populated with facts (no rules) with data translated from this GitHub project.

Breeding rules

The following rules are mostly accurate for the gen VI / XY games. Some special exceptions (e.g., involving legendary Pokémon) are not included for simplicity's sake.

Two Pokémon can breed if,

Ditto is an exception to all of those rules. A Ditto can breed with any other non-Ditto Pokémon, as long as the other is an adult in its evolution.

The resulting child Pokémon is the baby version of the species of the mother, except in the case of breeding with Ditto, in which case the child is the baby version of the non-Ditto parent.

You will write rules with the following names and arguments:

Biductive features

Each of the three required rules listed above may be used with an arbitrary mix of variable arguments and arguments with fixed values. For example, can_breed(MaleSpecies, claydol) will find a male Pokémon that can breed with Claydol, while child_pok(ditto, Female, seel) will find a female Pokémon that can breed with a Ditto to have a child Seel.

Test cases

A series of test cases are given in Run the test cases with this command:

swipl -q -s -t run_tests

If the tests pass, you should see only some dots (1 dot per test) and no error or warning messages.


Submit your file. Include the files and as well, even though you do not need to modify them.

Note: You must not write any new facts. Only write rules. The file has all the facts that are needed.

You'll probably want to start your file like so:

:- [pok_facts]. % import

Grading rubric


This assignment can be more difficult by introducing logic about inherited Pokémon moves. There are different types of moves, e.g., Level Up moves and Egg Moves. Some moves are inherited from the parents according to the following rules:

Ultimately, the baby will have at most four moves. Preference is given to Level Up moves. The file includes test cases about moves, and includes the long list of move facts.