Xiangiqgame
AI engine for Xiangqi
Loading...
Searching...
No Matches
piece_position_points.cpp
Go to the documentation of this file.
1
3
6#include <unordered_map>
8
9using namespace std;
10using namespace gameboard;
11using namespace piecepoints;
12
13
14
16 : points_array{BPOPointsSKeys(kICGABPOPath).ToGamePointsArray()} {}
17
19 : points_array{game_points_array} {}
20
22 : points_array{bpo_points_ekeys.ToGamePointsArray()} {}
23
25 : points_array{bpo_points_skeys.ToGamePointsArray()} {}
26
28 : points_array{BPOPointsSKeys(json_file).ToGamePointsArray()} {}
29
31 TeamPointsEMap_t team_map;
32 for (auto piece_idx = 0; piece_idx < kNumPieceTypeVals; piece_idx++) {
33 team_map[static_cast<PieceType>(piece_idx)] = team_array[piece_idx];
34 }
35 return team_map;
36}
37
39 GamePointsEMap_t pts_map;
40 for (auto zcolor_idx = 0; zcolor_idx < points_array.size(); zcolor_idx++) {
41 pts_map[GetPieceColorOf(zcolor_idx)] = TeamPointsArrayToEMap(points_array[zcolor_idx]);
42 }
43 return pts_map;
44}
45
47 auto e_map = PointsArraytoEMap();
48 GamePointsSMap_t game_string_map;
49
50 for (auto color : kPieceColorStringToEnum) {
51 if (e_map.contains(color.second)) {
52 game_string_map[color.first] = utility_functs::replace_keys_reverse(
53 e_map[color.second],
55 );
56 }
57 }
58 return game_string_map;
59}
Definitions of classes used for storing piece points in Base Points Offset form.
Piece Points spec in "Base Points Offset" form with PieceType enum keys in member unordered_map objec...
Piece Points spec in "Base Points Offset" form with string keys in member unordered_map objects for e...
Tracking piece positions and determining legal moves.
PieceColor GetPieceColorOf(size_t zcolor_index)
Definition: game_piece.hpp:81
const unordered_map< string, PieceType > kPieceTypeStringToEnum
Definition: game_piece.hpp:25
const int kNumPieceTypeVals
Definition: game_piece.hpp:23
const unordered_map< string, PieceColor > kPieceColorStringToEnum
Definition: game_piece.hpp:68
Providing position-dependent values of pieces to objects in moveselection namespace.
array< TeamPointsArray_t, 2 > GamePointsArray_t
unordered_map< gameboard::PieceType, PiecePointsArray_t > TeamPointsEMap_t
const string kICGABPOPath
unordered_map< gameboard::PieceColor, TeamPointsEMap_t > GamePointsEMap_t
array< PiecePointsArray_t, gameboard::kNumPieceTypeVals > TeamPointsArray_t
unordered_map< string, TeamPointsSMap_t > GamePointsSMap_t
unordered_map< ToKey, Value > replace_keys_reverse(unordered_map< FromKey, Value > orig_map, unordered_map< ToKey, FromKey > key_substitutions)
Definition of piecepoints::PiecePositionPoints.
static TeamPointsEMap_t TeamPointsArrayToEMap(TeamPointsArray_t team_array)
Defiition of miscellaneous free functions (and implementation of those that are templates).