The Game of 24 puzzle

Mostly as a holiday’s entertainment I’ve put a solver and generator for the puzzle of 24 at:

The special instance (also a card game) is this: given 4 numbers, use each of them and the 4 basic arithmetic operations to obtain 24 as a result.

I guess, it is an example of problem that is unlikely to be solved as simply and elegantly in languages other than Prolog, especially when it works both as a solver and a generator (and generalized to any operations, any numbers and any result).

4 Likes