Re: Generating Puzzle Solutions
- From: Markus Triska <triska@xxxxxx>
- Date: Sat, 25 Jun 2005 22:36:50 +0200
Ovid wrote:
>
> Anyone care to try their hand at a Prolog solution so I can try to
> convert it to AI::Prolog?
>
Here is a program that you can try with SWI Prolog to generate
admissible strategies:
http://stud4.tuwien.ac.at/~e0225855/oddball.pl
I used it to find (fixed) strategies in addition to those posted on
Perlmonks. I copied the first two rounds from their solution and limited
the search to the last round (line 139f.) for illustration.
You can test whether a given strategy lets you infer the odd ball and
its quality in all cases:
?- Strategy = [[5, 6, 8, 10]-[7, 9, 11, 12], [2, 3, 4, 7]-[5, 6, 11,
12], [1, 2, 5, 7]-[4, 9, 10, 12]], test_strategy(Strategy).
State [-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] OK
State [0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] OK
State [0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0] OK
.... etc.
Best regards,
Markus.
.
- References:
- Generating Puzzle Solutions
- From: Ovid
- Generating Puzzle Solutions
- Prev by Date: Re: trail stack, global stack
- Next by Date: Re: Problem with SWI Prolog
- Previous by thread: Re: Generating Puzzle Solutions
- Index(es):