4 Commits

Author SHA1 Message Date
eb57a18a02 set initial params in hardcode 2022-11-16 18:57:18 +01:00
206796cf0f fix logic 2022-11-16 18:02:35 +01:00
d1bb82d2a1 write to file 2022-11-16 17:09:16 +01:00
659b913130 write to file 2022-11-15 09:05:27 +01:00
2 changed files with 29 additions and 14 deletions

View File

@ -13,4 +13,12 @@
- step: 500
amount: 1
neighbours: 1
- step: 600
amount: 500
neighbours: 50
- step: 1500
amount: 10
neighbours: 1
- step: 2000
amount: 1
neighbours: 1

33
main.go
View File

@ -22,8 +22,8 @@ import (
var windowWidth, windowHeight = 1000, 700
var goidSize = 3
var goidColor = color.RGBA{200, 200, 100, 255} // gray, 50% transparency
var populationSize = 20
var loops = 500
var populationSize = 10
var loops = 3000
var numNeighbours = 5
var separationFactor = float64(goidSize * 5)
var coherenceFactor = 8
@ -76,17 +76,20 @@ func main() {
hideCursor()
var goids []*Goid
for i := 0; i < populationSize; i++ {
g := createRandomGoid()
goids = append(goids, &g)
}
// 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, td[current_stage].Amount)
numNeighbours = td[current_stage].NumNeighbours
if i > td[current_stage].Step {
if td[current_stage].NumNeighbours >= populationSize {
numNeighbours = populationSize - 1
} else {
numNeighbours = td[current_stage].NumNeighbours
}
if i == td[current_stage+1].Step {
current_stage += 1
}
move(goids, fo, i)
@ -107,12 +110,15 @@ func main() {
total = goid.Goid
}
}
fmt.Println(total)
outfile, err := os.Create("./goids.txt")
if err != nil {
panic(err)
}
for i := 0; i <= total; i++{
var x []string
var y []string
fmt.Println("GOID: ", i)
outfile.Write([]byte(fmt.Sprintf("GOID: %d\n", i)))
for z := 0; z <= loops; z++ {
check := false
for _, g := range output {
@ -128,8 +134,9 @@ func main() {
y = append(y, "-")
}
}
fmt.Printf("%v\n", x)
fmt.Printf("%v\n", y)
outfile.Write([]byte(fmt.Sprintf("%v\n", x)))
outfile.Write([]byte(fmt.Sprintf("%v\n", y)))
}
}