I made a couple text adventures on mine, do they count? :biggrin.gif:

Stupid thing couldn't do a bit of graphics, so I was stuck with a what'll-you-do-next thing. Everyone loved playing it, but I didn't think of it as much as a challenge, just more of a time waster during history and english class. XD

Oh yeah? I've got such mad haxx0r skills I can program a super-exact clone of Halo from scratch on a friggin' pine tree. Last time I clocked, I did it all in 42 seconds. WORD. Oh, and guess what? It never lags. I pwn those n00bs all day, dawg.

Fun test to see if you know the first thing about implementing calculators:

Evaluate the following:
6 9 2 - 6 * 3 * + 7/ = ??

That does not make mathematical sense.
There are two missing integers.
So I will replace the integers with 0s.
692 - 18 = 674.
674 * 0 = 0.
0 + 7 = 7.
7 / 0 = ERROR MALFUNCTION ERROR ERROR (undefined)
So the answer would be undefined.
EDIT: Silly madk, you switched the digits in 692!

Fun test to see if you know the first thing about implementing calculators:

Evaluate the following:
6 9 2 - 6 * 3 * + 7/ = ??

That does not make mathematical sense.
There are two missing integers.
So I will replace the integers with 0s.
692 - 18 = 674.
674 * 0 = 0.
0 + 7 = 7.
7 / 0 = ERROR MALFUNCTION ERROR ERROR (undefined)
So the answer would be undefined.
EDIT: Silly madk, you switched the digits in 692! :tongue.gif:

Fun test to see if you know the first thing about implementing calculators:

Evaluate the following:
6 9 2 - 6 * 3 * + 7/ = ??

That does not make mathematical sense.
There are two missing integers.
So I will replace the integers with 0s.
692 - 18 = 674.
674 * 0 = 0.
0 + 7 = 7.
7 / 0 = ERROR MALFUNCTION ERROR ERROR (undefined)
So the answer would be undefined.
EDIT: Silly madk, you switched the digits in 692! :tongue.gif:

So you are saying 6 7 8 - 3 = 3 4 5?
Excellent logic.[/sarcasm]

You don't have enough operators there. You need two more.

6 7 8 - 3
6 -1 3 ????

Is this a new form of math?

No, it's very old. It's how early calculators required you to input mathematical expressions since it's very easy for a machine to work with. Some modern calculators still parse expressions into this form internally. It's useful because operators have no precedence and it's very easy to evaluate using a stack. The algorithm for evaluating goes like this:

For each symbol:
If symbol is number:
push(symbol)
elif symbol is operator:
rhs = pop()
lhs = pop()
push(operator(lhs, rhs))
If stack size != 1:
Invalid expression
Else
return pop()

Or, a simple Python implementation:

operators = {
'+' : (lambda x, y: x + y),
'-' : (lambda x, y: x - y),
'*' : (lambda x, y: x * y),
'/' : (lambda x, y: x / y),
'^' : (lambda x, y: x **y)
}
class Token:
def __init__(self, s):
try:
self.number = False
self.op = operators[s]
except KeyError:
self.number = True
self.value = float(s)
def evaluateRPN(string):
tokens = [Token(s) for s in string.split()]
stack = []
for tok in tokens:
if tok.number:
stack.append(tok.value)
else:
rhs = stack.pop()
lhs = stack.pop()
stack.append(tok.op(lhs, rhs))
if len(stack) != 1:
raise RuntimeError("Invalid RPN expression")
return stack[0]

Rollback Post to RevisionRollBack

Never attribute to malice what can adequately be explained by incompetence.

To post a comment, please login or register a new account.

But you can program a calculator using a programming language.

If I deserve one, give me one.

Only a few people here could actually program a calculator. It's a lot harder than you think it is.

Stupid thing couldn't do a bit of graphics, so I was stuck with a what'll-you-do-next thing. Everyone loved playing it, but I didn't think of it as much as a challenge, just more of a time waster during history and english class. XD

I meant a text calculator.

I can make one of those.

If I deserve one, give me one.

from scratchon a friggin'pine tree. Last time I clocked, I did it all in 42 seconds. WORD. Oh, and guess what? Itneverlags. I pwn those n00bs all day, dawg.Evaluate the following:

6 9 2 - 6 * 3 * + 7/ = ??

"7/"?

962 - 6 * 3 + 7

962 - 18 + 7

944 + 7

= 951

?

That does not make mathematical sense.

There are two missing integers.

So I will replace the integers with 0s.

692 - 18 = 674.

674 * 0 = 0.

0 + 7 = 7.

7 / 0 = ERROR MALFUNCTION ERROR ERROR (undefined)

So the answer would be undefined.

EDIT: Silly madk, you switched the digits in 692!

If I deserve one, give me one.

I am capable of making a text (console) calculator.

But I can't do a GUI calculator.

If I deserve one, give me one.

It makes perfect sense

6 9 2 - 6 * 3 * + 7 / = ??

6 7 6 * 3 * + 7 /

6 42 3 * + 7 /

6 126 + 7 /

132 7 / = 18.857142857142857142857142857143

(I originally meant to put 6 4 2 - 6 * 3 * + 7/ which would be 6, but I misread my horrible writing, so the answer is a bit inelegant)

Why are you adding the spaces?

And what does * + mean?

And it is not possible for a human to carry out this floating point.

If I deserve one, give me one.

So you are saying 6 7 8 - 3 = 3 4 5?

Excellent logic.[/sarcasm]

If I deserve one, give me one.

You don't have enough operators there. You need two more.

6 7 8 - 3

6 -1 3 ????

Is this a new form of math?

If I deserve one, give me one.

It is an old form of math:

http://en.wikipedia.org/wiki/Reverse_Polish_notation

No, it's very old. It's how early calculators required you to input mathematical expressions since it's very easy for a machine to work with. Some modern calculators still parse expressions into this form internally. It's useful because operators have no precedence and it's very easy to evaluate using a stack. The algorithm for evaluating goes like this:

Or, a simple Python implementation: