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