1#ifndef __REVERSI_INCLUDE_REVERSI_H__
2#define __REVERSI_INCLUDE_REVERSI_H__
12#define _REV_EXTERN __declspec(dllexport) extern
14#define _REV_EXTERN __attribute__((visibility("default"))) extern
18#define _REV_ENUM(s) typedef unsigned int s; enum
21#define REV_VERSION "0.1.0"
22#define REV_VERSION_INT 100
int revXYToPos(int x, int y)
Returns x + y * 8.
void revInitGenRandom(uint32_t seed)
Initialize a random number generator.
int revCountOnes(RevBitboard b)
Counts number of positive bits in a bitboard.
int revGetVersionAsInt()
Gets the version of reversi-core as an integer.
#define _REV_ENUM(s)
Definition: reversi.h:18
uint64_t RevBitboard
Type for a bitboard.
Definition: reversi.h:46
const char * revGetVersion()
Gets the version of reversi-core.
int revIsTrueAt(RevBitboard b, int pos)
Returns a bit of a bitboard.
int * revBitboardToArray(RevBitboard b)
Converts a bitboard to an array of positions.
RevDiskType
Color of disk.
Definition: reversi.h:117
@ DISK_BLACK
Black disk.
Definition: reversi.h:118
@ DISK_WHITE
White disk.
Definition: reversi.h:119
@ DISK_NONE
Empty.
Definition: reversi.h:120
int revIsTrueAtXY(RevBitboard b, int x, int y)
Returns a bit of a bitboard.
int revCountFirstZeros(RevBitboard b)
Counts leading zeros of a bitboard.
int revGenIntRandom(int min, int max)
Generates a random integer with the mersenne twister.
RevBitboard revArrayToBitboard(int *array, int size)
Creates a bitboard from an array of positions.
Class for a reversi board.
void revMoveRandomToEnd(RevBoard *board)
Plays the game to the end randomly.
RevBitboard revMoveXY(RevBoard *board, int x, int y)
Flips disks, changes the current player, and calculates mobility.
void revFreeBoard(RevBoard *board)
Frees the memory of a board object.
void revSetDiskXY(RevBoard *board, RevDiskType disk_type, int x, int y)
Sets a disk on a board.
int revCountDisks(RevBoard *board, RevDiskType disk_type)
Gets the number of disks on a board for a player.
void revPrintBoard(RevBoard *board)
Outputs a board to stdout.
RevDiskType revGetDisk(RevBoard *board, int pos)
Gets a disk on a board.
int revGetMobilityCount(RevBoard *board)
Gets the number of legal moves for the current player.
void revPrintBoardWithMobility(RevBoard *board)
Outputs a board with mobility to stdout.
void revChangePlayer(RevBoard *board)
Changes the current player to the opposite player.
int revIsLegalMove(RevBoard *board, int pos)
Returns whether or not a move is legal.
void revUpdateMobility(RevBoard *board)
Calculates mobility of the current player.
RevBitboard revGetBitboard(RevBoard *board, RevDiskType disk_type)
Gets a bitboard of a player.
void revCopyBoard(RevBoard *src, RevBoard *trg)
Deep copy for board objects.
int * revGetBitboardAsArray(RevBoard *board, RevDiskType disk_type)
Gets a bitboard as an array of positions on a bitboard.
RevDiskType revGetWinner(RevBoard *board)
Returns which player has more disks on a board.
void revInitBoard(RevBoard *board)
Initializes a board with the fixed four disks.
int revGenMoveRandom(RevBoard *board)
Generates a random move.
int * revGetMobilityAsArray(RevBoard *board)
Gets mobility of the current player as an array of integers.
int revHasLegalMoves(RevBoard *board)
Returns whether or not the current player has legal moves.
void revSetBitboard(RevBoard *board, RevDiskType disk_type, RevBitboard b)
Sets a bitboard of a player.
RevBitboard revMove(RevBoard *board, int pos)
Flips disks, changes the current player, and calculates mobility.
int revIsLegalMoveXY(RevBoard *board, int x, int y)
Returns whether or not a move is legal.
void revSetDisk(RevBoard *board, RevDiskType disk_type, int pos)
Sets a disk on a board.
RevBoard * revNewBoard()
Creates a new board.
RevDiskType revGetDiskXY(RevBoard *board, int x, int y)
Gets a disk on a board.
RevBitboard revGetMobility(RevBoard *board)
Gets mobility of the current player as a bitboard.
int revGenMoveMonteCarlo(RevBoard *board, int trials)
Calls revMoveRandomToEnd() many times for each legal move, and returns the best move that has the hig...
RevDiskType revGetCurrentPlayer(RevBoard *board)
Gets the current player.