BitBully
0.0.78
A fast, perfect-play Connect-4 engine in modern C++
Loading...
Searching...
No Matches
score_all_moves.cpp
1
9
#include <iostream>
10
11
#include "
BitBully.h
"
12
13
int
main
() {
14
BitBully::Board
b;
15
b.
play
(
"4435"
);
// arbitrary mid-game position
16
17
BitBully::BitBully
solver;
18
const
auto
scores = solver.
scoreMoves
(b);
19
20
for
(
int
col = 0; col <
BitBully::Board::N_COLUMNS
; ++col) {
21
if
(b.
isLegalMove
(col)) {
22
std::cout <<
"col "
<< col <<
" -> "
<< scores[col] <<
'\n'
;
23
}
24
}
25
return
0;
26
}
BitBully.h
Connect-4 search engine that operates on BitBully::Board.
BitBully::BitBully
Perfect-play Connect-4 solver.
Definition
BitBully.h:45
BitBully::BitBully::scoreMoves
auto scoreMoves(const Board &b, const int maxDepth=-1)
Evaluate every column move from b.
Definition
BitBully.h:499
BitBully::Board
Connect-4 position represented as a pair of 64-bit bitboards.
Definition
Board.h:204
BitBully::Board::isLegalMove
bool isLegalMove(int column) const
Check whether dropping a stone in column is legal.
Definition
Board.cpp:170
BitBully::Board::play
bool play(int column)
Drop a stone of the player to move into column.
Definition
Board.cpp:137
BitBully::Board::N_COLUMNS
static constexpr int N_COLUMNS
Number of columns in a Connect-4 grid.
Definition
Board.h:211
main
int main(const int argc, const char *const argv[])
Entry point of the benchmark binary.
Definition
main.cpp:108
doxygen_pages
examples
score_all_moves.cpp
Generated by
1.16.1