<commit_before>var gameModule = angular.module('app', []).
	controller("gameTheoryControl", function gameTheoryControl($scope){
	    	
	    	function number(num){
	    		this.name = num; 
	    		this.selected = false;
	    		return this;
	    	}
	    	
	    	$scope.numbers=[];
	    	$scope.solutions=[];
	    	
	    	function solution(x, parts){
	    		this.number = x;
	    		this.parts = parts;
	    	}
	    	
	    	$scope.amount = 10;
	    	
	    	$scope.newNumbers = function(){
			$scope.numbers = [];
			
			intAmount = parseInt($scope.amount);
			
			for(var i = 1; i < intAmount + 1; i++){
				$scope.numbers.push(new number(i));
			}
		}

		$scope.deleteSelected = function(){
			for(var num in $scope.numbers){
				if($scope.numbers[num].selected){
					$scope.numbers.splice(num, 1);
				}
			}
		}
		
		function sumOf(parts){
			var num = 0;
			for(var i = 0; i < parts.length; i++){
				num += parts[i];
			}
			return num;
		}
		
		function getSmallerNumbers(number){
			var newArray = [];
			for(var i = 0; i < $scope.numbers.length; i++){
				if($scope.numbers[i].name <= number){
					newArray.push($scope.numbers[i].name);
				}
				else{
					break;
				}
			}
			return newArray;
		}
		
		var getCombinations2 = function(firstParts, parts, solutions) {
			var results = [];
		    	for (var i = 0; i < parts.length; i++) {
			      solutions.push(firstParts.concat(parts[i]));
			      solutions.concat(getCombinations(firstParts.concat(parts[i]), parts.splice(i + 1)), solutions);
		    	}
		   return solutions;
		}
		
		var getCombinations = function(startArray, arrayOfNumbers){
			var results = [];
			for(var i = 0; i < arrayOfNumbers.length; i++){
				results.push(startArray.concat(arrayOfNumbers[i]));

				var tempArray = [];
				for(var j = 0; j < arrayOfNumbers.length; j++){
					if(i != j){
						tempArray.push(arrayOfNumbers[j]);
					}
				}
				
				results.concat(getCombinations(arrayOfNumbers[i], tempArray));
			}
			return results;
		}
		
		$scope.getSolutions = function(){
			$scope.solutions = [];
			var calculable = true;
			var currentNumber = 1;
			
			while(calculable){
				parts = [];
				
				var solved = false;
				
				var smallerNums = getSmallerNumbers(currentNumber);
				
				if(smallerNums.length == 0){
					calculable = false; break;
				}
				
				var combinations = getCombinations([], smallerNums);
				
					for(var i = 0; i < combinations.length; i++){
						if(sumOf(combinations[i]) == currentNumber){
							$scope.solutions.push(new solution(currentNumber, combinations[i]));
							solved = true;
						}
					}
				<commit_msg>Update gameTheoryController.js<commit_after>var gameModule = angular.module('app', []).
	controller("gameTheoryControl", function gameTheoryControl($scope){
	    	
	    	function number(num){
	    		this.name = num; 
	    		this.selected = false;
	    		return this;
	    	}
	    	
	    	$scope.numbers=[];
	    	$scope.solutions=[];
	    	
	    	function solution(x, parts){
	    		this.number = x;
	    		this.parts = parts;
	    	}
	    	
	    	$scope.amount = 10;
	    	
	    	$scope.newNumbers = function(){
			$scope.numbers = [];
			
			intAmount = parseInt($scope.amount);
			
			for(var i = 1; i < intAmount + 1; i++){
				$scope.numbers.push(new number(i));
			}
		}

		$scope.deleteSelected = function(){
			for(var num in $scope.numbers){
				if($scope.numbers[num].selected){
					$scope.numbers.splice(num, 1);
				}
			}
		}
		
		function sumOf(parts){
			var num = 0;
			for(var i = 0; i < parts.length; i++){
				num += parts[i];
			}
			return num;
		}
		
		function getSmallerNumbers(number){
			var newArray = [];
			for(var i = 0; i < $scope.numbers.length; i++){
				if($scope.numbers[i].name <= number){
					newArray.push($scope.numbers[i].name);
				}
				else{
					break;
				}
			}
			return newArray;
		}
		
		var getCombinations2 = function(firstParts, parts, solutions) {
			var results = [];
		    	for (var i = 0; i < parts.length; i++) {
			      solutions.push(firstParts.concat(parts[i]));
			      solutions.concat(getCombinations(firstParts.concat(parts[i]), parts.splice(i + 1)), solutions);
		    	}
		   return solutions;
		}
		
		var getCombinations = function(startArray, arrayOfNumbers){
			var results = [];
			for(var i = 0; i < arrayOfNumbers.length; i++){
				results.push(startArray.concat(arrayOfNumbers[i]));

				var tempArray = [];
				for(var j = 0; j < arrayOfNumbers.length; j++){
					if(i != j){
						tempArray.push(arrayOfNumbers[j]);
					}
				}
				
				results.concat(getCombinations(startArray.concat(arrayOfNumbers[i]), tempArray));
			}
			return results;
		}
		
		$scope.getSolutions = function(){
			$scope.solutions = [];
			var calculable = true;
			var currentNumber = 1;
			
			while(calculable){
				parts = [];
				
				var solved = false;
				
				var smallerNums = getSmallerNumbers(currentNumber);
				
				if(smallerNums.length == 0){
					calculable = false; break;
				}
				
				var combinations = getCombinations([], smallerNums);
				
					for(var i = 0; i < combinations.length; i++){
						if(sumOf(combinations[i]) == currentNumber){
							$scope.solutions.push(new solution(currentNumber, combinations[i]));
							solved = true;
						}
					}
				
{'fraction_non_alphanumeric': 0.14961832061068703, 'fraction_numerical': 0.0061068702290076335, 'mean_word_length': 2.461690885072655, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '229880', 'n_tokens_mistral': 2308, 'n_tokens_neox': 1728, 'n_words': 337}