Programming An Automatic Team Generator Using Usage Stats

Version 3: http://jsfiddle.net/3thuL6yf/2/

This is an app that will let you automatically generate a team from usage stats, ready to go in importable text form. It's also smart enough to know not to give you more than one Z crystal unless you're in 1v1. What takes this generator a step above simpler versions is that instead of simply using the top 6 most commonly used Pokemon, it uses the data on each Pokemon's most common teammate, and aggregates that data as it goes along, so the team is more likely to have better synergy with itself than a team made with a more naive approach would. Disclaimer: teams are not guaranteed to actually have good synergy.

The generator is limited somewhat by the usage stats themselves, specifically what's missing from them, in four main ways. First, data on IVs in spreads is not published, so things like min speed and min attack go unnoticed. Second, there is no data on pre-mega abilities, so it won't answer your question of whether to use Moxie, Mold Breaker, or Hyper Cutter on Mega Pinsir. Third, there isn't any data on how often a Pokemon is used on the same team as another instance of the same forme, such as multiple Primal Groudons on a BH or AG team, so the generator won't ever do that. It will, however, give you teams with multiple types of Arceus in AG. Fourth, there is similarly no data on how often a Pokemon will have more than one instance of the same move. This is relevant in BH where doing so can be a PP stalling strategy, and also cases where a Pokemon has more than one empty moveslot, since Nothing is considered a move. Also, the generator struggles with Ditto, a Pokemon famous for running only one move.

I made this tool over a year ago, but since I wrote it in R I couldn't really think of how to make it available for other people to use, but I've recently gone looking again and found a service that not only lets me host the code, but even use a simplified UI as opposed to a blank command line. If you know how to use TIBot's .usage command, this is kinda like that except you can specify what month of usage stats you want to use. The builder works with any generation, format, or month that there are published stats for, and you can even specify a starter Pokemon for the team; if you don't, it will default to the most commonly used Pokemon of that tier. As a reminder, gen 7 OU and gen 7 DOU don't use 1500, 1630, 1760 stats; they instead use 1500, 1695, 1825 stats. Some example teams and the commands used to make them can be found below. Please let me know of any suggestions you have, or any problems you find with it! Just make sure you're using it right, first. I know it's not exactly the most straight-forward UI in the world, but hey: if you can design a better one, go right ahead! This hosting service is open-source, and you're free to make edits to the code, save them, and post a link to the new version here!

Edit: Usage stats for reference: https://www.smogon.com/stats/

make_team("2018-12", "gen7ou-1825")
Landorus-Therian @ choicescarf
Ability: intimidate
EVs: 252 Atk / 4 SpD / 252 Spe
Jolly Nature
- earthquake
- uturn
- stealthrock
- hiddenpowerice

Tapu Koko @ choicespecs
Ability: electricsurge
EVs: 252 SpA / 4 SpD / 252 Spe
Timid Nature
- thunderbolt
- uturn
- hiddenpowerice
- voltswitch

Medicham-Mega @ medichamite
Ability: purepower
EVs: 252 Atk / 4 SpD / 252 Spe
Jolly Nature
- highjumpkick
- fakeout
- icepunch
- zenheadbutt

Magearna @ assaultvest
Ability: soulheart
EVs: 252 SpA / 4 SpD / 252 Spe
Timid Nature
- fleurcannon
- thunderbolt
- icebeam
- voltswitch

Hawlucha @ electricseed
Ability: unburden
EVs: 96 HP / 252 Atk / 36 SpD / 124 Spe
Adamant Nature
- acrobatics
- swordsdance
- highjumpkick
- drainpunch

Kartana @ choicescarf
Ability: beastboost
EVs: 252 Atk / 4 SpD / 252 Spe
Jolly Nature
- leafblade
- sacredsword
- smartstrike
- knockoff


make_team("2018-11", "gen7ou-1825", "Sableye-Mega")
Sableye-Mega @ sablenite
Ability: magicbounce
EVs: 248 HP / 8 Def / 252 SpD
Careful Nature
- recover
- willowisp
- knockoff
- protect

Chansey @ eviolite
Ability: naturalcure
EVs: 248 HP / 252 Def / 8 SpD
Bold Nature
- seismictoss
- softboiled
- stealthrock
- toxic

Zapdos @ leftovers
Ability: static
EVs: 248 HP / 240 Def / 20 Spe
Bold Nature
- roost
- heatwave
- defog
- discharge

Clefable @ leftovers
Ability: magicguard
EVs: 252 HP / 252 Def / 4 SpD
Bold Nature
- moonblast
- softboiled
- calmmind
- wish

Latias-Mega @ latiasite
Ability: levitate
EVs: 252 HP / 4 Def / 252 Spe
Timid Nature
- calmmind
- storedpower
- recover
- roost

Hippowdon @ leftovers
Ability: sandstream
EVs: 252 HP / 4 Def / 252 SpD
Careful Nature
- slackoff
- earthquake
- stealthrock
- toxic


make_team("2018-12", "gen7doublesou-1825", "Pelipper")
Pelipper @ lifeorb
Ability: drizzle
EVs: 248 HP / 252 SpA / 8 SpD
Quiet Nature
- hurricane
- hydropump
- protect
- tailwind

Bronzong @ psychiumz
Ability: heatproof
EVs: 252 HP / 200 Def / 56 SpD
Relaxed Nature
- trickroom
- gyroball
- stealthrock
- hypnosis

Stakataka @ focussash
Ability: beastboost
EVs: 252 HP / 252 Atk / 4 SpD
Lonely Nature
- gyroball
- trickroom
- rockslide
- wideguard

Hoopa-Unbound @ focussash
Ability: magician
EVs: 192 HP / 224 Atk / 92 Def
Brave Nature
- hyperspacehole
- protect
- hyperspacefury
- trickroom

Tapu Lele @ fightiniumz
Ability: psychicsurge
EVs: 252 HP / 64 SpA / 192 Spe
Modest Nature
- psychic
- dazzlinggleam
- protect
- moonblast

Blastoise-Mega @ blastoisinite
Ability: megalauncher
EVs: 192 HP / 20 Def / 252 SpA / 44 SpD
Quiet Nature
- icebeam
- waterspout
- muddywater
- protect

Note that this Pelipper team is actually a TR team, and note as well that there are no published usage stats on IVs, so none of these supposedly min-speed 'mons actually have a 0 IV in speed; you'd have to add that in yourself.


make_team("2018-12", "gen7anythinggoes-1760", "Vivillon")
Vivillon @ leftovers
Ability: compoundeyes
EVs: 148 Def / 108 SpA / 252 Spe
Timid Nature
- quiverdance
- sleeppowder
- hurricane
- substitute

Excadrill @ focussash
Ability: moldbreaker
EVs: 252 Atk / 4 SpD / 252 Spe
Jolly Nature
- stealthrock
- rocktomb
- rapidspin
- toxic

Kyogre-Primal @ blueorb
Ability: primordialsea
EVs: 252 HP / 252 SpA / 4 SpD
Modest Nature
- icebeam
- originpulse
- thunder
- waterspout

Arceus-Ghost @ ghostiumz
Ability: multitype
EVs: 252 Atk / 4 Def / 252 Spe
Jolly Nature
- swordsdance
- shadowforce
- extremespeed
- brickbreak

Rayquaza-Mega @ lifeorb
Ability: deltastream
EVs: 252 Atk / 4 SpD / 252 Spe
Adamant Nature
- dragonascent
- extremespeed
- vcreate
- dragondance

Yveltal @ lifeorb
Ability: darkaura
EVs: 4 Atk / 252 SpA / 252 Spe
Naive Nature
- oblivionwing
- darkpulse
- foulplay
- suckerpunch


make_team("2018-12", "gen4ou-1760")
Tyranitar @ choiceband
Ability: sandstream
EVs: 252 Atk / 4 SpD / 252 Spe
Jolly Nature
- crunch
- pursuit
- stoneedge
- superpower

Empoleon @ focussash
Ability: torrent
EVs: 252 SpA / 4 SpD / 252 Spe
Modest Nature
- icebeam
- hydropump
- grassknot
- stealthrock

Dragonite @ lumberry
Ability: innerfocus
EVs: 252 Atk / 4 SpD / 252 Spe
Adamant Nature
- outrage
- extremespeed
- dragondance
- earthquake

Rotom-Wash @ choicescarf
Ability: levitate
EVs: 252 SpA / 4 SpD / 252 Spe
Timid Nature
- thunderbolt
- trick
- shadowball
- hiddenpowerice

Infernape @ choiceband
Ability: blaze
EVs: 252 Atk / 4 SpD / 252 Spe
Jolly Nature
- closecombat
- uturn
- machpunch
- flareblitz

Breloom @ toxicorb
Ability: poisonheal
EVs: 236 HP / 252 Atk / 20 Spe
Adamant Nature
- spore
- seedbomb
- machpunch
- superpower
 
Last edited:
Issue with LC teams: It will not generate them at level 5, requiring manual changing.

Otherwise, 10/10, this is great
 
http://jsfiddle.net/3thuL6yf/

Updated version so now the generator will deliberately avoid giving you two megas. Whoops! Also, something to note: certain Pokemon will not work as bases because either they or one of their teammates don't have any moveset data available. This should only happen with very rarely used (read: unviable) Pokemon. There's nothing I can do about it, other than mention it to Antar
 
The teambuilder keeps giving me Zygarde, even after the ban.
View attachment 156893
The generator doesn't know anything about bans, it only knows what was used a lot last month, which unsurprisingly includes a Pokemon strong enough to be banned. I've updated the generator to allow for a fourth parameter, which will let you specify a Pokemon not to include. As an example:

make_team("2018-12", "gen7ou-1825", "", "Zygarde")
Landorus-Therian @ choicescarf
Ability: intimidate
EVs: 252 Atk / 4 SpD / 252 Spe
Jolly Nature
- earthquake
- uturn
- stealthrock
- hiddenpowerice

Tapu Koko @ choicespecs
Ability: electricsurge
EVs: 252 SpA / 4 SpD / 252 Spe
Timid Nature
- thunderbolt
- uturn
- hiddenpowerice
- voltswitch

Medicham-Mega @ medichamite
Ability: purepower
EVs: 252 Atk / 4 SpD / 252 Spe
Jolly Nature
- highjumpkick
- fakeout
- icepunch
- zenheadbutt

Magearna @ assaultvest
Ability: soulheart
EVs: 252 SpA / 4 SpD / 252 Spe
Timid Nature
- fleurcannon
- thunderbolt
- icebeam
- voltswitch

Hawlucha @ electricseed
Ability: unburden
EVs: 96 HP / 252 Atk / 36 SpD / 124 Spe
Adamant Nature
- acrobatics
- swordsdance
- highjumpkick
- drainpunch

Kartana @ choicescarf
Ability: beastboost
EVs: 252 Atk / 4 SpD / 252 Spe
Jolly Nature
- leafblade
- sacredsword
- smartstrike
- knockoff
 

Mintly

formerly Spook
is an Artist
when Arbok is picked for Gen 7 ZU 1760, it seems to give me this set
Arbok @ wateriumz
Ability: intimidate
EVs: 252 Atk / 4 SpD / 252 Spe
Adamant Nature
- coil
- gunkshot
- suckerpunch
- earthquake


It gives Waterium Z without actually giving it a Water move. I've only seen this on Arbok on 1760, but it could be the case for other Pokemon/Stats. Does it check to make sure it actually gives a Z-Crystal it can use?
 
when Arbok is picked for Gen 7 ZU 1760, it seems to give me this set
Arbok @ wateriumz
Ability: intimidate
EVs: 252 Atk / 4 SpD / 252 Spe
Adamant Nature
- coil
- gunkshot
- suckerpunch
- earthquake


It gives Waterium Z without actually giving it a Water move. I've only seen this on Arbok on 1760, but it could be the case for other Pokemon/Stats. Does it check to make sure it actually gives a Z-Crystal it can use?
The generator doesn't know anything about types, so no, it doesn't check for that. Frankly, it wouldn't be worth the immense amount of effort it would take to teach it about types just so it would know to avoid this kind of thing. There's no usage data linking moves with items available to me at the moment, so when it gives you strange sets, you can just make adjustments to them. If you want to stay as true to the data as possible, though, know that the farther down a move is, the less it's used, so replacing the last move here with the move you want would give you a more statistically average Pokemon than replacing any other move would.
 
Would it be possible to make it compatible with the monotype stats? Each time I try to run 'make_team("2019-09", "gen7monotype-1760", "", "")', I get a server error saying that there's a missing value where TRUE/FALSE is needed in call: "if (strcmpi(current_mon_name, not_this)) next".
 
Attempting to run "make_team("2019-09", "gen3uubl-1760", "", "")" throws
An embedded page a fiddle.jshell.net says
Server error: object 'Electabuzz' not found

In call:
get(current_mon_name, data$data)
even though Electabuzz doesn't appear as a teammate until pretty far down the file.
 

Users Who Are Viewing This Thread (Users: 1, Guests: 0)

Top