unownhash / gohbem Goto Github PK
View Code? Open in Web Editor NEWPvP Companion
License: Apache License 2.0
PvP Companion
License: Apache License 2.0
Add config to make tied ranking optional. Why?
It would be preferred to have info logs sent to stdout and only errors logged to stderr.
As discussed, Gohbem seems to be creating duplicate ranks, specifically for Koffing:
{
"great": [
{
"pokemon": 110,
"form": 706,
"cap": 50,
"value": 1836309,
"level": 23,
"cp": 1479,
"percentage": 0.95009,
"rank": 1731,
"capped": true
},
{
"pokemon": 110,
"form": 944,
"cap": 50,
"value": 1836309,
"level": 23,
"cp": 1479,
"percentage": 0.95009,
"rank": 1731,
"capped": true
},
{
"pokemon": 110,
"form": 944,
"cap": 50,
"value": 1836309,
"level": 23,
"cp": 1479,
"percentage": 0.95009,
"rank": 1731,
"capped": true
},
{
"pokemon": 110,
"form": 944,
"cap": 50,
"value": 1836309,
"level": 23,
"cp": 1479,
"percentage": 0.95009,
"rank": 1731,
"capped": true
}
],
"ultra": [
{
"pokemon": 110,
"form": 706,
"cap": 50,
"value": 4028491,
"level": 48.5,
"cp": 2500,
"percentage": 0.99239,
"rank": 13
},
{
"pokemon": 110,
"form": 706,
"cap": 51,
"value": 4028491,
"level": 48.5,
"cp": 2500,
"percentage": 0.98497,
"rank": 56
},
{
"pokemon": 110,
"form": 944,
"cap": 50,
"value": 4028491,
"level": 48.5,
"cp": 2500,
"percentage": 0.99239,
"rank": 13
},
{
"pokemon": 110,
"form": 944,
"cap": 51,
"value": 4028491,
"level": 48.5,
"cp": 2500,
"percentage": 0.98497,
"rank": 56
},
{
"pokemon": 110,
"form": 944,
"cap": 50,
"value": 4028491,
"level": 48.5,
"cp": 2500,
"percentage": 0.99239,
"rank": 13
},
{
"pokemon": 110,
"form": 944,
"cap": 51,
"value": 4028491,
"level": 48.5,
"cp": 2500,
"percentage": 0.98497,
"rank": 56
},
{
"pokemon": 110,
"form": 944,
"cap": 50,
"value": 4028491,
"level": 48.5,
"cp": 2500,
"percentage": 0.99239,
"rank": 13
},
{
"pokemon": 110,
"form": 944,
"cap": 51,
"value": 4028491,
"level": 48.5,
"cp": 2500,
"percentage": 0.98497,
"rank": 56
}
]
}
These results compare RDM PVP vs Ohbem GO pvp. The results with Ohbem JS are the same as RDM PVP.
Guide:
pokemon_id
Atk
Def
Sta
Level
pokemon_id
Rank
Cp
Level/cap
Spheal
363
4
14
14
1
365
3
500
7
====================
Poliwag
60
11
15
15
24
62
3
2497
39/40
====================
Pikachu - winter 2020
25
1
15
15
16
25
1
500
21
====================
Bidoof
399
0
15
14
6
400
1
499
10.5
400
2
1498
33
RDM
{
"little": [
{
"dense_rank": 23,
"cap": 40,
"rank": 32,
"ordinal_rank": 33,
"cp": 493,
"form": 1667,
"gender": 1,
"pokemon": 399,
"percentage": 0.982754803145974,
"capped": true,
"competition_rank": 32,
"level": 28.5
},
{
"cap": 40,
"capped": true,
"pokemon": 400,
"percentage": 1.0,
"cp": 499,
"rank": 1,
"gender": 1,
"level": 10.5,
"competition_rank": 1,
"dense_rank": 1,
"ordinal_rank": 2,
"form": 1670
}
],
"great": [
{
"cp": 1498,
"dense_rank": 2,
"cap": 40,
"capped": true,
"percentage": 0.9995893471107288,
"gender": 1,
"ordinal_rank": 2,
"form": 1670,
"competition_rank": 2,
"pokemon": 400,
"level": 33.0,
"rank": 2
}
]
}
Golbat
{}
Golbat settings:
[pvp]
enabled = true
include_hundos_under_cap = false
level_caps = [40, 50, 51]
[[pvp.leagues]]
name = "little"
cap = 500
little = false
[[pvp.leagues]]
name = "great"
cap = 1500
little = false
[[pvp.leagues]]
name = "ultra"
cap = 2500
little = false
RDM
PVP_DEFAULT_RANK: competition
PVP_LITTLE_FILTER: 500
PVP_GREAT_FILTER: 1500
PVP_ULTRA_FILTER: 2500
PVP_LEVEL_CAPS: 40,50,51
capped
value for CalculateTopRanks
results is not set correctly.
TL;DR
QueryPvPRank
is 5
times faster than node with disabled cache.QueryPvPRank
is 10
times faster than node with enabled cache.# OhbemGo 0.7.3
# Ohbem 1.4.1
# cpu: 12th Gen Intel(R) Core(TM) i9-12900KF
$ go version
go version go1.19.4 linux/amd64
$ node --version
v16.14.0
$ time ./main # cache disabled ; maxPokemonId = 2
QueryPvPRank iterated 13068 in 1m23.355235694s
real 1m23.406s
user 1m29.580s
sys 0m4.767s
$ time ./main # cache enabled ; maxPokemonId = 200
QueryPvPRank iterated 1306800 in 3.821691967s
real 0m3.898s
user 0m4.094s
sys 0m0.315s
$ time node main.js # cache disabled ; maxPokemonId = 2
queryPvPRank iterated 13068 in 418771ms
real 6m58.854s
user 7m7.976s
sys 0m17.332s
$ time node main.js # cache enabled ; maxPokemonId = 200
queryPvPRank iterated 1306800 in 38922ms
real 0m39.038s
user 0m46.019s
sys 0m3.972s
main.js
const Ohbem = require('ohbem');
const pokemonData = require('./master-test.json');
async function test() {
const ohbem = new Ohbem({
leagues: {
little: {
little: false,
cap: 500,
},
great: {
little: false,
cap: 1500,
},
ultra: {
little: false,
cap: 2500,
},
master: null,
},
levelCaps: [40, 50, 51],
pokemonData,
cachingStrategy: Ohbem.cachingStrategies.balanced // change
});
const maxPokemonId = 200; // change
const maxAttack = 10;
const maxDefense = 5;
const maxStamina = 10;
const maxLevel = 5;
let counter = 0;
const start = Date.now();
for (let p = 1; p <= maxPokemonId; p++) {
for (let a = 0; a <= maxAttack; a++) {
for (let d = 0; d <= maxDefense; d++) {
for (let s = 0; s <= maxStamina; s++) {
for (let l = 1; l <= maxLevel; l += 0.5) {
ohbem.queryPvPRank(p, 0, 0, 0, a, d, s, l);
counter++;
}
}
}
}
}
const elapsed = Date.now() - start;
console.log(`queryPvPRank iterated ${counter} in ${elapsed}ms`);
}
test();
main.go
package main
import (
"fmt"
"github.com/Pupitar/ohbemgo"
"time"
)
func mainOne() {
var leagues = map[string]ohbemgo.League{
"little": {
Cap: 500,
LittleCupRules: false,
},
"great": {
Cap: 1500,
LittleCupRules: false,
},
"ultra": {
Cap: 2500,
LittleCupRules: false,
},
"master": {
Cap: 0,
LittleCupRules: false,
},
}
levelCaps := []int{40, 50, 51}
ohbem := ohbemgo.Ohbem{Leagues: leagues, LevelCaps: levelCaps, DisableCache: false} // change
_ = ohbem.LoadPokemonData("master-test.json")
const (
maxPokemonId = 200 // change
maxAttack = 10
maxDefense = 5
maxStamina = 10
maxLevel = 5
)
var counter uint
start := time.Now()
for p := 1; p <= maxPokemonId; p++ {
for a := 0; a <= maxAttack; a++ {
for d := 0; d <= maxDefense; d++ {
for s := 0; s <= maxStamina; s++ {
for l := 1.0; l <= maxLevel; l = l + 0.5 {
ohbem.QueryPvPRank(p, 0, 0, 0, a, d, s, l)
counter++
}
}
}
}
}
elapsed := time.Since(start)
fmt.Printf("QueryPvPRank iterated %d in %s\n", counter, elapsed)
func main() {
mainOne() // bench go
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.