summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorBenji Dial <benji@benjidial.net>2024-06-07 01:11:49 -0400
committerBenji Dial <benji@benjidial.net>2024-06-07 01:11:49 -0400
commit9778e5c1298c8888214725f968badcbab516ea82 (patch)
treeea23ea5d4a8f504b3aeb6861bb5cf5073492a4be /include
parent0d44b60612ffb6d44c15e3defc043f6179540979 (diff)
downloadlib94-9778e5c1298c8888214725f968badcbab516ea82.tar.gz
redo evolver, add warrior serialization / deserialization to library
Diffstat (limited to 'include')
-rw-r--r--include/lib94/lib94.hpp9
1 files changed, 9 insertions, 0 deletions
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<instruction> 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<uint8_t> &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);