| 59 | } |
| 60 | void writeStiffness(std::vector<uint8_t>& data, float value) { data.emplace_back(static_cast<uint8_t>(value * 255)); } |
| 61 | void writeGenome(std::vector<uint8_t>& data, std::variant<MakeGenomeCopy, std::vector<uint8_t>> const& value) |
| 62 | { |
| 63 | auto makeGenomeCopy = std::holds_alternative<MakeGenomeCopy>(value); |
| 64 | writeBool(data, makeGenomeCopy); |
| 65 | if (!makeGenomeCopy) { |
| 66 | auto genome = std::get<std::vector<uint8_t>>(value); |
| 67 | writeWord(data, static_cast<int>(genome.size())); |
| 68 | data.insert(data.end(), genome.begin(), genome.end()); |
| 69 | } |
| 70 | } |
| 71 | |
| 72 | uint8_t readByte(std::vector<uint8_t> const& data, int& pos) |
| 73 | { |