1. Welcome to Smogon Forums! Please take a minute to read the rules.
2. Click here to ensure that you never miss a new SmogonU video upload!

# Breeding Probability Calculator

Discussion in 'Stark Mountain' started by Jiggy-Ninja, Jan 22, 2008.

Not open for further replies.
1. ### Jiggy-Ninja

Joined:
Jan 20, 2008
Messages:
401
Note: This program was written on Microsoft Visual Basic Express Edition 2008, so it will not work at all on Macintosh computers. Sorry to all those who use them. In addition, you may need to download and install .NET 3.5 (found here).

This is a program I created to determine the odds of breeding Pokemon. It's quite a bit different from X-Act's since you have a greater degree of control. Instead of 0-30 or 31 for a parent's IV, you input the exact value. Instead of 0-30 or 31 for the Baby's IV, you decide on the exact range you want. Also, you can specify a set of Hidden Power types and a minimum power for your baby to have.

To calculate IVs, I used some variation on the Permutation Counting Principles. Calculating just IVs was fairly straightforward, but I was at a loss at how to incorporate Hidden Powers. In the end, I had my program generate a bunch of text files in the directory "C:\Jiggy's Breeding Calculator\Pokemon\Hidden Power Information" to hold the information needed to calculate with Hidden Powers.

Here's the program. Enjoy!!!

And for anyone that is curious about how it works or would like to try and improve it, here's the source code.

EDIT: Here's an updated version that is much faster. http://www.mediafire.com/download.php?uwwinm19u9g
2. ### X-Actnp: Biffy Clyro - Shock Shock

Joined:
Feb 17, 2006
Messages:
4,675
The source code link is linking me to the same link as the program.

Joined:
Oct 21, 2007
Messages:
1,698
4. ### X-Actnp: Biffy Clyro - Shock Shock

Joined:
Feb 17, 2006
Messages:
4,675
Not that link, the source code...
5. ### kamikaen

Joined:
Jul 17, 2007
Messages:
1,755
Wow, this is great, It even does Hidden Power types! It's always nice to know your chances, and how much, say, spending time on a better egg move parent would help you.
6. ### Jiggy-Ninja

Joined:
Jan 20, 2008
Messages:
401
Sorry, I fixed it.

Also, I forgot to mention. When using Hidden Powers, don't select too many of them at once or it could take a very long time to do the calculations.
7. ### Ouro

Joined:
Feb 23, 2007
Messages:
1,709
Great app. I must say the options it provides are awesome.

edit: OH even more features than I saw. This is kick ass dude. So many percentages!
8. ### SundayGod Bless Nintys Incompetence :*)

Joined:
Aug 16, 2007
Messages:
5,387
The chances of me breeding my perfect Gible are depressingly low ;_; (0.3%)
Still, great calc! Love it.
9. ### Jiggy-Ninja

Joined:
Jan 20, 2008
Messages:
401
Oh boy...

I tried rewriting the code in this a little to try and break the reliance on text files, and here's what I got on the first test run.
FUCK!! Now I have to track down a logic error.

>.<

EDIT: Well, I tracked down the logic error. It always amazes me how much 5 lines of missing code can fuck everything up.

Anyway, as I said the primary reason for this rewrite was to potentially speed it up. I did succeed in removing the need for te text files. And I must say, comparing the speed of this new version to the old one is like Speedy Gonzalas vs Slow-Poke Joe. I swear, this thing is FAST!! I ran a test using a couple Hidden Powers, hit the Start button, and looked at the progress bar to see how fast it went. Nothing. I though, "Damn, did it freeze or something?" Looked at the output text box..."Holy shit, it's already done?!?!"

I'd estimate it's at least a couple hundred times faster now. I guess shineyaltaria was right when he said that System.IO was slow.

There's a couple more things I want to redo, so I'll upload the new version soon.
10. ### Pim

Joined:
Nov 25, 2007
Messages:
142
Great job! Lovely features and even Hidden Power :D (I tried this myself, but I failed miserably, due to my lack of knowledge in both probabilities and programming xD)
11. ### Anti

Joined:
Jul 2, 2007
Messages:
5,021
This a fantastic calculator. I use X-Act's all the time, and now I still do just when I want a quick calc. Something I've wondered about both of them, though, were: does it factor in the chances of fluking the IV you want (e.g 31) or is it just the chance for the IV to pass down?
12. ### Pim

Joined:
Nov 25, 2007
Messages:
142
Yes, they do. (Otherwise a baby with 4 required IV's would have a chance of 0%, because at least 1 has to be generated randomly, due to the fact that you can only inherit 3 IV's at the same time.)
13. ### ToothacheLet the music play!

Joined:
Dec 27, 2004
Messages:
3,730
Very useful calculator, has everything practical that I can think of. Interesting to note that random natures don't always have an equal value, something I'd suspected before but never realised.
14. ### Jiggy-Ninja

Joined:
Jan 20, 2008
Messages:
401
Hidden Power was a bit of a bitch to figure out, but it wasn't that hard. Really the biggest hurdle in making this was the fact that there are 1,030,792,151,040 different combinations of inheritance + randomly generated IVs. It took a while to find out how to reduce that number down to something more manageable. Now, it loops through the main programming 960 times, with quite a few smaller loops in the middle.

Thank you Permutation Counting Principle!
Yes, it does. It factored in everything I could think of.
Huh? Care to expand on that?
15. ### kamikaen

Joined:
Jul 17, 2007
Messages:
1,755
I've been using this program a fair bit recently, but I've noticed that sometimes, the output varies slightly, even if I don't change any information, and just hit "simulate" again. Is this normal?

And, yeah, I realize that this thread is old, but I don't think there would be another place to post this, and I also think that people might not mind seeing this. ;) Is a +1 "necro'd" post really necessary?
16. ### DemonOfWrath

Joined:
Sep 13, 2007
Messages:
90
It would vary because it goes through about 10,000 babies from the information entered, so it determines the result from 'actual' results and not from pure theory (as in the program would be flipping a coin 10 times to determine the chance of heads/tails instead of using pure mathematics to determe the chance).
17. ### Jiggy-Ninja

Joined:
Jan 20, 2008
Messages:
401
Somehow you got my very first version. That one went through 1,000 babies and checked if they were good or bad.

I changed it a while ago to use Permutation Counting Principles to determine a mathematicla probability. Try this version. It should be better and much faster.

BTW, for anyone using my calculator, I'd recommend downloading that version. It's much faster than the previous one.
18. ### Ouro

Joined:
Feb 23, 2007
Messages:
1,709
I've got a question about the results of probability when including Hidden Power. Sometimes when I input the probability for getting offspring with Hidden Power 70 I get no results but when I try it with lets say Ice 45 I get results. Is the calculator supposed to work so that it won't give any displays when the desired results are unobtainable or is there a malfunction with mine?
19. ### Jiggy-Ninja

Joined:
Jan 20, 2008
Messages:
401
Which version are you using? Did yu just download it, or did you download it earlier?
20. ### Chronos

Joined:
Dec 5, 2007
Messages:
1,498
This is really cool, Jiggy.
21. ### Ouro

Joined:
Feb 23, 2007
Messages:
1,709
I used the earlier version. I have yet to try the newer version.
22. ### Jiggy-Ninja

Joined:
Jan 20, 2008
Messages:
401
If you are still having the problem, I need to know

a) Exactly what you are putting into the calculator
b) exactly what happens
23. ### hexatron

Joined:
Dec 19, 2007
Messages:
223
Thanks, at least now I know I have nearly no chance of getting a good Espeon, but at least now I know not to get my hopes up...

Joined:
Aug 9, 2007
Messages:
4,999
Fuck, it's not for Mac!
25. ### Jiggy-Ninja

Joined:
Jan 20, 2008
Messages:
401
I recently started experimenting with Visual Web Developer, so depending on how that goes I might be able to make a Web based version of this, meaning Macs might be able to use it as well.

If that doesn't work, I can always try JavaScript or something.