genome.js
Version:
Genetics algorithms done right
29 lines (24 loc) • 536 B
text/typescript
export class Blueprint {
private properties: number[];
private constants: number[];
constructor() {
this.properties = [];
this.constants = [];
}
add(factor: number, times: number = 1) {
for (let i = 0; i < times; i += 1) {
this.properties.push(factor);
}
}
addConstant(factor: number, times: number = 1) {
for (let i = 0; i < times; i += 1) {
this.constants.push(factor);
}
}
getProperties() {
return this.properties;
}
getConstants() {
return this.constants;
}
}