Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for 8-card and 9-card evaluation to library interface (… #108

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions cpp/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ all: libpheval.a libphevalplo4.a libphevalplo5.a libphevalplo6.a
libpheval.a: src/evaluator5.c.o src/hashtable5.c.o src/evaluator5.cc.o \
src/evaluator6.c.o src/hashtable6.c.o src/evaluator6.cc.o \
src/evaluator7.c.o src/hashtable7.c.o src/evaluator7.cc.o \
src/evaluator8.c.o src/hashtable8.c.o src/evaluator8.cc.o \
src/evaluator9.c.o src/hashtable9.c.o src/evaluator9.cc.o \
src/hash.c.o src/hashtable.c.o src/dptables.c.o \
src/rank.c.o src/7462.c.o src/tables_bitwise.c.o
ar rcs $@ $^
Expand Down
2 changes: 2 additions & 0 deletions cpp/include/phevaluator/phevaluator.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ extern "C" {
int evaluate_5cards(int a, int b, int c, int d, int e);
int evaluate_6cards(int a, int b, int c, int d, int e, int f);
int evaluate_7cards(int a, int b, int c, int d, int e, int f, int g);
int evaluate_8cards(int a, int b, int c, int d, int e, int f, int g, int h);
int evaluate_9cards(int a, int b, int c, int d, int e, int f, int g, int h, int i);

/*
* The first five parameters are the community cards on the board
Expand Down
31 changes: 31 additions & 0 deletions cpp/src/evaluator8.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Copyright 2016-2023 Henry Lee
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#include <phevaluator/phevaluator.h>

#include "hash.h"
extern "C" {
#include "tables.h"
}
namespace phevaluator {

Rank EvaluateCards(const Card& a, const Card& b, const Card& c, const Card& d,
const Card& e, const Card& f, const Card& g,
const Card& h ) {
return evaluate_8cards(a, b, c, d, e, f, g, h);
}

} // namespace phevaluator
31 changes: 31 additions & 0 deletions cpp/src/evaluator9.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Copyright 2016-2023 Henry Lee
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#include <phevaluator/phevaluator.h>

#include "hash.h"
extern "C" {
#include "tables.h"
}
namespace phevaluator {

Rank EvaluateCards(const Card& a, const Card& b, const Card& c, const Card& d,
const Card& e, const Card& f, const Card& g,
const Card& h, const Card& i) {
return evaluate_9cards(a, b, c, d, e, f, g, h, i);
}

} // namespace phevaluator
2 changes: 2 additions & 0 deletions cpp/src/tables.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ extern const short flush[8192];
extern const short noflush5[6175];
extern const short noflush6[18395];
extern const short noflush7[49205];
extern const short noflush8[49205];
extern const short noflush9[49205];
extern const unsigned char suits[4609];

extern const unsigned int choose[53][10];
Expand Down
Loading