From 3f9338115af9371e40a04b1f2027b5c76d1e6781 Mon Sep 17 00:00:00 2001 From: hamazaki1990 Date: Wed, 3 May 2017 10:55:31 +0900 Subject: [PATCH] approaching #15 --- hamazaki1990/main.py | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/hamazaki1990/main.py b/hamazaki1990/main.py index cb5ad27..3f1d5eb 100644 --- a/hamazaki1990/main.py +++ b/hamazaki1990/main.py @@ -6,19 +6,26 @@ def get_heterogeneity(Population): - for x in Population._inds: - if Population[0] != Population[x]: + Population_ids = [x.get_id() for x in Population._inds] + for x in range(1, len(Population_ids)): + if Population_ids[0] != Population_ids[x]: return True break - else: - return False + else: + return False def simulate_fixwf(Population): - if complete_fixation(Population): - + cnt = 1 + while get_heterogeneity(Population): + Population = Population.next_genwf() + cnt += 1 + print(Population._inds) + else: + print(cnt) p1 = Population(5) -p1.print_ids -simulate_fixation(p1) +p1.print_ids() +print(get_heterogeneity(p1)) +simulate_fixwf(p1)