From c73e675866d056374ab8be170ed46110f1107bc8 Mon Sep 17 00:00:00 2001 From: hanemile Date: Fri, 28 Sep 2018 18:12:20 +0200 Subject: calc_all_forces calculates all the forces acting in the galaxy using go-threads --- force.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/force.go b/force.go index ed45849..16ee30e 100644 --- a/force.go +++ b/force.go @@ -46,3 +46,15 @@ func forces(stars_arr []star, nr int) { } } } + +// calc_all_forces iterates over all the stars in a given array and calculate the forces acting on all stars +func calc_all_forces(arr []star) { + + // Iterate over all the stars + for index, _ := range arr { + + // Calculate the force acting inbetween the given star and all other stars + // This utilizes go-routines :D + go forces(arr, index) + } +} -- cgit 1.4.1