-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutil.h
44 lines (37 loc) · 2.04 KB
/
util.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//
// Created by Herman Karlsson on 2017-02-11.
//
#ifndef POKEMON_SIMULATION_UTIL_H
#define POKEMON_SIMULATION_UTIL_H
#include <vector>
#include <iostream>
//type advantages based of https://pokemondb.net/type
double type_diff(int t1, int t2){
static std::vector<std::vector<double>> adv =
{{ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,0.5, 0, 1, 1,0.5, 1},
{ 1,0.5,0.5, 1, 2, 2, 1, 1, 1, 1, 1, 2,0.5, 1,0.5, 1, 2, 1},
{ 1, 2,0.5, 1,0.5, 1, 1, 1, 2, 1, 1, 1, 2, 1,0.5, 1, 1, 1},
{ 1, 1, 2,0.5,0.5, 1, 1, 1, 0, 2, 1, 1, 1, 1,0.5, 1, 1, 1},
{ 1,0.5, 2, 1,0.5, 1, 1,0.5, 2,0.5, 1,0.5, 2, 1,0.5, 1,0.5, 1},
{ 1,0.5,0.5, 1, 2,0.5, 1, 1, 2, 2, 1, 1, 1, 1, 2, 1,0.5, 1},
{ 2, 1, 1, 1, 1, 2, 1,0.5, 1,0.5,0.5,0.5, 2, 0, 1, 2, 2,0.5},
{ 1, 1, 1, 1, 2, 1, 1,0.5,0.5, 1, 1, 1,0.5,0.5, 1, 1, 0, 2},
{ 1, 2, 1, 2,0.5, 1, 1, 2, 1, 0, 1,0.5, 2, 1, 1, 1, 2, 1},
{ 1, 1, 1,0.5, 2, 1, 2, 1, 1, 1, 1, 2,0.5, 1, 1, 1,0.5, 1},
{ 1, 1, 1, 1, 1, 1, 2, 2, 1, 1,0.5, 1, 1, 1, 1, 0,0.5, 1},
{ 1,0.5, 1, 1, 2, 1,0.5,0.5, 1,0.5, 2, 1, 1,0.5, 1, 2,0.5,0.5},
{ 1, 2, 1, 1, 1, 2,0.5, 1,0.5, 2, 1, 2, 1, 1, 1, 1,0.5, 1},
{ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 2, 1,0.5, 1, 1},
{ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1,0.5, 0},
{ 1, 1, 1, 1, 1, 1,0.5, 1, 1, 1, 2, 1, 1, 2, 1,0.5, 1,0.5},
{ 1,0.5,0.5,0.5, 1, 2, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1,0.5, 2},
{ 1,0.5, 1, 1, 1, 1, 2,0.5, 1, 1, 1, 1, 1, 1, 2, 2,0.5, 1}};
#ifdef DEBUG
static std::vector<std::string> types =
{"normal","fire","water","electric","grass","ice","fighting","posion", "ground",
"flying","psychic","bug","rock","ghost","dragon","dark","steel","fairy"};
std::cerr << types[t1] << " -> " << types[t2] << " : " << adv[t1][t2] << std::endl;
#endif
return adv[t1][t2];
}
#endif //POKEMON_SIMULATION_UTIL_H