AI

Can someone give me a brief description on what the core AI procedures are? If I want to make more cards playable, I'll need to know how the system works and it saves time if I don't have to browse through a hundred files to find it.
Specifically, I'd like to know these
-The procedure the AI uses to calculate the play priority of a spell or ability. The priority the spell itself has, ignoring costs and timing.
-The procedure the AI uses to calculate the timing priority of the same - the one that evaluates if it's the correct time to activate the thing, or it is better to do later.
-The main procedure that decides what to play based on input from the above two, costs, and available resources.
-The procedure the AI uses to decide what to discard from hand
-The procedure the AI uses to decide what to search for in the deck
-It seems the whole thing is operating on the script containing the rules the AI should use specified as $AILogic? Can I have a list of the existing logics and what they are used for and the correct syntax?
An example, if I want to specify "play this during X phase, or in response to the permanent containing the ability being targeted by an enemy spell, but only if above Y life. It's a spell that kills a target permanent, pick the one with the highest current in-play value. Do not use if a spell/ability with the same name is already on the stack under the AI's control.", what do I write there?
I did find https://www.slightlymagic.net/wiki/Forge_API but it tells nothing about AI stuff.
-How do you specify a card is/isn't AI playable? (Assuming I do manage to teach it to use something it couldn't use before, I will need to know this.)
Specifically, I'd like to know these
-The procedure the AI uses to calculate the play priority of a spell or ability. The priority the spell itself has, ignoring costs and timing.
-The procedure the AI uses to calculate the timing priority of the same - the one that evaluates if it's the correct time to activate the thing, or it is better to do later.
-The main procedure that decides what to play based on input from the above two, costs, and available resources.
-The procedure the AI uses to decide what to discard from hand
-The procedure the AI uses to decide what to search for in the deck
-It seems the whole thing is operating on the script containing the rules the AI should use specified as $AILogic? Can I have a list of the existing logics and what they are used for and the correct syntax?
An example, if I want to specify "play this during X phase, or in response to the permanent containing the ability being targeted by an enemy spell, but only if above Y life. It's a spell that kills a target permanent, pick the one with the highest current in-play value. Do not use if a spell/ability with the same name is already on the stack under the AI's control.", what do I write there?
I did find https://www.slightlymagic.net/wiki/Forge_API but it tells nothing about AI stuff.
-How do you specify a card is/isn't AI playable? (Assuming I do manage to teach it to use something it couldn't use before, I will need to know this.)