From 9778e5c1298c8888214725f968badcbab516ea82 Mon Sep 17 00:00:00 2001 From: Benji Dial Date: Fri, 7 Jun 2024 01:11:49 -0400 Subject: redo evolver, add warrior serialization / deserialization to library --- include/lib94/lib94.hpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'include') diff --git a/include/lib94/lib94.hpp b/include/lib94/lib94.hpp index 0766af7..71ec68e 100644 --- a/include/lib94/lib94.hpp +++ b/include/lib94/lib94.hpp @@ -63,6 +63,15 @@ namespace lib94 { std::vector instructions; }; + //serialize a warrior in such a way that it can be read back by deserialize_warrior. + //does not consider name and author. + void serialize_warrior(const warrior *the_warrior, std::vector &into); + + //deserialize a warrior that has been serialized by serialize_warrior. + //no error checking is performed. + //does not consider name and author. + warrior *deserialize_warrior(const uint8_t *from); + //this seeds the prng used to place warriors into the core at the start of a round //if this is never called, 0 is used as a seed and the placements are deterministic. void seed_prng(uint_fast64_t seed); -- cgit v1.2.3