Skip to content

Commit

Permalink
Added support for 8-card and 9-card evaluation to library interface (…
Browse files Browse the repository at this point in the history
…code was there, but it wasn't in header files, etc.).
  • Loading branch information
jasonrohrer committed Jul 4, 2024
1 parent ca8b5ab commit 52ff431
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 0 deletions.
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

0 comments on commit 52ff431

Please sign in to comment.