Compare commits
4 Commits
v0.0.2-dev
...
v0.0.4-dev
Author | SHA1 | Date | |
---|---|---|---|
eb57a18a02 | |||
206796cf0f | |||
d1bb82d2a1 | |||
659b913130 |
10
config.yaml
10
config.yaml
@ -13,4 +13,12 @@
|
|||||||
- step: 500
|
- step: 500
|
||||||
amount: 1
|
amount: 1
|
||||||
neighbours: 1
|
neighbours: 1
|
||||||
|
- step: 600
|
||||||
|
amount: 500
|
||||||
|
neighbours: 50
|
||||||
|
- step: 1500
|
||||||
|
amount: 10
|
||||||
|
neighbours: 1
|
||||||
|
- step: 2000
|
||||||
|
amount: 1
|
||||||
|
neighbours: 1
|
||||||
|
33
main.go
33
main.go
@ -22,8 +22,8 @@ import (
|
|||||||
var windowWidth, windowHeight = 1000, 700
|
var windowWidth, windowHeight = 1000, 700
|
||||||
var goidSize = 3
|
var goidSize = 3
|
||||||
var goidColor = color.RGBA{200, 200, 100, 255} // gray, 50% transparency
|
var goidColor = color.RGBA{200, 200, 100, 255} // gray, 50% transparency
|
||||||
var populationSize = 20
|
var populationSize = 10
|
||||||
var loops = 500
|
var loops = 3000
|
||||||
var numNeighbours = 5
|
var numNeighbours = 5
|
||||||
var separationFactor = float64(goidSize * 5)
|
var separationFactor = float64(goidSize * 5)
|
||||||
var coherenceFactor = 8
|
var coherenceFactor = 8
|
||||||
@ -76,17 +76,20 @@ func main() {
|
|||||||
hideCursor()
|
hideCursor()
|
||||||
var goids []*Goid
|
var goids []*Goid
|
||||||
|
|
||||||
for i := 0; i < populationSize; i++ {
|
// for i := 0; i < populationSize; i++ {
|
||||||
g := createRandomGoid()
|
// g := createRandomGoid()
|
||||||
goids = append(goids, &g)
|
// 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, td[current_stage].Amount)
|
goids, populationSize = fixGoids(goids, populationSize, td[current_stage].Amount)
|
||||||
numNeighbours = td[current_stage].NumNeighbours
|
if td[current_stage].NumNeighbours >= populationSize {
|
||||||
if i > td[current_stage].Step {
|
numNeighbours = populationSize - 1
|
||||||
|
} else {
|
||||||
|
numNeighbours = td[current_stage].NumNeighbours
|
||||||
|
}
|
||||||
|
if i == td[current_stage+1].Step {
|
||||||
current_stage += 1
|
current_stage += 1
|
||||||
}
|
}
|
||||||
move(goids, fo, i)
|
move(goids, fo, i)
|
||||||
@ -107,12 +110,15 @@ func main() {
|
|||||||
total = goid.Goid
|
total = goid.Goid
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fmt.Println(total)
|
|
||||||
|
|
||||||
|
outfile, err := os.Create("./goids.txt")
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
for i := 0; i <= total; i++{
|
for i := 0; i <= total; i++{
|
||||||
var x []string
|
var x []string
|
||||||
var y []string
|
var y []string
|
||||||
fmt.Println("GOID: ", i)
|
outfile.Write([]byte(fmt.Sprintf("GOID: %d\n", i)))
|
||||||
for z := 0; z <= loops; z++ {
|
for z := 0; z <= loops; z++ {
|
||||||
check := false
|
check := false
|
||||||
for _, g := range output {
|
for _, g := range output {
|
||||||
@ -128,8 +134,9 @@ func main() {
|
|||||||
y = append(y, "-")
|
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)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user