[thechat] Programming Problem

Beau Hartshorne beau at members.evolt.org
Thu Nov 8 16:11:47 CST 2001


My girlfriend introduced me to a card game called "24". In the game,
aces are valued at 1 and royalty is valued at 10. Four cards are laid
out on the table, and the first person to figure out a way to somehow
get the cards to add/multiply/subtract/divide evenly to 24 wins the
round. Each card can be used in the calculation only once.

So if these four cards were laid out: 7 3 1 3
One possible solution is: 7*3+3*1

For these cards: 2 10 1 2
One possible solution is: (1+2)*(10-2)

My question is how would you go about writing a computer program to find
every possible solution for every possible combination of cards?

Ideas?

Beau





More information about the thechat mailing list