Your task is to create a program that computes every combination of the operations written in a .TXT file.
Example TXT File:
1
+
2
/
3
Example Output:
1+2/3=1
1+3/2=2
2+1/3=1
2+3/1=5
3+2/1=5
3+1/2=2
1/2+3= //See bonuses. If your program does not feature float, leave blank result.
1/3+2= //See above.
2/1+3=5
2/3+1= //See above.
3/2+1= //See above.
3/1+2=5
Specs:
Every line of the .TXT file must contain a number or an operation;
The minimum length for the .TXT file is 5 lines;
The operations must be computed from left to right. E.g.
4+4/2
results in4
;Your program should feature
+
,-
,*
and/
operations;Your program should work with any valid input of any valid length.
Scoring:
Code length is your starting score, but not the only parameter. Here's a short list of bonuses you can achieve to lower your score. The user with the lowest score wins.
Implement
^
: -20;Implement
log
(in base e): -30;Implement
logn
(where n is any positive base): -50 (only -20 if you achieved thelog
bonus);Implement
e
(and the number in the line below is the exponent of 10. So1e4
=10000
): -20;Can handle negative values: -10;
Can handle float values: -20;
There are no digits (
0123456789
) in the code: -10;There is no call to
eval
or equivalent: -20;All of the above: -100.
For a total of -250 bonus points.
Good luck!
The operations must be computed in order. E.g. 4+4/2 results 4;
spec? This is against the rules of math! \$\endgroup\$*
this effect is even more appreciable, like in 4*2+4*2*3! \$\endgroup\$^
is extremely easy; it is just the XOR of two numbers! (If you meant power, please say so. Other people might get confused) \$\endgroup\$