-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
71 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/bash | ||
cd ../ && cmake -B build && cmake --build build --target preflop_all_in_bot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"build": ["bash", "build.sh"], | ||
"run": ["bash", "run.sh"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#include "src/actions.h" | ||
#include "src/ranges_utils.h" | ||
#include "src/runner.h" | ||
#include "src/states.h" | ||
|
||
using namespace pokerbot; | ||
|
||
struct PreflopAllInBot { | ||
void handle_new_hand(const GameInfo& /*game_info*/, const RoundStatePtr& /*round_state*/, | ||
int /*active*/) {} | ||
|
||
void handle_hand_over(const GameInfo& /*game_info*/, const TerminalStatePtr& /*terminal_state*/, | ||
int /*active*/) {} | ||
|
||
Action get_action(const GameInfo& /*game_info*/, const RoundStatePtr& round_state, | ||
int /*active*/) { | ||
auto legal_actions = round_state->legal_actions(); | ||
auto min_stack = round_state->effective_stack(); | ||
|
||
if (legal_actions.size() == 1) { | ||
// Bid and check once we're all-in | ||
return {legal_actions.front()}; | ||
} | ||
|
||
if (ranges::contains(legal_actions, Action::Type::RAISE)) { | ||
return {Action::Type::RAISE, min_stack}; | ||
} | ||
if (ranges::contains(legal_actions, Action::Type::CALL)) { | ||
return {Action::Type::CALL}; | ||
} | ||
throw std::runtime_error(fmt::format("Shouldn't have reached here: {}", legal_actions.size())); | ||
} | ||
}; | ||
|
||
/* | ||
Main program for running a C++ pokerbot. | ||
*/ | ||
int main(int argc, char* argv[]) { | ||
auto [host, port] = parseArgs(argc, argv); | ||
runBot<PreflopAllInBot>(host, port); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
|
||
../build/preflop_all_in_bot "$@" |
3d83398
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possible performance regression was detected for benchmark 'Arena Benchmark'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold
2
.Results vs. Ourselves
-1.5895
bb/hand (3.5993
)-5.388
bb/hand (3.564
)3.39
This comment was automatically generated by workflow using github-action-benchmark.