This blog post introduces the basics of Prolog, then motivates and describes a project the author created where they built a Prolog database that allows them to easily make incredibly specific queries about Pokémon (which would be unwieldy in a relational database query language like SQL). For an idea of how powerful it is, here’s one which “finds all the Special moves that Tornadus learns which are super-effective against any member of Justin’s team” (the Prolog database was set up to help the author in planning their teams for a Pokémon draft tournament):
?- justin(Target), learns(tornadus, Move), super_effective_move(Move, Target), move_category(Move, special). Target = charizardmegay, Move = chillingwater ; Target = terapagosterastal, Move = focusblast ; Target = alomomola, Move = grassknot ; Target = scizor, Move = heatwave ; Target = scizor, Move = incinerate ; Target = runerigus, Move = chillingwater ; Target = runerigus, Move = darkpulse ; Target = runerigus, Move = grassknot ; Target = runerigus, Move = icywind ; Target = screamtail, Move = sludgebomb ; Target = screamtail, Move = sludgewave ; Target = trapinch, Move = chillingwater ; Target = trapinch, Move = grassknot ; Target = trapinch, Move = icywind ; false. ?-
0 comments
log in to comment.