UNPKG
genome.js
Version:
latest (1.1.10)
1.1.10
1.1.9
1.1.8
1.1.7
1.1.6
1.1.4
1.1.3
1.1.2
1.1.1
1.1.0
1.0.5
1.0.4
1.0.3
1.0.2
1.0.1
1.0.0
Genetics algorithms done right
github.com/Treast/genome.js
Treast/genome.js
genome.js
/
src
/
core
/
Gene.ts
18 lines
(14 loc)
•
270 B
text/typescript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
export
class
Gene
{
private
value
:
number
;
private
factor
:
number
;
constructor
(
factor
:
number
) {
this
.
factor
= factor;
this
.
value
=
Math
.
random
(); }
get
(
) {
return
this
.
value
*
this
.
factor
; }
mutate
(
) {
this
.
value
=
Math
.
random
(); } }