1. New to the forums? Check out our Mentorship Program!
    Our mentors will answer your questions and help you become a part of the community!
  2. Welcome to Smogon Forums! Please take a minute to read the rules.

Programming Program for massive damage calculations, finding team weaknesses and more

Discussion in 'Technical Projects' started by Pokemonniac, Sep 27, 2010.

  1. WillSO

    WillSO

    Joined:
    Oct 6, 2010
    Messages:
    100
    Nope, I didn't figure that out, nor do I know how to use the program from source code :P
    Tutorial? :P
  2. Pokemonniac

    Pokemonniac

    Joined:
    May 23, 2007
    Messages:
    133
    First you need to install python3. The newest version is 3.2 and for your case you need to download install this: http://python.org/ftp/python/3.2/python-3.2.msi. After you have python installed download unzip the source code file (WeaknessProgram_2011_03_13.zip) and data file (Data1.zip or Data2.zip) in same directory. After that the program should start by just double-clicking the GUI_new file. For more details look at the post #1 and #11. There's also tutorial how to make a shortcut or shortcut-key in the end of post #13.
  3. WillSO

    WillSO

    Joined:
    Oct 6, 2010
    Messages:
    100
    Ahaa fantastic, got it sorted.
    Cheers dude.
    Program is pretty nice, but:
    -finding team weaknesses doesn't work, just closes the program after loading a team.
  4. Pokemonniac

    Pokemonniac

    Joined:
    May 23, 2007
    Messages:
    133
    Could you give more information about this bug in finding team weaknesses because this obviosly should never happen. First you could test it with this test "team"

    Code:
    Arbok @ Choice Band * arbokChoice_band 
    Ability: Intimidate 
    Jolly Nature 
    EVs: 56 HP/ 252 Att/ 0 Def/ 0 SAtk/ 0 SDef/ 200 Speed
    - Gunkhot
    - Earthquak 
    - Crunch
    - Seedbomb 
    
    
    Arcanine @ Life Orb * arcanineMorning_glory 
    Ability: Intimidate 
    Adamant Nature 
    EVs: 120 HP/ 152 Att/ 0 Def/ 0 SAtk/ 0 SDef/ 236 Speed
    - Flareblitz
    - Extremespeed 
    - Heal
    - Toxic 
    
    
    Alakazam @ Choice Specs * alakazamChoice_specs 
    Ability: Synchronize 
    Timid Nature 
    EVs: 4 HP/ 0 Att/ 0 Def/ 252 SAtk/ 0 SDef/ 252 Speed
    - Psychic
    - Signalbeam 
    - Focusblast
    - Trick 
    
    
    Aerodactyl @ Life Orb * aerodactylLife_orb 
    Ability: Pressure 
    Jolly Nature 
    EVs: 0 HP/ 252 Att/ 4 Def/ 0 SAtk/ 0 SDef/ 252 Speed
    - Stoneedge
    - Earthquake 
    - empty move
    - Heal 
    
    
    Articuno @ Leftovers * articunoSupport 
    Ability: Pressure 
    Calm Nature 
    EVs: 252 HP/ 0 Att/ 0 Def/ 0 SAtk/ 252 SDef/ 4 Speed
    - Icebeam    
    - Heal 
    - Roar
    - empty move 
    
    Ariados @ Leftovers * ariadosBaton_pass 
    Ability: Insomnia 
    Jolly Nature 
    EVs: 248 HP/ 0 Att/ 8 Def/ 0 SAtk/ 0 SDef/ 252 Speed
    - empty move
    - empty move 
    - Agility
    - Bugbite 
    This team should first give following warnings:

    Code:
    Move Gunkhot isn't in database
    Move Earthquak isn't in database
    Then it should show how the team was read:
    Code:
    You gave following team
    
    Arbok @ Choice Band * Arbokchoice_band 
    Ability: Intimidate 
    Jolly Nature 
    EVs: 56 HP/ 252 Att/ 0 Def/ 0 SAtk/ 0 SDef/ 200 Speed
    - empty move
    - empty move 
    - Crunch
    - Seedbomb 
    
    Arcanine @ Life Orb * Arcaninemorning_glory 
    Ability: Intimidate 
    Adamant Nature 
    EVs: 120 HP/ 152 Att/ 0 Def/ 0 SAtk/ 0 SDef/ 236 Speed
    - Flareblitz
    - Extremespeed 
    - Heal
    - Toxic 
    
    Alakazam @ Choice Specs * Alakazamchoice_specs 
    Ability: Synchronize 
    Timid Nature 
    EVs: 4 HP/ 0 Att/ 0 Def/ 252 SAtk/ 0 SDef/ 252 Speed
    - Psychic
    - Signalbeam 
    - Focusblast
    - Trick 
    
    Aerodactyl @ Life Orb * Aerodactyllife_orb 
    Ability: Pressure 
    Jolly Nature 
    EVs: 0 HP/ 252 Att/ 4 Def/ 0 SAtk/ 0 SDef/ 252 Speed
    - Stoneedge
    - Earthquake 
    - empty move
    - Heal 
    
    Articuno @ Leftovers * Articunosupport 
    Ability: Pressure 
    Calm Nature 
    EVs: 252 HP/ 0 Att/ 0 Def/ 0 SAtk/ 252 SDef/ 4 Speed
    - Icebeam    
    - Heal 
    - Roar
    - empty move 
    
    Ariados @ Leftovers * Ariadosbaton_pass 
    Ability: Insomnia 
    Jolly Nature 
    EVs: 248 HP/ 0 Att/ 8 Def/ 0 SAtk/ 0 SDef/ 252 Speed
    - empty move
    - empty move 
    - Agility
    - Bugbite 
    
    And then if you calculate the weaknesses for ou tier (gen 5) it should be something like this

    Code:
    for Pokemon        Ferrothornspiker        weakness
    for Pokemon      Tyranitarchoiceband       weakness
    for Pokemon      Tyranitarchoice_band      weakness
    
    ############################################################
    # for Pokemon     Tyranitardragon_dance      huge weakness #
    ############################################################
     
    for Pokemon         Tyranitarlure          weakness
    
    ############################################################
    # for Pokemon         Tyranitarcurse         huge weakness #
    ############################################################
    
    and so on ....
    If this also produces error do this:

    1) Make sure you have saved the team in .txt file
    2) Test also some other editor for example wordpad if you used notepad before
    3) Post results and also tell in what part the failure happened (did it show the team or did it fail in calculation)
    4) Tell also what python version you were using and what operating system. This will help me to reproduce the bug and then I can (hopefully) debug and solve it

    If test team worked:

    1) Make sure you have saved the original team in .txt file
    2) Test also to save the team with other editor for example wordpad if you used notepad before
    3) If this solved the issue please tell what you did originaly "wrong" so I can correct the programs behaviour
    4) If this still doesn't solve the issue, PM me with your team and also tell your python version and what operation system you are using. I then try to reproduce the bug and fix it.
  5. WillSO

    WillSO

    Joined:
    Oct 6, 2010
    Messages:
    100
    Okay, your test team works with the tier selection OU, but when I tested this team:
    Code:
    Glalie (M) @ Lum Berry
    Ability: Inner Focus
    EVs: 248 HP/212 Def/48 Spd
    Bold nature (+Def,-Atk)
    - Explosion
    - Ice Beam
    - Spikes
    - Taunt
    ---
    Regirock @ Leftovers
    Ability: Clear Body
    EVs: 252 HP/36 Atk/220 SpDef
    Careful nature (+SpDef,-SpAtk)
    - Earthquake
    - Rest
    - Rock Slide
    - Stealth Rock
    ---
    Slowking (M) @ Leftovers
    Ability: Own Tempo
    EVs: 252 HP/40 Def/216 SpDef
    Calm nature (+SpDef,-Atk)
    - Grass Knot
    - Slack Off
    - Surf
    - Toxic
    ---
    Vileplume (M) @ Leftovers
    Ability: Chlorophyll
    EVs: 252 HP/4 Def/252 SpDef
    Calm nature (+SpDef,-Atk)
    - Aromatherapy
    - Leech Seed
    - Protect
    - Sludge Bomb
    ---
    Flareon (M) @ Leftovers
    Ability: Flash Fire
    EVs: 252 HP/80 Def/176 SpDef
    Calm nature (+SpDef,-Atk)
    - Lava Plume
    - Protect
    - Roar
    - Wish
    ---
    Dusclops (M) @ Leftovers
    Ability: Pressure
    EVs: 252 HP/36 Atk/220 Def
    Impish nature (+Def,-SpAtk)
    - Earthquake
    - Ice Punch
    - Pain Split
    - Shadow Sneak
    ---
    Under the tiering of 'UU' and hit Submit, the program doesn't do any calculating and simply skips to a plain white screen.

    This also doesn't appear to be compatible with 4th generation - as the weaknesses display 5th gen weaknesses also.

    Also do you remember X-Acts efficient EV calculator?
    Could you implement that feature somewhat into the program?

    Sorry for me being a total noob with this program, thanks for all your help so far.
  6. jaller95

    jaller95

    Joined:
    Apr 12, 2010
    Messages:
    2
    The reason the team doesn't work is because the team isn't following the format exactly. Check post # 29 where Pokemonniac showed you the team to test it on. You have to follow that format. I know it's a lot of work, but it really is useful.
  7. Pokemonniac

    Pokemonniac

    Joined:
    May 23, 2007
    Messages:
    133
    I tested this and it read the team fine. The reason it didn't work is because uu tier isn't not in program yet (because there wasn't smogon uu tier when I made the last update). The 5th gen uu tier is in file uu5.txt you coul edit it manually (look for example file ou5.txt to see the right format). The reason 4th gen uu didn't work is probably because you didn't restart program.

  8. Tomahawk

    Tomahawk Life is like a hurricane
    is a Team Rater Alumnus
    Mentor

    Joined:
    Oct 2, 2010
    Messages:
    2,176
    Okay, this is a pretty cool program.
    The weakness thing is a little flawed though if I am honest. I changed the weakness and large weakness to 50/75 because I had a huge amount of weakness with 39/60 when I entered my chasing cars rmt (in my sig). Even after that, it listed a large weakness for hippowdon_curse, which is weird cause i have taunt skarm, trickscarf hpump rotoma, bronzong and resttalk gyara. It also listed SD luke as a normal weakness while at the same time listing uberSD luke as a large weakness. That's pretty weird, cause the only difference is jolly for uber and adamant for ou. Jolly doesnt outspeed anything on my team adamant doesnt except for rotom after it tricked its scarf away, so that doesnt make sense either. tl;dr: what's the formula you use?

    Don't get me wrong though, this is a pretty cool program as all of its other functions are neat and the searching weakness can still be helpful sometimes. Edit: [​IMG]
  9. Pokemonniac

    Pokemonniac

    Joined:
    May 23, 2007
    Messages:
    133
    ^ The formula for weakness finding is very simple. So the program simulates battle against all of your team members versus the studied Pokemon and for every battle it produces a number that is the HP that is left for winner Pokemon and it is negative if your Pokemon won and positive otherwise. If your Pokemon counters the studied Pokemon this value is -33.3 and if the studied Pokemon counters your team mate the value is 20 (so the weakness value varies between -200 and 120). After that all the numbers are added together and also if your opponent has a Choice item it is divided by 1.5. Then if the studied Pokemon has a stat up move this value is also calculated after the stat up move(s). Then the probability for opponent to get stat up move is estimated and the weakness value is multiplied by this probability.

    Some logic behind these values. Firstly if your Pokemon counters that should be the most dominating value. I wanted that if you have 2 counters the Pokemon should never raise a weakness. This happens now always since in worst case the value would be -33*2 + 20*4 = 14, which is pretty far from weakness. The second condition is that if Pokemon has only one counter it must be able to produce (big) weakness. This also happens since in worst case the value would be -33 + 5*20 = 67 which imo should be big weakness (so I don't recommend moving the big weakness value over 67).

    The program does not take into account many moves that include Taunt, Roar, Spikes, Rapid Spin, Trick. Because of this the program thinks that Hippowdon counters your Skarmory even though the situation is just the opposite which already makes the weakness value 50 too big. Also since Gyarados waterfall does only ~43 % to Hippowdon it makes Hippowdon a Gyarados counter since in program flinches and critical hits never happen.

    I figured out the Lucario bug. I had forgotten to make Choice Scarf give 1.5 speed boost so this has had pretty impact on all teams with choice scarf (at least Tomahawks team seemed to have now much smaller weak list). The bug is now fixed so everyone (using this) should go to download the newest version. Big thanks for Tomahawk for finding this bug and making the program more better.

    Also if anyone else is finding odd behaviour in any modes be sure to report it here. There is very very likely more bugs so if you find them it would be very useful.

    Here is a also some missing features that I think are possibly to implement so if anyone is interesting to help with program you could think solutions for these. You can also help if you don't know how to program since the difficulty for most of these problems are not in technical details but in competitive battling logic.

    1) Hax effects. Flinches, Critical hits happening and moves missing.
    2) Will o Wisp (When to use Will o Wisp?), Thunderwave (When to use Thunderwave?)
    3) How weakness value should change (remember that now it is the winners left HP divided by 6) if winner is left by status condition (currently no effect)
    3) Taunt (When to use Taunt?), Encore (When to use Encore?)
    4) Trick/Roar (If team has Trick/Roar how to determine weakness value for stat-uppers?)
    5) Focus Punch (When to use Focus Punch?)
    6) How to treat Spikes and Toxic Spikes? (With SR it is always up (if you have that option choosen in Preferences) but with these two this would not be very good solution imo)

    For example the solution for the Thunderwave problem (probably the most easiest case) I have been thinking is following:
    1) Never use Twave if opponent is not effected by it
    2) Use Twave if you are slower than your opponent and opponent does not have priority or Taunt and you will be faster after Twave.
    3) Use Twave if you are going to get fainted by next attack and cannot KO opponent with next attack
    4) Use Twave if opponent needs more than 3 moves to knock you out (because of fully paralysis effect)
    5) Use Twave if opponent can do to you max X % damage and you have Recover (or similar move). X ~ 50 %
    6) Else don't use Twave

Users Viewing Thread (Users: 0, Guests: 0)