This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Pokemon Showdown Dex | |
* | |
* Roughly equivalent to sim/dex.js in a Pokemon Showdown server, but | |
* designed for use in browsers rather than in Node. | |
* | |
* This is a generic utility library for Pokemon Showdown code: any | |
* code shared between the replay viewer and the client usually ends up | |
* here. | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def bin_search(L, a): | |
if (len(L) == 1): | |
return "NO" | |
mid = len(L) // 2 | |
if (a < L[mid]): | |
return bin_search(L[:mid], a) | |
elif (a > L[mid]): | |
return bin_search(L[mid:], a) |