[thechat] Programming Problem

rudy r937 at interlog.com
Thu Nov 8 20:20:46 CST 2001


sql?  you'd never get a result set back, it'd be too large   ;o)


here's how i'd do it...

1. obtain hammer
2. ...

;o)


seriously, you're looking at a tremendously large number

the number of distinct combinations of four cards drawn from a playing card
deck is 52*51*50*49 = 6,497,400

if you disregard suits, there are fewer combos, but i can't be bothered
counting them -- you can't just divide 6,497,400 by 4, because there's only
one hand with all sevens, but 144 different hands with two sevens and two
eights....  urggle...

if the number of operators is 4, and they don't have to be distinct, then
there are 4**3 = 64 ways of combining four cards (i.e. using three infix
operators), but then the possibility of parentheses throws everything into
a cocked hat

joe, did your php program take parentheses into consideration?

   (3*7)+4-1  <>  3*(7+4)-1  <>  3*(7+4-1)

and what about order?  again, there's some redundancy

  (3*7)+4-1   =  (7*3)+4-1  =  (3*7)-1+4  = (7*3)-1+4

bottom line?  forget the computer program, have a couple beers instead

i bet there's an optimum (that will vary from person to person) somewhere
between two beers and seventeen where you get really good at winning the
game...

rudy






More information about the thechat mailing list