forked from tsavery/GAdeckbuilder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDeckChromosome.cs
40 lines (35 loc) · 1.05 KB
/
DeckChromosome.cs
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using GeneticSharp;
using GeneticSharp.Domain.Chromosomes;
using GeneticSharp.Domain.Crossovers;
using GeneticSharp.Domain.Mutations;
using GeneticSharp.Domain.Populations;
using GeneticSharp.Domain.Selections;
using GeneticSharp.Domain.Terminations;
using GeneticSharp.Domain.Randomizations;
namespace GAdeckbuilder
{
public class DeckChromosome : ChromosomeBase
{
public DeckChromosome() : base(Program.CardPool.Count)
{
for (int x = 0; x < Program.CardPool.Count; x++) {
ReplaceGene(x, GenerateGene(x));
}
}
public override Gene GenerateGene(int geneIndex)
{
// Generate a gene base on my problem chromosome representation.
var x = RandomizationProvider.Current.GetInt(0, 2);
return new Gene(x);
}
public override IChromosome CreateNew()
{
return new DeckChromosome();
}
}
}