• Stars
    star
    567
  • Rank 78,634 (Top 2 %)
  • Language
    Prolog
  • Created about 12 years ago
  • Updated about 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Some simple examples for new Prolog programmers

prolog-examples

Some simple examples for new Prolog programmers. Varying degrees of polish. Have fun.

finished examples

detective problem

These are two approaches to solving a detective's problem. She's interrogated three witnesses to a murder, all of whom are also suspects. The problem is to determine which of the suspect's testimony is inconsistent with the others.

  • detectivepuzzle.pl - My original solution, written when I was new to Prolog. It now feels very 'imperative'
  • newdetective.pl - I recently rewrote it
  • adriandetective.pl - Adrian King's solution

talespin2.pl

Implementation of a classic story generator (note that a far better implementation is at https://github.com/SWI-Prolog-Education/talespin-annie)

tictactoe.pl

Implementation of tic tac toe

birds.pl

The birds example from the 'expert systems in Prolog' tutorial by Amzi (on the web)

cannibals2.pl

A well commented example of the cannibals/missionaries problem

This was used as an example for a talk whose notes are in may15version.txt

cannibals2nocomments.pl has fewer comments, but has some additional capabilities

cuttutorial.pl

A little story analogy to help understand cut and cut, fail

emoticons.pl

A joke. I'm known for my happy array of 'smiley' emoticons. Sometimes others have trouble understanding my smileys. This program purports to help.

familytree.pl

The classic familytree example. This one has two separate families in it. (left as exercise for the reader to find the two disconnected groups).

socketdemo.pl

Demonstration of reading from a socket

Constraint examples

Examples of CLPFD

addlists.pl

Constrains two lists to pairwise add to a third.

children.pl

A fully worked problem involving seating children in a classroom

constraintolist.pl

A fully worked problem, constraining a variable to be a member of a list.

sudoku.pl

Solves a Sudoku puzzle by CLPFD

loops.pl

Demo of various ways to do in Prolog what you'd do with loops in an imperative language.

nqueens.pl

Implementation of the generalized version of the classic 8-queens problem.

techtree2.pl

solve game 'tech tree' problems using CHR.

More Repositories

1

swiplwebtut

A tutorial for the swipl web framework
Prolog
106
star
2

weblog

Web Framework for SWI-Prolog
Prolog
41
star
3

swipldcgtut

A tutorial for DCG's in swi-Prolog
Prolog
32
star
4

swiplclpfd

clp(fd) tutorial
Prolog
18
star
5

strangeloop

Materials for the Strangeloop workshop 'Real World Development Boot Camp In SWI-Prolog'
Prolog
17
star
6

declswiplweb

End to end declarative web programming with no JS using htmx and SWI-Prolog
Prolog
13
star
7

swiplchrtut

Tutorial for the CHR system
CSS
12
star
8

JavaPengine

Former home Java language client (master) for SWI-Prolog pengines - see simularity/JavaPengine
Java
10
star
9

amziexpertsystemsinprolog

This is a fork of the amzi expert systems in prolog ported to swi-prolog and put in git instead of awkward file by file dl on amzi site
Prolog
9
star
10

node-red-pengines

node-red palette module for Pengines
HTML
8
star
11

identity

A pack for SWI-Prolog web framework to handle usernames, login, signup, and other user management
Prolog
8
star
12

RobotMotionInBlender

accompanying files for the article Robot Motion Planning In Blender
Shell
7
star
13

terfblocklist

semi-automatic tool to gather IDs of transphobic users on Twitter
Prolog
6
star
14

rogueutils

utilities for making roguelikes
Prolog
3
star
15

foxesandrabbits

Example for logtalk of predator prey simulation
Logtalk
3
star
16

swiplsitedesign

design documents for the SWI-Prolog website redesign
JavaScript
3
star
17

swiplstudenttut

FAQ for the many students we see on ##prolog who have repetitive questions.
Prolog
2
star
18

swiplmessage

Tutorial for the Quintus message printing system
Prolog
2
star
19

gcode

G Code library. G Code (RS-274) is a representation for commands for numerically contreolled machine tools
Prolog
2
star
20

fflpractice

Simple example of calling SWI-Prolog from within a C wrapper
C
2
star
21

life

talespin program that generates broad brush life stories
Prolog
2
star
22

holler

A message broadcasting system for Clojure
Clojure
2
star
23

spiderman

Site spider in swi-Prolog
Prolog
1
star
24

swiplmetatut

Metaprogramming in SWI-Prolog tutorial
HTML
1
star
25

tutorial-roadmap

A fake repository to hold an overall roadmap for the tutorials series
1
star
26

plweb

Fork of the swi-prolog.org plweb project for some updates on annierewrite
Prolog
1
star
27

swiplpengine

Tutorial for pengines
1
star
28

games4diversity

Games for diversity Game Jam
Prolog
1
star
29

plweb-www-was

fork of swipl plweb web pages
JavaScript
1
star
30

swiplrdftut

SWI-Prolog RDF Tutorial
Batchfile
1
star
31

enron

tools to work with the enron email corpus
Prolog
1
star
32

perchack

language to recognize gestures in a Creative time of flight camera
C++
1
star
33

plchatscript

SWI-Prolog interface to the chatscript engine
Prolog
1
star
34

swiplexceptions

Tutorial for the ISO standard exception mechanism as implemented by SWI-Prolog
HTML
1
star