s-webber / projog

Prolog programming for the Java platform.
Apache License 2.0
34 stars 9 forks source link

What is required to get the solutions to "Ninety-Nine Prolog Problems" working with Projog? #17

Closed s-webber closed 9 years ago

s-webber commented 10 years ago

There are a collection of 99 Prolog Problems hosted at:

https://sites.google.com/site/prologsite/prolog-problems

What is required to make the provided solutions to these problems work with Projog?

i.e. What functionality required by the solutions is not already provided by the built-in predicates and arithmetic functions of Projog?

s-webber commented 10 years ago

Reviewed solutions to "1. Prolog Lists" section - required functionality currently missing from Projog are:

s-webber commented 10 years ago

Reviewed solutions to "2. Arithmetic" section - required functionality currently missing from Projog are:

s-webber commented 10 years ago

Reviewed solutions to "3. Logic and Codes" section - required functionality currently missing from Projog are:

s-webber commented 10 years ago

Reviewed solutions to "4. Binary Trees" section - required functionality currently missing from Projog are:

s-webber commented 10 years ago

Reviewed solutions to "5. Multiway Trees" - no new functionality required.

s-webber commented 10 years ago

Reviewed solutions to "6. Graphs" section - required functionality currently missing from Projog are:

(A number of these missing features are to do with the adding and removal of items in the knowledge base.)

s-webber commented 10 years ago

Reviewed solutions to "7. Miscellaneous" section - required functionality currently missing from Projog are:

s-webber commented 9 years ago

Output from running some of the example solutions:

p7_07.pl - Sudoku puzzle solver

> projog-console p7_07.pl

[20060653] INFO Reading prolog source in: projog-bootstrap.pl from classpath
Projog Console
www.projog.org
[20060653] INFO Reading prolog source in: tmp\99problems\p7_07.pl from file system

?- test(1).

.  .  4 | 8  .  . | .  1  7
        |         |
6  7  . | 9  .  . | .  .  .
        |         |
5  .  8 | .  3  . | .  .  4
--------+---------+--------
3  .  . | 7  4  . | 1  .  .
        |         |
.  6  9 | .  .  . | 7  8  .
        |         |
.  .  1 | .  6  9 | .  .  5
--------+---------+--------
1  .  . | .  8  . | 3  .  6
        |         |
.  .  . | .  .  6 | .  9  1
        |         |
2  4  . | .  .  1 | 5  .  .

9  3  4 | 8  2  5 | 6  1  7
        |         |
6  7  2 | 9  1  4 | 8  5  3
        |         |
5  1  8 | 6  3  7 | 9  2  4
--------+---------+--------
3  2  5 | 7  4  8 | 1  6  9
        |         |
4  6  9 | 1  5  3 | 7  8  2
        |         |
7  8  1 | 2  6  9 | 4  3  5
--------+---------+--------
1  9  7 | 5  8  2 | 3  4  6
        |         |
8  5  3 | 4  7  6 | 2  9  1
        |         |
2  4  6 | 3  9  1 | 5  7  8

1 solution

yes ;

no

?- test(2).

3  .  . | .  7  1 | .  .  .
        |         |
.  5  . | .  .  . | 1  8  .
        |         |
.  4  . | 8  .  . | .  .  .
--------+---------+--------
.  .  6 | 2  .  . | 3  .  .
        |         |
.  .  1 | .  5  . | 8  .  .
        |         |
.  .  3 | .  .  8 | 2  .  .
--------+---------+--------
.  .  . | .  .  3 | .  4  .
        |         |
.  6  4 | .  .  . | .  7  .
        |         |
.  .  . | 9  6  . | .  .  1

3  8  9 | 5  7  1 | 4  6  2
        |         |
6  5  7 | 4  3  2 | 1  8  9
        |         |
1  4  2 | 8  9  6 | 7  3  5
--------+---------+--------
8  7  6 | 2  1  9 | 3  5  4
        |         |
4  2  1 | 3  5  7 | 8  9  6
        |         |
5  9  3 | 6  4  8 | 2  1  7
--------+---------+--------
9  1  5 | 7  2  3 | 6  4  8
        |         |
2  6  4 | 1  8  5 | 9  7  3
        |         |
7  3  8 | 9  6  4 | 5  2  1

1 solution

yes ;

no

p7_08.pl - Nonogram puzzle solver

> projog-console p7_08.pl

[20060653] INFO Reading prolog source in: projog-bootstrap.pl from classpath
Projog Console
www.projog.org
[20060653] INFO Reading prolog source in: p7_08.pl from file system

?- test('Hen',1).

   * * *          3
 * *   *          2 1
   * * *     * *  3 2
     * *     * *  2 2
     * * * * * *  6
 *   * * * * *    1 5
 * * * * * *      6
         *        1
       * *        2
 1 3 1 7 5 3 4 3
 2 1 5 1

yes ;

no

p7_09.pl - Wordfit puzzle solver

>projog-console p7_09.pl

[20060653] INFO Reading prolog source in: projog-bootstrap.pl from classpath
Projog Console
www.projog.org
[20060653] INFO Reading prolog source in: p7_09.pl from file system
[20060653] INFO Reading prolog source in: p7_09-readfile.pl from file system
[15061333] WARN Not defined: crossword
[20060653] INFO Reading prolog source in: p1_28.pl from file system

?- crossword('p7_09b.dat',2).
|P TUEBINGEN TRAUBENZUCKER|
|R A       E A         R I|
|O TEMPERAMENT   FORTUNA V|
|T T       F       E   N I|
|EGERIA ZEUS T SAMPAN  K E|
|K R         E T   U   E R|
|T S WALZER  LIANE MADONNA|
|O A A  A  TAL N   U   K  |
|RELIGION  R   N   R TIARA|
|A L G  K  U   I S   I S  |
|T   O     E STOIKER L S  |
| GRANAT   F   L E  OSTEN |
|  E     S F     L   I   C|
|  G  TURKMENEN VENDETTA H|
|  I B N R L     T     T R|
| ISEL T U  H STETTIN  T O|
|S T A E P  I   T    DER N|
|E E S R E BRIEFTAUBE  A O|
|KARRE T L  T   A    I K G|
|U     A    E AAL M  T T R|
|N ALLENSTEIN  N  I  A I A|
|D L    T      K  S  L O P|
|EOSIN  USAMBARA SERBIEN H|
|  E    H      R  R  E   I|
|HANNIBAL   MELASSE  NONNE|

yes ;

no
s-webber commented 9 years ago

Note: did not implement statistics/2 - but #103 describes workaround.