Tuesday, July 6, 2010

Using Prolog for Cataclysmic Purposes

I wasn't too sure which blog to put this under, but I think I'll make this the main entry, and reference from my other one.

There's a World of Warcraft expansion coming up later this year, and my host of WoW toons will be making the journey from level 80 to 85, plus one extra Worgen Druid experiencing Azeroth all over again, from level 1. I've got a couple of other high level characters on other realms, but unless Blizzard do something about the 10 character limit per realm, I don't imagine they'll be doing much.

Anyway, one of the items facing altoholics in the expansion is which character to level to 85 first, then which second, etc. There are many factors to consider, such as profession synergies, money making abilities, survivability and the fun factor. I think the fun factor will win out for me, but it's very handy to have a host of toons which which you can craft weapons, armor, gems and elixirs.

Anyway, my inner nerd remembered a tool that I leaned back in high school that would be just perfect for a job such as this: Prolog. So I tottled off to download Visual Prolog, but since this is just an idle experiment in decision making, I was happy enough to use PIE (Prolog Inference Engine), available within the free examples. PIE most closely resembles what I worked with in high school, without having to get bogged down by all the Windowsy stuff that seems to take more focus in the tutorials than it's worth (or maybe it is worth it, but I just wanted to dive into the stuff I remembers, instead of putting a Window and menu together).

Anyway, a few short Prolog statements later, and I've come up with some basic facts to help determine what I might want to level first.

This set of facts should be common to all WoW characters, but I'm not sure if it's exhaustive. It certain doesn't take advantage of tailors being able to gather extra cloth, or enchanters being able to provide enchants.


armorClass("Deathknight","plate").
armorClass("Warrior","plate").
armorClass("Paladin","plate").
armorClass("Hunter","mail").
armorClass("Shaman","mail").
armorClass("Rogue","leather").
armorClass("Druid","leather").
armorClass("Priest","cloth").
armorClass("Warlock","cloth").
armorClass("Mage","cloth").

crafts("Blacksmith","plate").
crafts("Blacksmith","mail").
crafts("Leatherwork","leather").
crafts("Leatherwork","mail").
crafts("Tailoring","cloth").
crafts("Jewelcrafter","gems").

requires("Blacksmith","ore").
requires("Leatherwork","leather").
requires("Tailoring","cloth").
requires("Inscription","herbs").
requires("Jewelcrafter","ore").
requires("Engineering","ore").
requires("Alchemy","herbs").

gathers("Miner","ore").
gathers("Skinner","leather").
gathers("Herbalist","herbs").


The next facts give the state of play for my toons on Aman'Thul.


toon("Blackthorn","Deathknight").
toon("Pathak","Warrior").
toon("Colerejuste","Paladin").
toon("Nevynoch","Hunter").
toon("Fidgette","Rogue").
toon("Anion","Druid").
toon("Benzol","Priest").
toon("Bojsen","Warlock").

hasProfession("Blackthorn","Herbalist").
hasProfession("Blackthorn","Alchemy").
hasProfession("Pathak","Miner").
hasProfession("Pathak","Blacksmith").
hasProfession("Colerejuste","Jewelcrafter").
hasProfession("Colerejuste","Miner").
hasProfession("Nevynoch","Herbalist").
hasProfession("Nevynoch","Inscription").
hasProfession("Fidgette","Engineering").
hasProfession("Fidgette","Miner").
hasProfession("Anion","Skinner").
hasProfession("Anion","Leatherwork").
hasProfession("Benzol","Tailor").
hasProfession("Benzol","Alchemy").
hasProfession("Bojsen","Tailor").
hasProfession("Bojsen","Enchanter").


And these handy statements let me discover stuff that I could have worked out on paper, but would rather marvel at the revival of my high school level Prolog skills.


wears(Character, ArmorClass) :-
toon(Character, Class),
armorClass(Class, ArmorClass).

gathersFor(Gatherer, Crafter) :-
hasProfession(Gatherer, GatherProfession),
gathers(GatherProfession, Material),
requires(CraftProfession, Material),
hasProfession(Crafter, CraftProfession).

craftsFor(Crafter, Character) :-
hasProfession(Crafter, CraftProfession),
crafts(CraftProfession, ArmorClass),
wears(Character, ArmorClass).


With these basic statements, I can see who my most useful gatherers are, for leveling professions (gathersFor(X,Y).), and who can support each other for crafting gear (craftsFor(X,Y).).

No comments:

Post a Comment