From 651b851fdd2a36958e09a66cb2877c66cf160a5e Mon Sep 17 00:00:00 2001 From: Benji Dial Date: Tue, 18 Jul 2023 10:19:42 -0400 Subject: better warrior placement, including handling the case where they don't fit --- include/lib94/lib94.hpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'include') diff --git a/include/lib94/lib94.hpp b/include/lib94/lib94.hpp index c91c24b..4924732 100644 --- a/include/lib94/lib94.hpp +++ b/include/lib94/lib94.hpp @@ -91,16 +91,15 @@ 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. note that, if the supplied warriors cannot all be - //fit into the core, this will never return. the 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. 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. - void 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. 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); //returns the number of warriors who have at least one process size_t alive_warrior_count(); -- cgit v1.2.3