- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
(2 + 2) - (16 / 4) + 1 = Frist!
Admin
Wasn't Krypto Superman's dog?
Admin
Fail!
Admin
This sounds rather similar to the "numbers game" in the British game show Countdown (more details on Wiki at http://en.wikipedia.org/wiki/Countdown_(game_show)#Numbers_round).
Admin
Once you've solved these on your own, check out Rosetta Code to see examples of a "24" game and a player for such in a variety of languages.
Again, don't check it out until you've done it yourself, or you spoil much of the purpose of this blog post...
http://rosettacode.org/wiki/24_game http://rosettacode.org/wiki/24_game/Solve
(Disclaimers: Yes, it's my site. No, I didn't write that code. No, I'm not participating in writing one for this blog post; I've already seen other people solve it in a couple dozen languages. I just thought some of the coder geeks around here might fine it interesting.)
Admin
For some reason, this reminds me of Alex Zane's games...
Admin
No offense, but you were a major nerd :)
Admin
I think the real WTF is that Alex had friends...
Admin
Wow. Just . . . wow.
I never played these card games, but I thought I was the only one who would take a series of numbers from some random place (could be anything -- license plates, telephone numbers, SSNs, etc.) and try to insert mathematical symbols to make the preceding numbers have a total of the last digit (or last couple of digits, whatever worked). To find that there's actually a card game for this . . . I wouldn'ta thunk it.
Admin
BODMAS?
Admin
The other RWTF is that the red-suit cards are printed in black.
Admin
First of all, let's remember that 'Countdown' is itself based on the French game show 'Des Chiffres Et Des Lettres.' :)
Also, the Countdown numbers game is somewhat different, though I agree that Krypto (and yes that IS the name of Superman's dog) has some basic similarities.
Countdown's game has a random three-digit 'target,' and one chooses from two set of numbers: one set is 25, 50, 75, and 100; the other set is two lots of the numbers 1 through 10. You can choose from one to four 'big' numbers, which are made up to a total of six numbers by random picks from the 'small numbers.'
(And since all non-UK readers have already dozed off ;), did you know that TWO large numbers is the choice that gives the best chance of a solution existing? Check out this site: http://www.crosswordtools.com/numbers-game/)
Admin
I thought the same I wrote a solver for countdown (letters and numbers games) in J2ME many many years ago (when that was all the rage), wonder where it is.
Admin
There are a couple of other differences, in countdown any divisions can't be fractions so you can't do (9/2) + 1 = 5.5 * 10 = 55 and in countdown not all numbers must be used.
Admin
The only solution I can think of, off the top of my head, involves recursion. And so I can't do the Easy solution, I have to do Medium or better. Is there something I'm missing here?
Admin
For an extra challenge, assign units to the suits and require that the units in the result have to be correct.
Admin
Quite right Ziplodocus. This smacks of another WTFiction.
Admin
I'm a little disappointed in you...
Admin
We played this in grade 4, only we also used the face cards.
Admin
Please tell what set of cards contains numeric values above 10.
Admin
Admin
Tarot. The Major Arcana are numbered in a proper deck... 16 would be The Tower.
Admin
Booooooooooooooooooooooooooooring.
Though I like the 24 game... Bonus points for the person who can come up with the hardest 24 game puzzle.
Admin
Messy thrown together javascript:
Doesn't handle parentheses, but oh well.
Admin
My puzzle: 3 7 9 9
Admin
3 * (7 + 9 / 9) = 24
Sorry for the newb question, but why would I want to do this elementary coding exercise?
Admin
"I don't know, why would you want to do this elementary coding exercise?"
...
Admin
Ahh, damn it. I missed that solution. My intended solution was (9*7+9)/3...
And why you would want to do the exercise? No idea. I've always wondered why it exists on this site. It doesn't fit, imho.
Admin
I knew it! So this site has another side, huh? Is it worth 10 minutes of coding to get there?
Admin
It fits to the extent that the intent of the site is to improve code and highlight particularly bad and to-be-avoided practices
Admin
"Dammit Chloe, where's that access code?!"
Whoops, wrong "24".
Admin
Here's an excellent clip of Countdown where the guy solves the numbers round in amazing fashion... Who'd have thought it was possible :)
http://www.youtube.com/watch?v=pfa3MHLLSWI
Admin
Presumably not all of the readers of this site are super-genius coders like (ahem) you and I. Maybe there's people who haven't already solved every problem there is reading this. I know, it's terrible, you're associated with "noobs" just by reading a site that they're allowed to read. Sorry.
Admin
Because small hacks in joke languages like Intercal can be fun, but writing real applications in Intercal is not.
Also, if you happen to be learning or want to learn a new language, small problems are a good way to jump in and get your feet wet. Starting with a real application as your first project in an unfamiliar language leads to the types of things we see regularly on this site.
Admin
Partial solution in C++:
Assumptions:
To use, compile as "_24" and echo the cards or enter from console:
Admin
(7*9+9)/3
Admin
OK, but first: bonus points for someone who can define "hardest" in this context.
Admin
public static void main (String[] args) { System.out.println("42"); }
Admin
What about the url?
Admin
Admin
Admin
I tried this once. Failed because the code couldn't solve 2,7,7,10 for 24.
Hint/Spoiler: Problem difficulty may increase severalfold at this point, depending on what language you're using.
Admin
Bonus points to whoever can find all problems that have only one non-duplicated solution.
Admin
Ahem, 'me and you' or 'you and I'.
Admin
Using my submission got:
10 7 / 2 + 7 *
Which translates in standard bracketed notation to:
(10 / 7 + 2) * 7 = 24
Admin
my abs
Admin
Admin
My high school girlfriend and I would play this game on occasion. She introduced it to me. She was awesome, valedictorian in HS, top honors at her engineering program at a major university (she was #1 or 2 of her class), and she's currently married and a stay-at-home mom... she is awesome.
Admin
My prefered variant is with seven dice, two are different colours. Roll 'em. The two become a two-digit number, the other five are used to try to make it.
Admin
Win for CREEEEEEEPY.