Skip to content

Instantly share code, notes, and snippets.

@ivanseidel
Last active March 24, 2017 19:32
Show Gist options
  • Save ivanseidel/1c30865ff4d49a6b11c7 to your computer and use it in GitHub Desktop.
Save ivanseidel/1c30865ff4d49a6b11c7 to your computer and use it in GitHub Desktop.
Tournamenter Stuff

Startup:

node app --port=8090 --adapter.module sails-mongo --adapter.url mongodb://localhost:27017/obr_sp --backup.interval 10 --backup.path ~/Backups/ --backup.prefix obr_sp_ --env.NAME obr_sp --env.APP_NAME "OBR SP"

OBR Filtering Script Pre-2015 (Best 2 with Time configuration):

        var sum = 0;
	var timeSum = 0;
	var minScore = 9999;
	var shouldSubtract = 0;
	for(var k in scores){
		var i = k*1;
		if(i>3) shouldSubtract = 1;
		if(i%2 != 0) continue;

		sum += (scores[i]*1 || 0);
		if(minScore > scores[i]*1){
			minScore = scores[i]*1 || 0;
		}
		if(scores[i + 1]){
			timeSum += scores[i + 1]*1;
		}
	};
	
	sum -= minScore * shouldSubtract;
	return [sum, -timeSum, sum + minScore * shouldSubtract];

OBR Regional Filtering Script (2016)

	var sum = 0;
	var timeSum = 0;
	var minScore = 9999;
	var maxScore = 0;
	var timeMax = 0;
	var shouldSubtract = 0;
	for(var k in scores){
		var i = k*1;
		if(i>3) shouldSubtract = 1;
		
		if(i%2 != 0) continue;
		
		sum += (scores[i]*1 || 0);
		
		if(minScore > scores[i]*1){
		        minScore = scores[i]*1 || 0;
	        }
		
		if(maxScore < scores[i]*1){
		        maxScore = scores[i]*1;
			timeMax = scores[i + 1]*1;
	        }
		
		if(scores[i + 1]){
			 timeSum += scores[i + 1]*1;
	        } else { timeSum += 1000; }
	};
	sum -= minScore * shouldSubtract;
	return [sum, -timeSum, -timeMax, sum + minScore * shouldSubtract];

OBR Nacional Filtering Script (2016)

    var sum = 0;
    var timeSum = 0;
    var minScore = 9999;
    var shouldSubtract = 0;
    for(var k in scores){
        var i = k*1;
        if(i>3) shouldSubtract = 1;
        if(i%2 != 0) continue;

        sum += (scores[i]*1 || 0);
        if(minScore > scores[i]*1){
            minScore = scores[i]*1 || 0;
        }
        if(scores[i + 1]){
            timeSum += scores[i + 1]*1;
        }
    };

    sum -= minScore * shouldSubtract;
    return [sum, -timeSum, sum + minScore * shouldSubtract];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment