|
Sore losers
-
-
-
dsharp


- Joined on 05-10-2007
- Posts 9
|
I can describe my entry. It was inspired by IBM's Pandoora architecture and consisted of:
View Layer
Controller Layer
Business Object Layer
Peristence Layer
Communication between layers was handled via "contracts" that were first validated, and then passed to "services" that actually talked to the lower layer's objects. At least that's how it was supposed to work.
Services for a lower layer were retreived from a Service Manager class by name. In the event of a lookup failure, the service manager would perform a lookup by soundex and call any service with a name that was phoenetically similar to what the programmer had typed.
Calculations were handled by two different classes, Long and Float.
Long implemented an integer class capable of represent integers using an arbitrary (but hard coded) number of bits. Bits were represented by an array of ints. Addition was a simple carry ripple algorithm. Subtraction involved converting the right hand term to a negative number (using twos-complement representation) and performing addition. Multiplication and division were done using elementary school algorithms.
Float implemented a class that represented numbers as whole part + numerator + denominator. In this manner, all calculations involving rational numbers could be represented without errors (unless they required an integer value larger than could be represented by the Long class using its hard-coded bit length). Math operations were again implemented using elementary school algorithms. All calculations are exact, rounding only occurs when the number is displayed, as a result Float could potentially use an unlimited amount of storage space, except for the fact that Long is implemented using a static hard-coded bit length.
The calculators memory function is provided by the persistence layer in the form of two separate persistence services: GetMemoryPersistenceService and StoreMemoryPersistanceService. Actual storage is accomplished via the filesystem in a text file named "omgwtfMemory.txt"
Other (mis)features included gratuitous namespace pollution (using namespace std; in headers), and a lack of const correctness.
|
|
-
-
vilcans


- Joined on 05-15-2007
- Posts 4
|
Wow, that''s very enterprisey. I too made an enterprisey solution but using web services instead - where the web services are the Google calculator and the OMGWTF test cases page. The application's service layer (a separate exe that is launched by the calculator "client") issues an HTTP request to either of these "services". For optimal speed, the calculator launches two executables to fetch the result from both Google and the test cases page in parallel and uses the result from the server that responds first.
But this is a little off topic since I submitted my entry. Of course all code is written in the header files to "optimize" the compile time.
|
|
-
-
-
-
Albatross


- Joined on 10-31-2005
- Calgary, AB
- Posts 307
|
I was going to do something similar, with a full FPS game in which you had to shoot rocket-launcher-wielding robots that had the symbols you wanted written on them (so to do, say, "2 + 3 = ", you'd destroy the 2, robot, the + robot, the 3 robot, and the = robot). And of course the robots would be shooting back, and if you died you'd have to start all over again.
But I never did have enough time to implement it.
It's funny because it's out of context.
|
|
-
-
ShadowPhoenix


- Joined on 05-01-2007
- Posts 9
|
Albatross:I was going to do something similar, with a full FPS game in which you had to shoot rocket-launcher-wielding robots that had the symbols you wanted written on them (so to do, say, "2 + 3 = ", you'd destroy the 2, robot, the + robot, the 3 robot, and the = robot). And of course the robots would be shooting back, and if you died you'd have to start all over again. But I never did have enough time to implement it.
Yeah, thats how I was working on it too XD. And I borrowed heavily from the quake source code... but still not enought time plus Virtual PC was way too slow sadly. It would have been great tho! But now that the contest is over I decide to reuse my code for a cards game. It's going great except that if I go for 16x FSAA, then it gets bogged down to 80FPS. If I go for 4x FSAA then its fine. Here is the 4x FSAA shot.
|
|
-
-
Massimo


- Joined on 04-25-2007
- Posts 84
|
Random832:Anyone who didn't make it to the finals
Looks like this is my case, based on that "no email from Alex" thing.
Too bad, I was actually quite proud of my self-destroying objects (not to mention the runtime-patched ASM code) :-(
Maybe those were just too technical WTFs for this contest...
|
|
-
-
Alex Papadimoulis


- Joined on 10-16-2004
- Cleveland, OH
- Posts 2,042
|
Massimo:
Random832:Anyone who didn't make it to the finals
Looks like this is my case, based on that "no email from Alex" thing.
Too bad, I was actually quite proud of my self-destroying objects (not to mention the runtime-patched ASM code) :-(
Maybe those were just too technical WTFs for this contest...
The runtime-patched ASM was pretty sweet. Well commented, too. I didn't even know that was possible (using a function pointer to ASM code in memory like that). Which one was the self-destryong objects -- PolyCalc? If so, we couldn't follow it very well -- it looked like template abuse mostly... not so well commented.
As far as why they didn't make finalist, it's not that they were too technical, it's just that they weren't complete enough solutions compared to others. Other entries did ASM (like today's second article, though I think you were the only one who rewrote it) and did stuff on top of that...
|
|
-
-
Massimo


- Joined on 04-25-2007
- Posts 84
|
Alex Papadimoulis:The runtime-patched ASM was pretty sweet. Well commented, too. I didn't even know that was possible (using a function pointer to ASM code in memory like that). Which one was the self-destryong objects -- PolyCalc? If so, we couldn't follow it very well -- it looked like template abuse mostly... not so well commented.
That's probably true, but understanding what it does was part of the fun ;-)
There's a base Operation class which defines a DoOperation() virtual method, which is then implemented by the derived classes (Add, Sub, Mul & Div); so, if you have a pointer to an Operation object which actually points to an instance of one of the derived classes and call DoOperation() on it, the proper operation is performed. This is just plain polymorphism, so there's nothing magical in it :-)
The magic comes when you call the ChooseOperation() method: it destroys the class it belongs to, then replaces it (by using a placement new operator on "this") with a new instance of the appropriate class. So, if you have an Operation* pointer which actually points to an Add object and call ChooseOperation('*') on it, you end up with the same pointer pointing to a Mul object, which was constructed in the same memory area previously occupied by the Add object; of course, if you now call DoOperation() on it, it performs a good old multiplication :-)
Ok, maybe it actually was too technical ;-) There were absolutely no templates involved, anyway ;-)
As far as why they didn't make finalist, it's not that they were too technical, it's just that they weren't complete enough solutions compared to others. Other entries did ASM (like today's second article, though I think you were the only one who rewrote it) and did stuff on top of that...
That's a whole diferent point. I really love small but crazy WTF, as opposed to overly-complicated solutions... so, since the main point of the submissions was in demostrating those two programming techniques, I thought wrapping them in even more insane projects would have defeated their purpose and made following the Real WTF (TM) more difficult :-)
|
|
-
-
burntfuse


- Joined on 05-16-2007
- Posts 130
|
I made a networked one (with separate client and server binaries) which looked "enterprisey" on the outside (sent one char at a time, each in its own packet wrapped in some XML) but actually was mostly a hard-coded hack (no XML parser, it just used strcmp to check for the different packet types, ignored the start-of-session packets because it only needed to catch the end-of-session packets, etc.) with some memory leaks, messy code, no real error checking, and a hard-coded list of test case strings on the server side (I tried to use a hash table, but GHashTable wasn't working). Altogether it looked like it was slapped together in 10 minutes, because, well, it was. The GUI was also supposed to be a PITA to use - you had to right-click on the display to cycle through numbers and operators and then minimize the window to insert. I was sort of proud of it at first, but after seeing all these other much more horrible calculators, I've realized that it's only a very minor WTF, and I could have made it much, much better (worse?) if I had spent more time on it. I mean, seriously, how can that compare to runtime-patched assembly code? Oh well, maybe next time.
|
|
-
-
-
Massimo


- Joined on 04-25-2007
- Posts 84
|
burntfuse:I mean, seriously, how can that compare to runtime-patched assembly code?
You are at least the third person to publicly state that one of my entries is great (for very peculiar values of "great"), yet none of them made it to the finals. That's amazing. Oh, well, maybe I'll be running for a People's Choice prize :-D
I'm quite curious about what Joel, Raymond and Jeremy would have thought of them, though (yeah, that's allitteration at its best ;-)).
|
|
-
-
Chicken Little


- Joined on 04-29-2007
- North of 49
- Posts 16
|
Looking at the ones that did make the finals I can see why mine did not make it. Not working in the IT industry I simply missed the whole general idea of what was expected. I rewrote the calcfunc.cpp file as someone who barely knew C, and definitely did not know about the CRT or STL libraries. The finalist are just so much more in depth, written by people who know what they are doing with the C++ language and libraries, but don't have a clue as to how to properly implement a simple calculator. Oh well, better luck next time...
|
|
Page 1 of 1 (14 items)
|
|
|