Thread Rating:
This is an idea of how AI should think, to show the programmer what features must be implemented before creating the more advanced AI.
Once the core is done, we can move on to teaching advanced tactics to AI. In the end, fully perfected AI will still not match human 100%, as AI does not make mistakes as human does.
First of all, the programmer has to make sure that all the data and functions are correctly written: a single typo can invalidate the whole program.
All I can do is write the theory here; I will never know how the code will look like on server. The presence of bugs is always fully guaranteed.
All features of current ppets AI are explained here:
https://forum.pokemonpets.com/Thread-Bat...e-computer
* An AI testing place is required to summon a duel between player controlled monster and AI controlled monster. Also with possibility to equip moves, held items and select EVs, IVs and nature.
* Do not give any recommendations until I see this AI update being approved by CeF; you would waste time if CeF decides to refuse.
// Defense AI v0.0004 ALPHA - will update as I see fit, as I get recommendations and as I have free time. Or abandon when I see refusal by CeF.
// Explanations:
// Some of the excess statements written below are for future use/expansion of AI.
// = is the ASSIGNMENT operator, but == is the RELATIONAL operator!
// Calculated stats - visible stats - already counted de/buffs including status ailments and abilities.
// Valid moves - with over 0 PP.
// Buff priority: sp/defense > evasion > accuracy > sp/attack > speed.
// Debuff priority: sp/attack > accuracy > sp/defense > evasion > speed.
// Status ailment priority: sleep > burn > poison > bleed > freeze, paralyze and confuse.
// Set variables:
ATTACKER_TEAM_SIZE = monster count in attacking team.
TRAP_T = 0
// What does defender have?
1. Store all of your monster's data in your team: types, HP, calculated stats, abilities, moves and held item, in arrays (Id. No), which again will be inside array DEFENDER_TEAM
2. Continue to ::OBSERVE
// At the start of battle the AI will begin the fight with monster #1 in team.
::OBSERVE
// What is my opponent, check if "Switch Pokémon" was used by opponent.
// Before this stage opponent either selected first monster, switched monster or used a move.
1. IF (Id. No) is a already present in ATTACKING_TEAM array AND values do not match, then update any changed values, add status ailments if any.
1.1. ELSE store attacking monster's data: types, HP, calculated stats, abilities, moves and held item, in array (Id. No), in array ATTACKING_TEAM
2. IF (M_DISABLED > 0) then M_DISABLED -= 1. Go to ::END_TURN
3. IF TRAP_T > 0
3.1. IF (TRAPPED_ID == attacking monster's (Id. No)) then TRAP_T -= 1
3.1.1. ELSE TRAP_T = 0
4. Continue to ::PRE
::PRE
1. Call ::DO_CALC: will the defender be alive next turn OR will the next move by defender result in a draw?
1.1. Yes! Call ::DO_CALC: can defender hit first?
1.1.1. Yes! LOOP to find all valid moves: call ::DO_CALC: can defender OHKO attacker? Store in VALID_MOVES
1.1.1.1. Yes! Pick a move with highest PP from VALID_MOVES, store the move in USE_MOVE and go to ::EXECUTE
1.1.1.2. No. Go to ::PLAN_MOVE
1.1.2. No. Go to ::PLAN_MOVE
1.2. No. LOOP ::DO_CALC: is there a monster in DEFENDER_TEAM which can survive? Pick the best counter against attacking (Id. No) and store in VALID_MONSTER
1.2.1. Yes! Do "Switch Pokémon" to the monster in VALID_MONSTER. Go to ::END_TURN
1.2.2. No. Do "Surrender and End Battle".
::PLAN_MOVE
// Analyze defending monster's moves:
// Struggle?
1. Does defender have Struggle move only?
1.1. Yes! STRUGGLE = TRUE. Go to ::EXECUTE
// Heal?
2. Call ::DO_CALC: can AND does defender need to heal self?
2.1. Yes! LOOP to find all valid moves, store in VALID_MOVES, pick a move with desired heal amount from VALID_MOVES, store in USE_MOVE and go to ::EXECUTE
// Remove status ailments from self?
3. Call ::DO_CALC: can AND does defender need to remove status ailments from self?
3.1. Yes! LOOP to find all valid moves, store in VALID_MOVES, pick a move with desired restoration from VALID_MOVES, store in USE_MOVE and go to ::EXECUTE
// Trap?
4. Call ::DO_CALC: can defender survive for stall wall role if defender traps attacker first AND (TRAP_T == 0) AND there are less than ((ATTACKER_TEAM_SIZE - 1) monsters with 0 HP in ATTACKING_TEAM)?
4.1. Yes! LOOP to find all valid moves in defender's move set: does defender have a move with "traps the enemy" effect? Store in TRAPS
4.1.1. Yes! Pick a move with the highest trapped turns count from TRAPS, store the move in USE_MOVE, store trapped turns count in TRAP_T, attacking monster's (Id. No) in TRAPPED_ID and go to ::EXECUTE
// Buff?
5. Call ::DO_CALC: can defender buff self without dying AND target stat is not +5?
5.1. Yes! LOOP to find all valid moves, store in VALID_MOVES, pick the most important buff from VALID_MOVES, store in USE_MOVE and go to ::EXECUTE
// Debuff?
6. Call ::DO_CALC: can defender debuff attacker without dying AND target stat is not -5?
6.1. Yes! LOOP to find all valid moves, store in VALID_MOVES, pick the most important debuff from VALID_MOVES, store in USE_MOVE and go to ::EXECUTE
// Apply status ailments?
7. Call ::DO_CALC: can AND should defender apply status ailment on attacker?
7.1. Yes! LOOP to find all valid moves, store in VALID_MOVES, pick the most important status ailment from VALID_MOVES, store in USE_MOVE and go to ::EXECUTE
// Attack?
8. Call ::DO_CALC: can defender attack with a damaging move?
8.1. Yes! LOOP to find all valid moves, store in VALID_MOVES, pick a move with the most damage output from VALID_MOVES, store in USE_MOVE and go to ::EXECUTE
::EXECUTE
1. IF (STRUGGLE == TRUE) then use move Struggle. STRUGGLE = FALSE
1.1. ELSE use the move that's stored in USE_MOVE
1.1.1. IF the move makes monster Rest then M_DISABLED = 1
2. Go to ::END_TURN
::END_TURN
1. Wait for attacker's action.
2. Return to ::OBSERVE
// The most important function to be programmed: comparison mechanism.
::DO_CALC
1. Perform calculations between attacker's (Id. No) and defender's (Id. No) - compare types, HP, calculated stats, abilities, held item, status ailments, weather and moves and effects, PP of moves.
2. Continue in caller.
Once the core is done, we can move on to teaching advanced tactics to AI. In the end, fully perfected AI will still not match human 100%, as AI does not make mistakes as human does.
First of all, the programmer has to make sure that all the data and functions are correctly written: a single typo can invalidate the whole program.
All I can do is write the theory here; I will never know how the code will look like on server. The presence of bugs is always fully guaranteed.
All features of current ppets AI are explained here:
https://forum.pokemonpets.com/Thread-Bat...e-computer
* An AI testing place is required to summon a duel between player controlled monster and AI controlled monster. Also with possibility to equip moves, held items and select EVs, IVs and nature.
* Do not give any recommendations until I see this AI update being approved by CeF; you would waste time if CeF decides to refuse.
// Defense AI v0.0004 ALPHA - will update as I see fit, as I get recommendations and as I have free time. Or abandon when I see refusal by CeF.
// Explanations:
// Some of the excess statements written below are for future use/expansion of AI.
// = is the ASSIGNMENT operator, but == is the RELATIONAL operator!
// Calculated stats - visible stats - already counted de/buffs including status ailments and abilities.
// Valid moves - with over 0 PP.
// Buff priority: sp/defense > evasion > accuracy > sp/attack > speed.
// Debuff priority: sp/attack > accuracy > sp/defense > evasion > speed.
// Status ailment priority: sleep > burn > poison > bleed > freeze, paralyze and confuse.
// Set variables:
ATTACKER_TEAM_SIZE = monster count in attacking team.
TRAP_T = 0
// What does defender have?
1. Store all of your monster's data in your team: types, HP, calculated stats, abilities, moves and held item, in arrays (Id. No), which again will be inside array DEFENDER_TEAM
2. Continue to ::OBSERVE
// At the start of battle the AI will begin the fight with monster #1 in team.
::OBSERVE
// What is my opponent, check if "Switch Pokémon" was used by opponent.
// Before this stage opponent either selected first monster, switched monster or used a move.
1. IF (Id. No) is a already present in ATTACKING_TEAM array AND values do not match, then update any changed values, add status ailments if any.
1.1. ELSE store attacking monster's data: types, HP, calculated stats, abilities, moves and held item, in array (Id. No), in array ATTACKING_TEAM
2. IF (M_DISABLED > 0) then M_DISABLED -= 1. Go to ::END_TURN
3. IF TRAP_T > 0
3.1. IF (TRAPPED_ID == attacking monster's (Id. No)) then TRAP_T -= 1
3.1.1. ELSE TRAP_T = 0
4. Continue to ::PRE
::PRE
1. Call ::DO_CALC: will the defender be alive next turn OR will the next move by defender result in a draw?
1.1. Yes! Call ::DO_CALC: can defender hit first?
1.1.1. Yes! LOOP to find all valid moves: call ::DO_CALC: can defender OHKO attacker? Store in VALID_MOVES
1.1.1.1. Yes! Pick a move with highest PP from VALID_MOVES, store the move in USE_MOVE and go to ::EXECUTE
1.1.1.2. No. Go to ::PLAN_MOVE
1.1.2. No. Go to ::PLAN_MOVE
1.2. No. LOOP ::DO_CALC: is there a monster in DEFENDER_TEAM which can survive? Pick the best counter against attacking (Id. No) and store in VALID_MONSTER
1.2.1. Yes! Do "Switch Pokémon" to the monster in VALID_MONSTER. Go to ::END_TURN
1.2.2. No. Do "Surrender and End Battle".
::PLAN_MOVE
// Analyze defending monster's moves:
// Struggle?
1. Does defender have Struggle move only?
1.1. Yes! STRUGGLE = TRUE. Go to ::EXECUTE
// Heal?
2. Call ::DO_CALC: can AND does defender need to heal self?
2.1. Yes! LOOP to find all valid moves, store in VALID_MOVES, pick a move with desired heal amount from VALID_MOVES, store in USE_MOVE and go to ::EXECUTE
// Remove status ailments from self?
3. Call ::DO_CALC: can AND does defender need to remove status ailments from self?
3.1. Yes! LOOP to find all valid moves, store in VALID_MOVES, pick a move with desired restoration from VALID_MOVES, store in USE_MOVE and go to ::EXECUTE
// Trap?
4. Call ::DO_CALC: can defender survive for stall wall role if defender traps attacker first AND (TRAP_T == 0) AND there are less than ((ATTACKER_TEAM_SIZE - 1) monsters with 0 HP in ATTACKING_TEAM)?
4.1. Yes! LOOP to find all valid moves in defender's move set: does defender have a move with "traps the enemy" effect? Store in TRAPS
4.1.1. Yes! Pick a move with the highest trapped turns count from TRAPS, store the move in USE_MOVE, store trapped turns count in TRAP_T, attacking monster's (Id. No) in TRAPPED_ID and go to ::EXECUTE
// Buff?
5. Call ::DO_CALC: can defender buff self without dying AND target stat is not +5?
5.1. Yes! LOOP to find all valid moves, store in VALID_MOVES, pick the most important buff from VALID_MOVES, store in USE_MOVE and go to ::EXECUTE
// Debuff?
6. Call ::DO_CALC: can defender debuff attacker without dying AND target stat is not -5?
6.1. Yes! LOOP to find all valid moves, store in VALID_MOVES, pick the most important debuff from VALID_MOVES, store in USE_MOVE and go to ::EXECUTE
// Apply status ailments?
7. Call ::DO_CALC: can AND should defender apply status ailment on attacker?
7.1. Yes! LOOP to find all valid moves, store in VALID_MOVES, pick the most important status ailment from VALID_MOVES, store in USE_MOVE and go to ::EXECUTE
// Attack?
8. Call ::DO_CALC: can defender attack with a damaging move?
8.1. Yes! LOOP to find all valid moves, store in VALID_MOVES, pick a move with the most damage output from VALID_MOVES, store in USE_MOVE and go to ::EXECUTE
::EXECUTE
1. IF (STRUGGLE == TRUE) then use move Struggle. STRUGGLE = FALSE
1.1. ELSE use the move that's stored in USE_MOVE
1.1.1. IF the move makes monster Rest then M_DISABLED = 1
2. Go to ::END_TURN
::END_TURN
1. Wait for attacker's action.
2. Return to ::OBSERVE
// The most important function to be programmed: comparison mechanism.
::DO_CALC
1. Perform calculations between attacker's (Id. No) and defender's (Id. No) - compare types, HP, calculated stats, abilities, held item, status ailments, weather and moves and effects, PP of moves.
2. Continue in caller.
"Let another man praise thee, and not thine own mouth; a stranger, and not thine own lips." - Proverbs 27:2
"He that loveth pastime, shall be a poor man: and he that loveth wine and oil, shall not be rich." - Proverbs 21:17
"He that loveth pastime, shall be a poor man: and he that loveth wine and oil, shall not be rich." - Proverbs 21:17
2022-09-06, 10:14 PM
Can you comment on the current AI system? I have done so many improvements since you have posted
Video: Idealism the philosophy of the matrix and the true nature of matter
Video: WHO IS GOD!
Skype username: MonsterMMORPG
Thread-Forum-Ranks-FAQ
Video: WHO IS GOD!
Skype username: MonsterMMORPG
Thread-Forum-Ranks-FAQ
Windows 10 activator can enhance user productivity. When fully activated, Windows 10 allows access to features such as Cortana, the virtual assistant, and enhanced multitasking capabilities like Snap Layouts and Desktops. These tools can significantly streamline workflows by windows activator, making it easier for users to manage multiple tasks and applications effectively. Users can also take advantage of Microsoft Office integration and features that improve collaboration and communication, particularly for those working remotely.
2024-10-29, 09:48 AM
impressive
Users browsing this thread: 2 Guest(s)
Users browsed this thread: Alexa123 , areejsalam , CeFurkan , Fanromi , gamevault , here444 , JacobBlair , jameseric , jendavis , JoeLie123 , KaitlynBishop , kane001 , kunwarkharbanda , lewishamilton0998 , lilyjacob123 , MackByrd , marryclare , Martha Olsby , masonethan , matthewkelley , melinasmith , MollyFox , planningjobs , PokemanFon , rishu , RosarioMayert , saintjones , Shohom Nail , TheBuzzyBeetle , VenueArc