add init_amount to config
This commit is contained in:
parent
3db36407ea
commit
c0e37c3183
@ -1,4 +1,5 @@
|
|||||||
last_step: 100
|
last_step: 100
|
||||||
|
init_amount: 10
|
||||||
steps:
|
steps:
|
||||||
- step: 10
|
- step: 10
|
||||||
amount: 1
|
amount: 1
|
||||||
|
7
main.go
7
main.go
@ -31,6 +31,7 @@ var coherenceFactor = 8
|
|||||||
type configuration struct {
|
type configuration struct {
|
||||||
Steps []steps `yaml:"steps"`
|
Steps []steps `yaml:"steps"`
|
||||||
LastStep int `yaml:"last_step"`
|
LastStep int `yaml:"last_step"`
|
||||||
|
InitAmount int `yaml:"init_amount"`
|
||||||
}
|
}
|
||||||
type steps struct {
|
type steps struct {
|
||||||
Step int `yaml:"step"`
|
Step int `yaml:"step"`
|
||||||
@ -73,6 +74,7 @@ func main() {
|
|||||||
err = yaml.Unmarshal(conf, &config)
|
err = yaml.Unmarshal(conf, &config)
|
||||||
steps := config.Steps
|
steps := config.Steps
|
||||||
loops = config.LastStep
|
loops = config.LastStep
|
||||||
|
populationSize = config.InitAmount
|
||||||
defer func() {
|
defer func() {
|
||||||
if err := fo.Close(); err != nil {
|
if err := fo.Close(); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
@ -81,7 +83,10 @@ func main() {
|
|||||||
clearScreen()
|
clearScreen()
|
||||||
hideCursor()
|
hideCursor()
|
||||||
var goids []*Goid
|
var goids []*Goid
|
||||||
|
for i := 0; i < populationSize; i++ {
|
||||||
|
g := createRandomGoid()
|
||||||
|
goids = append(goids, &g)
|
||||||
|
}
|
||||||
current_stage := 0
|
current_stage := 0
|
||||||
for i := 0; i < loops; i++ {
|
for i := 0; i < loops; i++ {
|
||||||
goids, populationSize = fixGoids(goids, populationSize, steps[current_stage].Amount)
|
goids, populationSize = fixGoids(goids, populationSize, steps[current_stage].Amount)
|
||||||
|
Loading…
Reference in New Issue
Block a user