#include <queue>
#include <stack>
#include <list>
#include <bitset>
#include <pthread.h>
#include "utils.h"
#include "hash.h"
#include "config.h"
Go to the source code of this file.
Classes | |
| class | Soldier |
| Piece on board is a soldier. More... | |
| class | KillInfo |
| Information about a kill in the trap. More... | |
| class | Step |
| One step of a player. More... | |
| class | StepWithKills |
| Step with kills. More... | |
| class | Move |
| Move = list of steps (up to STEP_IN_MOVE). More... | |
| class | Glob |
| Holding global (per thread) variables. More... | |
| class | ContextMove |
| Move with context. More... | |
| class | MoveAdvisor |
| Move advisor. More... | |
| class | Board |
| Board representation. More... | |
Defines | |
| #define | MAX_PIECES 16 |
| max number of pieces per player | |
| #define | MAX_STEPS 80 |
| #define | STEPS_IN_MOVE 4 |
| #define | IS_PLAYER(player) (player == GOLD || player == SILVER) |
| #define | IS_PIECE(piece) ( piece > 0 && piece <= 6) |
| #define | NORTH 8 |
| #define | SOUTH -8 |
| #define | EAST 1 |
| #define | WEST -1 |
| #define | BIT_EMPTY -1 |
| #define | GOLD 0 |
| #define | SILVER 1 |
| #define | NO_PLAYER 2 |
| #define | NO_SQUARE -1 |
| #define | NO_PIECE 0 |
| #define | RABBIT 1 |
| #define | CAT 2 |
| #define | DOG 3 |
| #define | HORSE 4 |
| #define | CAMEL 5 |
| #define | ELEPHANT 6 |
| #define | PIECE_NUM 6 |
| #define | OPP(player) (1 - player) |
| #define | BIT_ON(n) (1ULL << (n)) |
| #define | BIT_LEN 64 |
| #define | SQUARE_NUM 64 |
| #define | SIDE_SIZE 8 |
| #define | RABBITS_NUM 8 |
| #define | STEP_PASS 0 |
| #define | STEP_SINGLE 1 |
| #define | STEP_PUSH 2 |
| #define | STEP_PULL 3 |
| #define | STEP_NULL 4 |
| #define | PLAYER_NUM 2 |
| #define | ROW(square) (square/10) |
| #define | COL(square) (square%10) |
| #define | SQUARE_TO_INDEX_64(square) (8*(ROW(square)-1) + (COL(square)-1)) |
| #define | INDEX_64_TO_SQUARE(index) ((10 * (index/8 + 1)) + ((index % 8) + 1 )) |
| #define | SQUARE_DISTANCE(s1, s2) (abs(s1/8 - s2/8) + abs(s1%8 - s2%8)) |
| #define | OLD_PLAYER_TO_NEW(player) (player == 16 ? GOLD : SILVER) |
| #define | NOT_A_FILE 0xfefefefefefefefeULL |
| #define | NOT_H_FILE 0x7f7f7f7f7f7f7f7fULL |
| #define | NOT_1_RANK 0x00ffffffffffffffULL |
| #define | NOT_8_RANK 0xffffffffffffff00ULL |
| #define | MSB 0x8000000000000000ULL |
| #define | TRAPS 0x0000240000240000ULL |
| #define | FPARITY 0x5555555555555555ULL |
| #define | FULL 0xffffffffffffffffULL |
| #define | EMPTY 0x0ULL |
| #define | IS_TRAP(coord) (BIT_ON(coord) & TRAPS) |
| #define | TRAPS_NUM 4 |
| #define | TRAP_INDEX_TO_TRAP(index) (bits::TRAP_COORDS[index]) |
Typedefs | |
| typedef unsigned long long | u64 |
| typedef int | player_t |
| typedef int | piece_t |
| typedef int | coord_t |
| typedef uint | stepType_t |
| typedef list< Soldier > | SoldierList |
| typedef SoldierList::iterator | SoldierListIter |
| typedef list< Step > | StepList |
| typedef StepList::iterator | StepListIter |
| typedef list< Move > | MoveList |
| typedef MoveList::iterator | MoveListIter |
| typedef vector< Move > | MoveVector |
| typedef MoveVector::iterator | MoveVectorIter |
| typedef Step | StepArray [MAX_STEPS] |
| typedef float | HeurArray [MAX_STEPS] |
| typedef list< int > | intList |
| typedef stack< Board * > | Bpool |
| typedef u64 | Bitboard [2][7] |
| typedef vector< ContextMove > | ContextMoves |
| typedef ContextMoves::iterator | ContextMovesIter |
Enumerations | |
| enum | recordAction_e { ACTION_PLACEMENT, ACTION_STEP, ACTION_TRAP_FALL, ACTION_ERROR } |
| Record action as parsed from the game record (file). More... | |
Functions | |
| void | bits::initZobrist () |
| Init zobrist table. | |
| void | bits::buildStepOffsets () |
| Step offset builder. | |
| u64 | bits::str2bits (string str) |
| String to bits conversion. | |
| int | bits::lix (u64 &b) |
| Left index bit. | |
| int | bits::lixslow (u64 &v) |
| Simpler lix. | |
| int | bits::bitCount (u64 b) |
| Bit count. | |
| int | bits::bitOnOrder (uint index, u64 b) |
| What is the order of given bit among "on" bits in given bitset. | |
| bool | bits::getBit (const u64 &b, int n) |
| Bit getter. | |
| bool | bits::isTrap (coord_t coord) |
| Simple is trap check. | |
| ostream & | bits::print (ostream &o, const u64 &b) |
| Fancy print. | |
| u64 | bits::neighbors (u64) |
| Mask of all neighbors of given bitset. | |
| u64 | bits::neighborsOne (coord_t coord) |
| Mask of neighbors for one piece. | |
| int | bits::neighborsOneNum (coord_t coord, u64 mask) |
| Number of neighbors. | |
| u64 | bits::sphere (int center, int radius) |
| Mask of sphere. | |
| u64 | bits::circle (int center, int radius) |
| Mask of circle. | |
| void | globalStructuresInit () |
| Zobrist and random numbers init;. | |
| bool | parsePieceChar (char pieceChar, player_t &player, piece_t &piece) |
| Parsing piece char (e.g. | |
| string | coordToStr (coord_t at) |
| Coord to string. | |
Variables | |
| u64 | bits::zobrist [2][7][64] |
| const int | bits::TRAP_COORDS [TRAPS_NUM] = {45, 42, 21, 18} |
| u64 | bits::winRank [2] = { 0xff00000000000000ULL ,0x00000000000000ffULL} |
| u64 | bits::stepOffset_ [2][7][64] |
| Glob | glob |
Board representation with all its nuiances is defined here. Main pillar is class Board itself representing board and its manipulation along with move generation, verification and playing.
| enum recordAction_e |
Record action as parsed from the game record (file).
Potential values are: placement in the beginning (e.g. RA1), normal step (e.g. RA1n), trap fall(e.g. Rc3x)
| bool parsePieceChar | ( | char | pieceChar, | |
| player_t & | player, | |||
| piece_t & | piece | |||
| ) |
Parsing piece char (e.g.
R,H,c,m, ... )
1.5.7.1