Antkeeper  0.0.1
ant-cladogenesis.hpp
Go to the documentation of this file.
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 
20 #ifndef ANTKEEPER_GAME_ANT_CLADOGENESIS_HPP
21 #define ANTKEEPER_GAME_ANT_CLADOGENESIS_HPP
22 
23 #include "game/ant/ant-genome.hpp"
25 #include <memory>
26 #include <random>
27 
38 template <class URBG>
39 [[nodiscard]] std::unique_ptr<ant_genome> ant_cladogenesis(const ant_gene_pool& pool, URBG& urbg)
40 {
41  // Allocate genome
42  std::unique_ptr<ant_genome> genome = std::make_unique<ant_genome>();
43 
44  // Randomly sample genes
45  genome->antennae = pool.antennae.sample(urbg);
46  genome->body_size = pool.body_size.sample(urbg);
47  genome->pupa = pool.pupa.sample(urbg);
48  genome->diet = pool.diet.sample(urbg);
49  genome->egg = pool.egg.sample(urbg);
50  genome->eyes = pool.eyes.sample(urbg);
51  genome->foraging_time = pool.foraging_time.sample(urbg);
52  genome->founding_mode = pool.founding_mode.sample(urbg);
53  genome->gaster = pool.gaster.sample(urbg);
54  genome->head = pool.head.sample(urbg);
55  genome->larva = pool.larva.sample(urbg);
56  genome->legs = pool.legs.sample(urbg);
57  genome->mandibles = pool.mandibles.sample(urbg);
58  genome->mesosoma = pool.mesosoma.sample(urbg);
59  genome->nest_site = pool.nest_site.sample(urbg);
60  genome->ocelli = pool.ocelli.sample(urbg);
61  genome->pigmentation = pool.pigmentation.sample(urbg);
62  genome->pilosity = pool.pilosity.sample(urbg);
63  genome->sculpturing = pool.sculpturing.sample(urbg);
64  genome->sting = pool.sting.sample(urbg);
65  genome->waist = pool.waist.sample(urbg);
66  genome->wings = pool.wings.sample(urbg);
67 
68  return genome;
69 }
70 
71 #endif // ANTKEEPER_GAME_ANT_CLADOGENESIS_HPP
std::unique_ptr< ant_genome > ant_cladogenesis(const ant_gene_pool &pool, URBG &urbg)
Generates an ant genome from a gene pool.
Pool of ant genes from which ant genomes can be generated.
ant_gene_frequency_table< ant_ocelli_gene > ocelli
ant_gene_frequency_table< ant_waist_gene > waist
ant_gene_frequency_table< ant_body_size_gene > body_size
ant_gene_frequency_table< ant_legs_gene > legs
ant_gene_frequency_table< ant_sting_gene > sting
ant_gene_frequency_table< ant_foraging_time_gene > foraging_time
ant_gene_frequency_table< ant_founding_mode_gene > founding_mode
ant_gene_frequency_table< ant_pupa_gene > pupa
ant_gene_frequency_table< ant_pigmentation_gene > pigmentation
ant_gene_frequency_table< ant_mesosoma_gene > mesosoma
ant_gene_frequency_table< ant_mandibles_gene > mandibles
ant_gene_frequency_table< ant_pilosity_gene > pilosity
ant_gene_frequency_table< ant_eyes_gene > eyes
ant_gene_frequency_table< ant_nest_site_gene > nest_site
ant_gene_frequency_table< ant_larva_gene > larva
ant_gene_frequency_table< ant_diet_gene > diet
ant_gene_frequency_table< ant_antennae_gene > antennae
ant_gene_frequency_table< ant_sculpturing_gene > sculpturing
ant_gene_frequency_table< ant_head_gene > head
ant_gene_frequency_table< ant_egg_gene > egg
ant_gene_frequency_table< ant_gaster_gene > gaster
ant_gene_frequency_table< ant_wings_gene > wings