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
13int main() {
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}
Connect-4 search engine that operates on BitBully::Board.
Perfect-play Connect-4 solver.
Definition BitBully.h:45
auto scoreMoves(const Board &b, const int maxDepth=-1)
Evaluate every column move from b.
Definition BitBully.h:499
Connect-4 position represented as a pair of 64-bit bitboards.
Definition Board.h:204
bool isLegalMove(int column) const
Check whether dropping a stone in column is legal.
Definition Board.cpp:170
bool play(int column)
Drop a stone of the player to move into column.
Definition Board.cpp:137
static constexpr int N_COLUMNS
Number of columns in a Connect-4 grid.
Definition Board.h:211
int main(const int argc, const char *const argv[])
Entry point of the benchmark binary.
Definition main.cpp:108