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;
		}
		
		function getCombinations(parts) {
		  var result = [];
		  var f = function(firstParts, parts) {
		    for (var i = 0; i < parts.length; i++) {
		    	
		      result.push(firstParts.concat(parts[i]));
		      console.log(parts[i+1]);
		      f(firstParts.concat(parts[i]), parts.splice(i + 1));
		      
		    }
		  }
		  f([], parts);
		  return result;
		}
		
		$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;
						}
					}
				
				
				if(!solved){
					calculable = false; break;
				}
				
				currentNumber++;
			}
		}
		
		$scope.newNumbers();
	
	});

@@ -1184,32 +1184,27 @@
 y;%0A%09%09%7D%0A%09%09%0A%09%09
-function
+var
  getCombinat
@@ -1211,48 +1211,8 @@
 ions
-(parts) %7B%0A%09%09  var result = %5B%5D;%0A%09%09  var f
  = f
@@ -1236,16 +1236,27 @@
 s, parts
+, solutions
 ) %7B%0A%09%09  
@@ -1308,24 +1308,19 @@
     
-%09%0A%09%09      result
+  solutions
 .pus
@@ -1363,42 +1363,40 @@
     
-console.log(parts%5Bi+1%5D);%0A%09%09      f
+solutions.concat(getCombinations
 (fir
@@ -1441,26 +1441,18 @@
 (i + 1))
+)
 ;
-%0A%09%09      
 %0A%09%09    %7D
@@ -1460,45 +1460,25 @@
 %09%09  
-%7D%0A%09%09  f(%5B%5D, parts);%0A%09%09  return result
+ return solutions
 ;%0A%09%09
@@ -1848,16 +1848,20 @@
 nations(
+%5B%5D, 
 smallerN
@@ -1863,16 +1863,20 @@
 llerNums
+, %5B%5D
 );%0A%09%09%09%09%0A

Update gameTheoryController.js