This educational model simulates a population of symbolic molecules that can replicate, mutate, and experience simple selection. It is not intended to be a chemically realistic model. Instead, it helps students explore how variation, replication, and selection can change molecular populations over time.

This educational model simulates a population of symbolic molecules that can replicate, mutate, and experience simple selection. It is not intended to be a chemically realistic model. Instead, it helps students explore how variation, replication, and selection can change molecular populations over time.

simulate_abiogenesis(
  n_molecules = 100,
  generations = 100,
  alphabet = c("A", "U", "G", "C"),
  min_length = 5,
  max_length = 20,
  mutation_rate = 0.01,
  selection_strength = 1,
  seed = NULL
)

simulate_abiogenesis(
  n_molecules = 100,
  generations = 100,
  alphabet = c("A", "U", "G", "C"),
  min_length = 5,
  max_length = 20,
  mutation_rate = 0.01,
  selection_strength = 1,
  seed = NULL
)

Arguments

n_molecules

Initial number of molecules.

generations

Number of generations to simulate.

alphabet

Character vector used to build molecular sequences.

min_length

Minimum initial molecule length.

max_length

Maximum initial molecule length.

mutation_rate

Probability that a copied character mutates.

selection_strength

Strength of fitness-based selection. Use 0 for neutral drift.

seed

Optional random seed for reproducibility.

Value

A tibble with generation-level summary statistics.

A tibble with generation-level summary statistics.

Examples

result <- simulate_abiogenesis(n_molecules = 50, generations = 20, seed = 1)
head(result)
#> # A tibble: 6 × 6
#>   generation n_molecules mean_length mean_fitness diversity max_fitness
#>        <int>       <int>       <dbl>        <dbl>     <int>       <dbl>
#> 1          0          50        13.4         1.06        50        1.25
#> 2          1          50        12.9         1.12        35        1.25
#> 3          2          50        12.2         1.15        28        1.25
#> 4          3          50        12.6         1.16        24        1.25
#> 5          4          50        12.4         1.18        25        1.25
#> 6          5          50        11.8         1.19        25        1.25
result <- simulate_abiogenesis(n_molecules = 50, generations = 20, seed = 1)
head(result)
#> # A tibble: 6 × 6
#>   generation n_molecules mean_length mean_fitness diversity max_fitness
#>        <int>       <int>       <dbl>        <dbl>     <int>       <dbl>
#> 1          0          50        13.4         1.06        50        1.25
#> 2          1          50        12.9         1.12        35        1.25
#> 3          2          50        12.2         1.15        28        1.25
#> 4          3          50        12.6         1.16        24        1.25
#> 5          4          50        12.4         1.18        25        1.25
#> 6          5          50        11.8         1.19        25        1.25