summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorBenji Dial <benji@benjidial.net>2023-07-18 10:19:42 -0400
committerBenji Dial <benji@benjidial.net>2023-07-18 10:19:42 -0400
commit651b851fdd2a36958e09a66cb2877c66cf160a5e (patch)
tree2f4e0e35f0f27b9dbb28bd9f7fbe4e0b937ce378 /include
parent723437674e0002f7b0e2b727bc24ec3080ac069f (diff)
downloadlib94-651b851fdd2a36958e09a66cb2877c66cf160a5e.tar.gz
better warrior placement, including handling the case where they don't fit
Diffstat (limited to 'include')
-rw-r--r--include/lib94/lib94.hpp19
1 files changed, 9 insertions, 10 deletions
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();