diff options
-rw-r--r-- | forces/forces.go | 2 | ||||
-rw-r--r-- | main.go | 6 |
2 files changed, 6 insertions, 2 deletions
diff --git a/forces/forces.go b/forces/forces.go index c49692c..6869630 100644 --- a/forces/forces.go +++ b/forces/forces.go @@ -31,7 +31,7 @@ func forceActing(s1 structs.Star, s2 structs.Star) structs.Force { } // forces calculates the forces acting in between a given star and all the other stars in a given array. -func forces(stars_arr []structs.Star, nr int) structs.Force { +func Forces(stars_arr []structs.Star, nr int) structs.Force { var force structs.Force diff --git a/main.go b/main.go index 95aef98..b71f38d 100644 --- a/main.go +++ b/main.go @@ -11,8 +11,12 @@ func main() { starsSlice := []structs.Star{ {structs.Coord{X: 100, Y: 100}, structs.Force{0, 0}, 1000}, {structs.Coord{X: 200, Y: 300}, structs.Force{0, 0}, 1000}, + {structs.Coord{X: 100, Y: 500}, structs.Force{0, 0}, 1000}, } + // Print the starsSlice fmt.Println(starsSlice) - fmt.Println(forces.ForceActing(starsSlice[0], starsSlice[1])) + + // Calculate the forces acting inbetween all the stars in the starsSlice slice and star nr 0 in the starsSlice slice + fmt.Println(forces.Forces(starsSlice, 0)) } |