From 52ff431b2f66f66e9e8db40e254de79cd3b78b25 Mon Sep 17 00:00:00 2001 From: Jason Rohrer Date: Thu, 4 Jul 2024 21:13:22 +0000 Subject: [PATCH] Added support for 8-card and 9-card evaluation to library interface (code was there, but it wasn't in header files, etc.). --- cpp/Makefile | 2 ++ cpp/include/phevaluator/phevaluator.h | 2 ++ cpp/src/evaluator8.cc | 31 +++++++++++++++++++++++++++ cpp/src/evaluator9.cc | 31 +++++++++++++++++++++++++++ cpp/src/tables.h | 2 ++ 5 files changed, 68 insertions(+) create mode 100644 cpp/src/evaluator8.cc create mode 100644 cpp/src/evaluator9.cc diff --git a/cpp/Makefile b/cpp/Makefile index b84f69d..c83178d 100644 --- a/cpp/Makefile +++ b/cpp/Makefile @@ -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 $@ $^ diff --git a/cpp/include/phevaluator/phevaluator.h b/cpp/include/phevaluator/phevaluator.h index 1e01cae..c232e09 100644 --- a/cpp/include/phevaluator/phevaluator.h +++ b/cpp/include/phevaluator/phevaluator.h @@ -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 diff --git a/cpp/src/evaluator8.cc b/cpp/src/evaluator8.cc new file mode 100644 index 0000000..eda2ce0 --- /dev/null +++ b/cpp/src/evaluator8.cc @@ -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 + +#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 diff --git a/cpp/src/evaluator9.cc b/cpp/src/evaluator9.cc new file mode 100644 index 0000000..57e09c4 --- /dev/null +++ b/cpp/src/evaluator9.cc @@ -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 + +#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 diff --git a/cpp/src/tables.h b/cpp/src/tables.h index c0026bf..17930d1 100644 --- a/cpp/src/tables.h +++ b/cpp/src/tables.h @@ -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];