About The Contest

The first ever Olympiad of Misguided Geeks contest at Worse Than Failure (or OMGWTF for short) is a new kind of programming contest. Readers are invited to be creative with devising a calculator with the craziest code they can write. One lucky and potentially insane winner will get either a brand new MacBook Pro or comparable Sony VAIO laptop.



Entry #100305: The String calculator

by Tatu Lahtela
All good programmers know that the best way to calculate is
to use strings and string comparisons. The basic idea is that
the coder tries to solve the problem as he would do it on a
piece of paper. So basic operations are done with strings.
Badly. Inconsistently. Multiplication division operations
had to be slightly optimized to pass the tests. Time issues
prohibited to optimize idiocy on the multiplication and division
methods, but I'm somewhat proud of the subtraction and addition.

The calculator is has some slight limitations for maximum
performance for the tests. Known features:
- Division rounds to whole numbers (ceil) (except the tests).
- Subtraction can only use numbers smaller than 1 000 000.
- All operations return false values with proper values.

The submission covers an implementation of the CalcFunc interface.

Download0 Comments