Jump to content

24 game/Solve: Difference between revisions

m
Switched from printing RPN to printing infix
m (Switched from printing RPN to printing infix)
Line 1,774:
 
function printSoln( nums : List<Integer>, ops : char[] ) {
// RPN: a b c d + - *
System.out.print( "Found soln:" )
// Infix (a * (b - (c + d)))
 
print( "Found soln: (${nums.get(0)} ${ops[0]} (${nums.get(1)} ${ops[1]} (${nums.get(2)} ${ops[2]} ${nums.get(3)})))" )
for( i in nums ) {
System.out.print( " ${i}" )
}
 
for( i in ops ) {
System.out.print( " ${i}" )
}
 
print( "" )
}
 
Cookies help us deliver our services. By using our services, you agree to our use of cookies.