#include <stdlib.h>
#include <stdint.h>
Go to the source code of this file.
◆ _REV_ENUM
#define _REV_ENUM |
( |
|
s | ) |
typedef unsigned int s; enum |
◆ REV_VERSION
#define REV_VERSION "0.1.0" |
◆ REV_VERSION_INT
#define REV_VERSION_INT 100 |
◆ RevBitboard
Type for a bitboard.
It's actually a 64bit uint.
◆ RevBoard
◆ RevDiskType
◆ RevDiskType
Color of disk.
Enumerator |
---|
DISK_BLACK | Black disk.
|
DISK_WHITE | White disk.
|
DISK_NONE | Empty.
|
◆ revArrayToBitboard()
RevBitboard revArrayToBitboard |
( |
int * |
array, |
|
|
int |
size |
|
) |
| |
Creates a bitboard from an array of positions.
- Parameters
-
array | An array of positions on a bitboard. |
size | The size of the array. |
- Returns
- A bitboard.
◆ revBitboardToArray()
Converts a bitboard to an array of positions.
- Note
- Arrays that are returned from this method should be freed with free().
- Parameters
-
- Returns
- An array of positions on a bitboard. The size of the array is equal to revCountOnes(b).
◆ revCountFirstZeros()
Counts leading zeros of a bitboard.
- Note
- This method returns 64 when the input is zero.
- Parameters
-
- Returns
- Number of leading zeros of a bitboard.
◆ revCountOnes()
Counts number of positive bits in a bitboard.
- Parameters
-
- Returns
- Number of positive bits in a bitboard.
◆ revGenIntRandom()
int revGenIntRandom |
( |
int |
min, |
|
|
int |
max |
|
) |
| |
Generates a random integer with the mersenne twister.
- Note
- This method requires revInitGenRandom() before calling.
- Parameters
-
min | The lowest value to return. |
max | The highest value to return. |
- Returns
- A pseudo random value between min and max.
◆ revGetVersion()
const char * revGetVersion |
( |
| ) |
|
Gets the version of reversi-core.
It should be of the form x.x.x
.
- Returns
- A string that represents the version.
◆ revGetVersionAsInt()
int revGetVersionAsInt |
( |
| ) |
|
Gets the version of reversi-core as an integer.
The value should be major * 100 + minor * 100 + patch
. If revGetVersion() == "1.2.3"
then revGetVersionAsInt() == 10203
.
- Returns
- An integer that represents the version.
◆ revInitGenRandom()
void revInitGenRandom |
( |
uint32_t |
seed | ) |
|
Initialize a random number generator.
- Parameters
-
seed | seed of a random number generator. |
◆ revIsTrueAt()
Returns a bit of a bitboard.
- Parameters
-
b | RevBitboard instance |
pos | a position on a bitboard. pos = x + y * 8 |
- Returns
- A bit of a bitboard.
◆ revIsTrueAtXY()
Returns a bit of a bitboard.
- Parameters
-
b | RevBitboard instance |
x | x-coordinate on a board. |
y | y-coordinate on a board. |
- Returns
- A bit of a bitboard.
◆ revXYToPos()
int revXYToPos |
( |
int |
x, |
|
|
int |
y |
|
) |
| |
Returns x + y * 8.
- Parameters
-
x | x-coordinate on a board. |
y | y-coordinate on a board. |
- Returns
- a position on a bitboard.