From 84bfb2d3617e981605267bdd8b114ed3bba3a500 Mon Sep 17 00:00:00 2001 From: Benji Dial Date: Fri, 7 Jun 2024 11:27:40 -0400 Subject: new tabulator, remove evolver --- include/lib94/lib94.hpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/lib94/lib94.hpp b/include/lib94/lib94.hpp index 71ec68e..9b4147c 100644 --- a/include/lib94/lib94.hpp +++ b/include/lib94/lib94.hpp @@ -6,6 +6,7 @@ #include #include #include +#include #include #ifndef LIB94_CORE_SIZE @@ -22,7 +23,8 @@ namespace lib94 { //it has to be at least big enough to represent LIB94_CORE_SIZE squared, //since it is used as an intermediate for all of the instructions, //including in particular MUL. - typedef int_least32_t number_t; + typedef int32_t number_t; + #define LIB94_MPI_NUMBER_T MPI_INT32_T enum opcode : uint8_t { DAT, MOV, ADD, SUB, @@ -162,10 +164,17 @@ namespace lib94 { //convenience method - calls clear_core(background), then init_round(warriors, count, //offsets, shuffle), then single_step until either one warrior remains or that - //has been called rounds_to_tie times. if one warrior remains, returns the pointer to + //has been called steps_to_tie times. if one warrior remains, returns the pointer to //that warrior. if a tie is reached, returns a null pointer. this asserts that the call //to init_round returns true. see comment on init_round. - const warrior *do_round(const instruction &background, const warrior *const *warriors, size_t count, const number_t *offsets, bool shuffle, long rounds_to_tie); + const warrior *do_round(const instruction &background, const warrior *const *warriors, size_t count, const number_t *offsets, bool shuffle, long steps_to_tie); + + //runs every possible offset and turn order using do_round. + //asserts that total length is not more than core size. + //should be called from everyone in a communicator. + //assumes comm ranks go from 0 to comm size - 1. + template + void tabulate_mpi(const instruction &background, const warrior *w1, const warrior *w2, long steps_to_tie, int &w1_wins_out, int &w2_wins_out, int &rounds_out, MPI_Comm communicator); } -- cgit v1.2.3