diff options
author | Benji Dial <benji6283@gmail.com> | 2023-11-25 18:15:30 -0500 |
---|---|---|
committer | Benji Dial <benji6283@gmail.com> | 2023-11-25 18:15:30 -0500 |
commit | eab56a7f006f5a73c2b7eb984b2aae72bc898212 (patch) | |
tree | 9a88abaf9fc474948cf0f0055d39c6911d2d8a92 /include | |
parent | 5141b88157d02040e20a59b923cc672dd7fdc875 (diff) | |
download | lib94-eab56a7f006f5a73c2b7eb984b2aae72bc898212.tar.gz |
allow more control over init_round, rewrite tabulator and make it run every possible separation and turn order exactly once
Diffstat (limited to 'include')
-rw-r--r-- | include/lib94/lib94.hpp | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/include/lib94/lib94.hpp b/include/lib94/lib94.hpp index 4924732..40c9631 100644 --- a/include/lib94/lib94.hpp +++ b/include/lib94/lib94.hpp @@ -91,15 +91,22 @@ namespace lib94 { //does not effect the address sets. void clear_core_random(); - //clears the address sets, places the supplied warriors into the core, and starts one process for - //each supplied warrior at its org. the count parameter specifies the number of warriors in the - //array. each of the warriors in the array must not be deleted for the duration of the round, but - //the array itself may be deleted after this function returns. on success, this function returns - //true. on failure (i.e. when the warriors do not all fit into the core), this function returns - //false. note that this function does not clear the core before placing the warriors, so you may - //want to call clear_core or clear_core_random before calling this. note also that you probably - //want to call seed_prng, for example with the current time, before the first time you call this. - bool init_round(const warrior *const *warriors, size_t count); + //clears the address sets, places the supplied warriors into the core, and starts one + //process for each supplied warrior at its org. the count parameter specifies the number + //of warriors in the array. each of the warriors in the array must not be deleted for + //the duration of the round, but the array itself may be deleted after this function + //returns. if the offsets parameter is not null, it specifies where in the core the first + //instruction of each warrior is put. if it is null, the warriors are placed at random + //non-overlapping locations, respecting the order that they appear in the array. if + //shuffle is true, the warriors' turn order is decided randomly. if shuffle is false, + //the turn order is the order that they appear in the warriors array. on success, this + //function returns true. on failure (i.e. when offsets is null and the warriors do not + //all fit into the core), this function returns false. note that this function does not + //clear the core before placing the warriors, so you may want to call clear_core or + //clear_core_random before calling this. note also that if you are passing null for + //offsets or setting shuffle to true, you probably want to call seed_prng, for example + //with the current time, before the first time you call this. + bool init_round(const warrior *const *warriors, size_t count, const number_t *offsets, bool shuffle); //returns the number of warriors who have at least one process size_t alive_warrior_count(); |