// Constants
let MIN_DISTANCE = 12;
let MAX_PER_GROUP = 3;
-let NB_USERS = 4;
+let NB_USERS = 10;
// Utils
let rand = function(min, max) {
users.push(user);
}
-console.log(users);
-
// Compute distance between each user
let getDistanceOfEachUser = function(users) {
let i = 0;
if(groups[i].indexOf(dist.first) === -1 && typeof alreadyInAGroup[dist.first.id] === 'undefined') {
if(groups[i].length > 1) {
- for(let l = 0; groups[i].length; l++) {
+ for(let l = 0; l < groups[i].length; l++) {
let userTotest = groups[i][l];
if(computeDistance(dist.first, userTotest) <= MIN_DISTANCE) {
groups[i].push(dist.first);
if(groups[i].indexOf(dist.second) === -1 && typeof alreadyInAGroup[dist.second.id] === 'undefined') {
if(groups[i].length > 1) {
- for(let l = 0; groups[i].length; l++) {
+ for(let l = 0; l < groups[i].length; l++) {
let userTotest = groups[i][l];
if(computeDistance(dist.second, userTotest) <= MIN_DISTANCE) {
groups[i].push(dist.second);
// TODO : Créer une méthode pour checker la distance entre les membres du groupes pour savoir s'il faut les dissoudre ou non
+console.log(users);
console.log(distances);
console.log(groups);