PokéBase - Pokémon Q&A
3 votes
That pretty much constitutes an answer right there ^
Do you think I should post this as an answer?
It's pretty solid, just be sure to link to a page that has some info on the computer programming. Just in case people want to verify what you're saying.
Yeah I'd really like to see a link.
I'm under the impression Binary Slicing is a technique used in Photography, without relation to programming :I

None of my friends who do Software Design and Development seem to know wtf it is either :P
I think I got the wrong name for it, because I can't find it anywhere on the internet. It was my uncle who told me about it, so I guess its his fault.

2 Answers

6 votes
Best answer

Here's Pokemon Showdown's random battle generator: https://github.com/Zarel/Pokemon-Showdown/blob/d3ca5253bf5157b59004ae3a61496ecc10140824/mods/gen5/scripts.js

It seems to pick random moves from the viable moves list, and keeps track of the amount of damaging and status moves. It also has some things to make moves usable, for example only use Sleep Talk if Rest is generated.

The levels are set for each tier, like so:

        LC: 95,
		NFE: 90,
		'LC Uber': 86,
		NU: 86,
		BL3: 84,
		RU: 82,
		BL2: 80,
		UU: 78,
		BL: 76,
		OU: 74,
		CAP: 74,
		Unreleased: 74,
		Uber: 70

The EVs are 85 for all stats, and IVs are 31 for each stat.
It also has something to filter more than 2 of each type, and 1 for any type combination.

Past this, it has a counter for Uber and LC, NFE and NU pokes respectively (uber is one counter and the rest are another).

This tries to limit the amount of Ubers and NUs on one team to promote "fun":
LC Pokemon have a hard limit in place at 2; NFEs/NUs/Ubers are also limited to 2 but have a 20% chance of being added anyway.

		 LC/NFE/NU Pokemon all share a counter (so having one of each would make the counter 3), while Ubers have a counter of their own. ~Zarel

For the pokes themselves, a random number is most likely generated and the poke with the pokedex position of that number is selected.

selected by
Who's zarel btw?
He's they guy that made Showdown.
Zarel's the guy who originally made PS.
He basically owns it.
I got a Rotom-Fan with Levitate. Nothing special. But then it has an Air Balloon. And I got it twice. Then I get a Magikarp, then a Sunkern, or a Feebas. The next battle I have 3 legendaries and Megas. So, it's pretty random
} else if (template.species === 'Rotom-Fan') {
                // this is just to amuse myself
                item = 'Air Balloon';

From Zarel's coding.
ie. Rotom-F will ALWAYS have Air Balloon.
1 vote

For a random Pokemon to be chosen, you need to choose a random number between 1 and 718 (the amount of Pokemon). But for a computer to pick a completely random number is impossible. But there are some meathods of choosing almoast random numbers:

  • Pseudo-random number generators are algorithms that create a number that appears to be random, but is infact not. They make numbers by using a seed, a number that always stays the same, and then involving the seed in a certain equation. The answer is the 'random' number. Then the equation changes by a certain amount, and it does it again to create another seemingly random number, and again, and again, and until in this case there are 12 random numbers, and the program finds out which Pokemon each number referes to through the pokedex. And then you have your random teams.

This isn't always the best method, but it can be improved by using the time as the seed. This makes it much more random, and this is probably the method showdown (and other things that rely on random numbers) uses.

Another method is the one I explain as a comment on the question. I'm not sure what its called so I can't look it up more.

  • Physical methods are more methods used to get a random number, which use things in real life to make a random number. A good example is using a piece of decaying radioactive material, and putting it in front of a Geiger counter. Because the radioactivity of decaying radioactive material is random, this can be used if you somehow plug a Geiger counter into a computer and divide it so its a number between 1 and 718. But I doubt showdown does this somehow.

So there you have it! Some methods computers use to choose random numbers. Showdown probably uses the first one, and uses the time as the seed, because there are a lot of people doing random battles on showdown, and they need to make it really random.

Sources: http://en.wikipedia.org/wiki/Random_number_generation#Generation_methods and my uncle telling me this un-named method of random number generation which he claims to be called binary slicing, but apparently that's something else.