From ecbb0627092bf4e77cf211b0b7632f0d2448d025 Mon Sep 17 00:00:00 2001 From: Benji Dial Date: Thu, 28 Dec 2023 21:49:47 -0500 Subject: add convenience methods and (experimental) evolver --- include/lib94/lib94.hpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'include') diff --git a/include/lib94/lib94.hpp b/include/lib94/lib94.hpp index 63f862e..0766af7 100644 --- a/include/lib94/lib94.hpp +++ b/include/lib94/lib94.hpp @@ -147,6 +147,17 @@ namespace lib94 { template const warrior *single_step(); + //convenience method - reads the contents of a file and then calls compile_warrior. + //if the file cannot be read, returns a null pointer. see comment on compile_warrior. + warrior *compile_warrior_from_file(std::string path); + + //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 + //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); + } #endif -- cgit v1.2.3