- 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
Oh god, this is so easy, ten billion answers are all over the innertubes, I solved this in middle school during recess, can't you think up anything original, blah blah blah.
There, got all that out of the way fist.
Admin
"The Ladies' and Gentlemen's Diary" was not a mathematical journal as such. It styled itself a "repository of science and amusement" and devoted some of its pages to posing amusing mathematical problems for its (apparently lay but literate) readership. Most googlable sources insist that it never published more than three issues, namely for the years 1820, 1821, and 1822 -- so it was long dead in 1850.
The only googlable occurrences of TLaGD with the number 1850 are various references to Kirkman's problem -- so this possibly erroneous citation has a long history. Interestingly, some sources (one is Gerstein, Introduction to mathematical structures and proofs) says the the problem was posed by W.S.B. Woolhouse in 1844 (still in TLaGD) and solved by Kirkman in 1850.
Admin
Should this also consider best friends, sworn enemies and "She said.. she said.."?
(I went to a girls-only school for 5 years - it's war out there, with a very delicate political situation and alliances changing daily. I still don't know the rules! Despite being a girl...)
Admin
As with every BYOC so far, TRWTF is that the spec is borked. Is "n" in the medium difficulty version supposed to read "num_girls"? What does "no 2 girls are in the same group more than once a week" mean? There are two possibilities...
-- Submission attempt 2
Admin
I got as far as reading about fifteen young girls and their breasts but then my mind just wandered off. I don't think I'm going to be of much help for this Praxis.
Admin
I'm not saying this implementation is great, I'm just saying it works; solved for "hard" in PHP:
Admin
Why is that when a nice programming challenge is presented to a bunch of developers all they can do is argue about grammar and spelling?
Admin
Seriously, what is the point of this bollocks? What do you use to fill the holes in the woodwork after the worms have come out of it?
Actually, I do like the idea of a "2-girl combination lookup table." As usual with TDWTF, the comments are better than the original code. Is there a URL for this? (Not featuring cups, kthx.)
Admin
I like this guys' thinking. getGirls drillDown "changing the seed will cause the possibilities to change" combos of girls first base, second base, third base
He has all the good stuff...
Admin
Oh well, it worked out in the end, I suppose.
Admin
Does anybody actually like these? I don't think this is the place for such things; if I want questions like this there are plenty of sites.
But okay, my answer in bash:
Admin
Admin
We have been writing getGirls() functions for years, they may compile, but they never work. Recently I found this one:
GetGirls($)
It only works in the states, and has more chance of success for higher values of $.
(3rd try, is this some sort of persistance captcha?)
Admin
Because they're reading this to take a break from their programming challenges?
Admin
With all this talk of num_girls, the only thing I can think of is Rohypnol...
Admin
Brute force solution is Haskell, main function is abreast (and not pretty printed):
Admin
Is is just me, or doesn't Flo sell insurance, and ride a motorcycle (a 900 V-twin) to work. She isn't a school girl as far as I know. I could be mistaken, but I believe that Flo is a more Progressive person!
Admin
Thats just her job. Take the namebadge off, and you get.... SCHOOLGIRL
Admin
select girl into #chicks from ( select 'A' as girl union all select 'B' union all select 'C' union all select 'D' union all select 'E' union all select 'F' union all select 'G' union all select 'H' union all select 'I' union all select 'J' union all select 'K' union all select 'L' union all select 'M' union all select 'N' union all select 'O' ) harem
select top 35 * from ( select a.girl + b.girl + c.girl as chickonchickonchick from #chicks a cross join #chicks b cross join #chicks c where a.girl <> b.girl and a.girl <> c.girl and b.girl <> c.girl ) morecrap
drop table #chicks
Admin
First five results: ACB ADB AEB AFB AGB
Admin
Cause when they actually write the programs, we end up with fodder for thedailywft.com. :)
Admin
DOH! I'm an idiot :)
Admin
The wording is very unclear however given that it says 455 combinations I am assuming by abreast it means in the same row.
If they meant literally side by side then there would be 2730 combinations to choose from
Admin
Admin
Computing and printing are not the same thing, or so I tell all the secretaries who show up at our developer interviews.
Admin
I'd love to go to an all-girl school
Admin
Compiler error: Too many arguments when calling Girl()
Admin
I mean, I have no idea what this gibberish means.
But it looks right to me.
Admin
Hmm, I thought I'd better throw out a PERL implementation :)
Admin
Admin
... snipped whining ...
When I first started coming here, about four years ago, this place was like a programmer's bar, where you could sit around, engage in friendly banter, throw darts at a target if you were so inclined, and generally relax and have a good time in the company of like-minded professionals.
Now, all of a sudden it's like being in 7th grade. YOU WILL PAY ATTENTION! YOU WILL TALK ABOUT THE SUBJECT AT HAND! OR YOU WILL BE SENT TO THE PRINCIPAL'S OFFICE!
... snipped tear shedding ...
Note from Alex: Yeah yeah, I get it, TDWTF has been going down hill since day two, I jump the shark at least once a week, you're going to stop reading, etc. You are more than welcome to hang out at the forums, where there is virtually no moderation... but most of the (silent) readers don't want to see you bloviate in the comments about nonsense, especially in a coding challenge article.
Admin
Ruby
Admin
It's not really clear from the question what's being requested. This is my interpretation:
Given a unique list L of length LC, produce a set of sets SS of size G (girl count) arranged in N groups (rows) over D days (columns) such that:
Easy:
Medium: 3) Solve for any length LC, and for the day count ((LC-1)/2), given LC mod 3 == 0 and LC mod 2 == 1
Difficult: 4) Extend Easy as one week to 13 weeks, such that no complete set repeats ever, and such that the pair restriction is set per-week
Given that interpretation, it's actually just a pretty straightforward column/row restrained depth first search, and this basically boils down to a freshman example of Don Knuth's algorithm X.
Admin
WHERE IS ALICE?!?!? AND EVE!!!!
Admin
Since everyone loves C#
It may be possible to optimise this by replacing Random with a quantum-based generator, and putting a DestroyUniverse() in the catch block.
Admin
You are not alone. 3 abreast brings total recall to mind. [image]
Admin
Admin
Admin
I'd rather love to see proper C#... not this silly throw-catch jump followed by goto. :-w
Anyway, IMO the problem with your solution is that you can't guarantee that any (random) choice of results for the first days will be extensible to a solution...
Admin
The relevant graph theory construction is called a Steiner Triple System.
Admin
What would be really cool would be a solution involving a not-yet-invented language, such as C++0x with added constraints goodness. (See Stepanov's latest book for possible approaches.) At least that way you'd be writing algorithms with the possibility of reuse.
Other than that, I'm sticking with my theory that Haskell is the way to go. I can't write it, but I can appreciate it.
Admin
Prolog?
Admin
Easy problem: 3185 rows x 210 columns Medium problem, n=21: 13300 rows x 420 columns Hard: 41405 rows x 3185 columns
As the algorithm is exponential in the worst case it's a question of being lucky with the heuristics.
Admin
How do you arrive at these numbers? It would seem that there are 35 slots (7 days times 5 groups) to fill with a selection from 455 possible groups. This gives a rowcount of 35 * 455 = 15925 rows. Also the column count (number of restraints) would be 245 = 210 (only one of each pair) + 35 (only one group in each slot).
Also, kudos to BYOC for bringing a problem which made me try out several different approaches. :-)
Admin
Admin
The set I try to cover is {(g1, g2) | g1,g2 in G and g1 < g2} U {(g, d) | g in G and d in D}.
The sets I use to cover it are {S(g1, g2, g3, d) | g1,g2,g3 in G and g1 < g2 < g3 and d in D} where S(g1, g2, g3, d) = {(g1, g2), (g1, g3), (g2, g3), (g1, d), (g2, d), (g3, d)}.
Therefore the medium problem has (num_girls CHOOSE 3) * num_days rows and (num_girls CHOOSE 2) + (num_girls * num_days) columns.
Following some research, and relying on an unproven conjecture, I have now solved (an interpretation of) the hard problem by the simple technique of finding a solution to the easy problem, removing the corresponding rows from the matrix, and trying again. I tried to post a solution here, but apparently it looks like spam: I shall post it in the forum.
Addendum (2009-09-18 09:21): Oops. I wasn't removing all the rows I should have done. Now fixed and 6 weeks generated after 10 minutes...
Addendum (2009-09-18 12:21): And still only 6 weeks generated after more than 3 hours. How embarrassing.
Admin
Riiight. Because a "while(true){ continue;/break;} is much more proper... <rolleyes/>
Here's a nickel kid. Go buy yourself a proper programming education.
Admin
Admin
The mere fact that you would find that suggestion laughable does confirm the fact that you need proper programming education.
can be converted to:
God have mercy on your coworkers' souls.
Admin
Slightly less non-serious solution.
I don't suppose there's a cleaner way to break out of two loops?