Skip to content

Commit

Permalink
Gene Value range is extended from -10/+10 to -50.50/+50.50
Browse files Browse the repository at this point in the history
  • Loading branch information
Mohsen authored and Mohsen committed Mar 31, 2024
1 parent 4fa1df2 commit 445dd6c
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions resources/scripts/genetics.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ const GENETICS = {
currentPopulation: -1,
POPULATION_COUNT: 100,
CHROMOSOME_DNA_COUNT: 9,
CHROMOSOME_DNA_RANGE: 2100, // -10.00 .. 0.00 .. +10.00
CHROMOSOME_DNA_RANGE: 10100, // -50.50 .. 0.00 .. +50.50

MUTATION_RATE: 0.4,
REBORN_GEN_DATA: {
Expand All @@ -114,11 +114,10 @@ const GENETICS = {

utils: {
getRandDNA: function () {
// -10.00 .. 0.00 .. +10.00
// -100.00 .. 0.00 .. +100.00
return (
(Math.floor(Math.random() * GENETICS.CHROMOSOME_DNA_RANGE) -
Math.floor(GENETICS.CHROMOSOME_DNA_RANGE / 2)) /
100
Math.floor(GENETICS.CHROMOSOME_DNA_RANGE / 2)) / 100
);
},
createPopulation: function () {
Expand Down

0 comments on commit 445dd6c

Please sign in to comment.