BitBully
0.0.78
A fast, perfect-play Connect-4 engine in modern C++
Loading...
Searching...
No Matches
quick_solve.cpp
1
11
#include <iostream>
12
13
#include "
BitBully.h
"
14
15
int
main
() {
16
BitBully::Board
b;
17
if
(!b.
play
(
"4435"
)) {
18
std::cerr <<
"Illegal move sequence\n"
;
19
return
1;
20
}
21
22
BitBully::BitBully
solver;
23
const
int
score = solver.
mtdf
(b,
/*firstGuess=*/
0);
24
const
int
plies =
BitBully::BitBully::scoreToMovesLeft
(score, b);
25
26
std::cout << b.
toString
();
27
std::cout <<
"score = "
<< score <<
" (plies until end = "
<< plies <<
")\n"
;
28
return
0;
29
}
BitBully.h
Connect-4 search engine that operates on BitBully::Board.
BitBully::BitBully
Perfect-play Connect-4 solver.
Definition
BitBully.h:45
BitBully::BitBully::scoreToMovesLeft
static int scoreToMovesLeft(const int score, const Board &b) noexcept
Convert a solver score to the number of moves until the game ends.
Definition
BitBully.h:115
BitBully::BitBully::mtdf
int mtdf(const Board &b, const int firstGuess, const int maxDepth=-1) noexcept
Solve a position using the MTD(f) driver.
Definition
BitBully.h:188
BitBully::Board
Connect-4 position represented as a pair of 64-bit bitboards.
Definition
Board.h:204
BitBully::Board::play
bool play(int column)
Drop a stone of the player to move into column.
Definition
Board.cpp:137
BitBully::Board::toString
std::string toString() const
Pretty-printed ASCII representation of the board.
Definition
Board.cpp:481
main
int main(const int argc, const char *const argv[])
Entry point of the benchmark binary.
Definition
main.cpp:108
doxygen_pages
examples
quick_solve.cpp
Generated by
1.16.1