-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathyonee_process.m
More file actions
87 lines (69 loc) · 3.41 KB
/
yonee_process.m
File metadata and controls
87 lines (69 loc) · 3.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
function [ population, community_size, guru_size, percentage_coverts, converts_guru_size, ...
common_people_size, atheist_size, discarded_population, ...
yonee, human, bstop] ...
= yonee_process( yonee, yonee_time, nirvana_per_gen, human, data, who, Gen, Generation, discarded_population, ...
guru_size, community_size, percentage_coverts, converts_guru_size, common_people_size, atheist_size)
% may select worse r% to be removed in next generation.
% indicates they are no longer human beings
% so new r%??? may come from other yoni.
% bad population from previous life is dicarded from human population
% and new ones have joined the population
% assume bad population will not over write gurus population
bstop = false;
population = size(human,2);
L = size(human(1).soul,2);
yonee_sz = size(yonee,2);
yonee(yonee_sz+1 : yonee_sz+ (discarded_population(Gen))) = human( who(population - discarded_population(Gen) + 1 : population));
if( (discarded_population(Gen)+nirvana_per_gen) > population)
fprintf('discarded_population + nirvana_per_gen is more than total population\n');
bstop = true;
return;
end
if (Gen < yonee_time)
for (i = 1:(discarded_population(Gen)+nirvana_per_gen) )
human(who(population - i + 1)).status = 0;
human(who(population - i + 1)).soul = randperm(L);
human(who(population - i + 1)).karma = karma(human(who(population - i + 1)).soul,data);
% % if (bstagnant)
% % if (rand > percentage_coverts)
% % human(who(population - i + 1)).bconverted = false;
% % else
% % human(who(population - i + 1)).bconverted = true;
% % end
% % end
end
else
yonee_commers = (discarded_population(Gen)+nirvana_per_gen);
if (yonee_commers > population)
%catered above
end
if (yonee_commers > size(yonee,2))
human(who(population - (yonee_commers - size(yonee,2)) + 1 : population) ) = [];
% who(population - (yonee_commers - size(yonee,2)) + 1 : population) = [];
clear who;
[good_karma who] = sort([human(:).karma],'ascend');
yonee_commers = size(yonee,2);
population = size(human,2);
if (population == 0)
fprintf('NO MORE POPULATION\n');
bstop = true;
return;
end
[ community_size, guru_size, percentage_coverts, converts_guru_size, common_people_size, atheist_size] = ...
set_population_vars(population);
discarded_population = get_discard_population( 1, Generation, population);
for (i = 1:population)
human(i).name = i;
human(i).status = 0;
human(i).progress_on_era = 1;
human(i).isprogressing = true;
human(i).last_gen_human = Gen - 1;
% human(i).bconverted = false;
end
for (i = 1:guru_size)
human(who(i)).status = 1;
end
end
human(who(population - yonee_commers + 1 : population) ) = yonee(1:yonee_commers);
yonee(1:yonee_commers) = [];
end