💿🐜 Antkeeper source code https://antkeeper.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
2.0 KiB

  1. /*
  2. * Copyright (C) 2023 Christopher J. Howard
  3. *
  4. * This file is part of Antkeeper source code.
  5. *
  6. * Antkeeper source code is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * Antkeeper source code is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. #include "game/ant/cladogenesis.hpp"
  20. namespace game {
  21. namespace ant {
  22. genome* cladogenesis(const gene_pool& pool, std::random_device& rng)
  23. {
  24. // Allocate genome
  25. ant::genome* genome = new ant::genome();
  26. // Randomly sample genes
  27. genome->antennae = pool.antennae.sample(rng);
  28. genome->body_size = pool.body_size.sample(rng);
  29. genome->cocoon = pool.cocoon.sample(rng);
  30. genome->diet = pool.diet.sample(rng);
  31. genome->egg = pool.egg.sample(rng);
  32. genome->eyes = pool.eyes.sample(rng);
  33. genome->foraging_time = pool.foraging_time.sample(rng);
  34. genome->founding_mode = pool.founding_mode.sample(rng);
  35. genome->gaster = pool.gaster.sample(rng);
  36. genome->head = pool.head.sample(rng);
  37. genome->larva = pool.larva.sample(rng);
  38. genome->legs = pool.legs.sample(rng);
  39. genome->mandibles = pool.mandibles.sample(rng);
  40. genome->mesosoma = pool.mesosoma.sample(rng);
  41. genome->nest_site = pool.nest_site.sample(rng);
  42. genome->ocelli = pool.ocelli.sample(rng);
  43. genome->pigmentation = pool.pigmentation.sample(rng);
  44. genome->pilosity = pool.pilosity.sample(rng);
  45. genome->sculpturing = pool.sculpturing.sample(rng);
  46. genome->sting = pool.sting.sample(rng);
  47. genome->waist = pool.waist.sample(rng);
  48. genome->wings = pool.wings.sample(rng);
  49. return genome;
  50. }
  51. } // namespace ant
  52. } // namespace game