Bring Your Own Code: Introducing the Lucky Deuce
The life of a developer is about being cunning. When presented a problem that could be solved with strenuous, character-building labor, our first instinct is to automate it and cheat our way around it, if at all possible.
Or maybe I'm just projecting. Still, if there's one thing I've noticed, TDWTF readers are a shifty lot of scoundrels. It's time for us to put that cunning to work.
Thanks to our sponsor Infragistics, for the next five weeks, we're going to call upon you to build us a Scoundrel's Casino. Each week, we're going to introduce a simple programming challenge, and give you a few days to solve it. Each week's challenge is independent of the last, and each week is going to be a little bit harder than the week before.
And prizes? Prizes! The "best" entry each week, judged by completely subjective criteria, gets a spanking new TDWTF mug, a single-developer license for Infragistics' controls, and some super-sweet stickers. There will be some additional prizes (more piles of stickers) for submissions that seem cool and fun. And most important, every entrant gets the best prize of all: bragging rights.
The Lucky Deuce CasinoYou are a developer for an online casino, and thus a wanted criminal in the United States. While you hide from the FBI, your managers keep sending you requirement after requirement, with absurd deadline after absurd deadline. You haven't even met the other developers on your team- you write one tiny module for the casino, and it gets taken away from you and bundled with modules written by programmers you've never met, and the end product is almost certainly a bug-ridden mess.
You're sitting inside a seedy motel on the outskirts of town. You've got the blinds closed, but that doesn't stop the neon sign for the diner across the street from keeping you up all night. You haven't gotten a decent night's sleep in days. You're wondering what you're doing with your life, and how you can get out before you end up in jail, or worse. And then- DING! An email comes in, bearing the latest requirements for a new module. You've had enough of this. You'll implement it, alright, but you're not going to settle for the pittance of a salary they're paying you. You're gonna get what's coming to you.
The RequirementsThe first requirement is pretty normal. You're supposed to write a module that generates random numbers like a double-zero roulette wheel. They don't specify how the random numbers are generated, but that's basically a single line of code. Super easy.
It's the second requirement that makes you groan with frustration. They don't want the numbers to be really random. "In a true random sequence," the write, "the same number may appear many times in a row, just do[sic] to random chance. While that is actually random, it doesn't feel random to our players." They want you to track a history of the random numbers generated, and make something that "feels" random: numbers that have appeared recently are less like to appear. "Runs", where the same number appears 3 times in a row, should never happen.
"Alright," you say to yourself, "I can do that." But you can do one better. In addition to implementing their requirements, you decide to add in your own. You're going to write in a "cheat" function- something that lets you either enter in some sort of cheat code, or in some other fashion makes the output of the roulette wheel predictable. Be careful, though, you don't want to get caught! You'll need to get creative to make sure nobody stumbles on your secret- millions of people are going to gamble with this program.
Entering & JudgingTo enter, send an email to byoc15@worsethanfailure.com with a link or attachment of your code. In the body of the email, explain how your cheat works and what we need to do to run your code. You can use any language you like, but we have to be able to run it with minimal setup.
You don't need to build a GUI, but if you do, and you do it using tools from Infragistics, we'll send you a free license (one per entrant, supplies limited). Consider this your Infragistics bonus.
Assume we have access to stock Windows, Linux and OSX instances, if we need to run your software locally. You could target MUMPS running on a mainframe, but we can't run it, and you probably won't win. You must get your submission in before 11:59PM Eastern Time, Sunday the 9th of August to be eligible for judging. We'll announce the winners next Wednesday, along with the next leg of the contest!
The overall winner will be chosen by how interesting and fun we think their solution and cheat is.
Thanks to Infragistics for making this possible.
A worldwide leader in user experience, Infragistics helps developers build amazing applications. More than a million developers trust Infragistics for enterprise-ready user interface toolsets that deliver high-performance applications for Web, Windows and mobile applications. Their Indigo Studio is a design tool for rapid, interactive prototyping.
[Advertisement] Scout is the best way to monitor your critical server infrastructure. With over 90 open source plugins, robust alerting, beautiful dashboards and a 5 minute install - Scout saves youvaluable engineering time. Try the server monitoring you'll today.Your first 30 days are free on us. Learn more at Scout.