Board index » Word on the Street... » General Discussion




Post new topic Reply to topic  [ 21 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: prolog is great
PostPosted: Thu Jan 31, 2008 4:39 pm 
Offline
User avatar
Administrator
 Profile

Joined: Sat Oct 16, 2004 10:51 pm
Posts: 14534
Location: Mesa,AZ
There's really nothing like logic programming, is there?

Code:
dog('Fido').
dog('Stan').

cat('Tabby').

eats(X, Y) :-
   dog(X),
   cat(Y).


Code:
> eats('Fido', 'Stan').

No.
> eats('Fido', Cat).

Cat = 'Tabby'
Yes.
> eats(X, 'Tabby').

X = 'Fido'
X = 'Stan'
Yes.


All sorts of things are imaginable with prolog. Why, yesterday, I was even using it to solve logic puzzles.

_________________
John Adams wrote:
In my many years I have come to a conclusion that one useless man is a shame, two is a law firm, and three or more is a congress.


Top
 
 Post subject: Re: prolog is great
PostPosted: Thu Jan 31, 2008 4:47 pm 
Offline
User avatar
The Maleficent
 WWW  Profile

Joined: Sat Oct 16, 2004 11:17 pm
Posts: 13551
Location: is a jerk in wyoming
Gender: Female
great thread.

_________________
lennytheweedwhacker wrote:
That's it. I'm going to Wyoming.
Alex wrote:
you are the human wyoming


Top
 
 Post subject: Re: prolog is great
PostPosted: Thu Jan 31, 2008 4:56 pm 
Offline
User avatar
Reissued
 Profile

Joined: Tue Apr 11, 2006 10:53 pm
Posts: 21098
Location: where do you think?
can it solve crossword puzzles?

_________________
it's saturday night... i have no date, a 2 liter bottle of shasta, and my all-rush mix tape. let's rock.

Soma. wrote:
In summary, you can't go wrong with Muse live.


Top
 
 Post subject: Re: prolog is great
PostPosted: Thu Jan 31, 2008 5:30 pm 
Offline
User avatar
Administrator
 Profile

Joined: Sat Oct 16, 2004 10:51 pm
Posts: 14534
Location: Mesa,AZ
denverapolis wrote:
can it solve crossword puzzles?


Well, crossword puzzles aren't really logic, but I suppose if you tell it which words had to be used, it could figure out where they all go.

_________________
John Adams wrote:
In my many years I have come to a conclusion that one useless man is a shame, two is a law firm, and three or more is a congress.


Top
 
 Post subject: Re: prolog is great
PostPosted: Thu Jan 31, 2008 5:49 pm 
Offline
User avatar
Needs to start paying for bandwidth
 Profile

Joined: Fri Sep 02, 2005 5:20 am
Posts: 31173
:peace: Tabby


Top
 
 Post subject: Re: prolog is great
PostPosted: Fri Feb 01, 2008 12:27 am 
Offline
User avatar
Mike's Maniac
 Profile

Joined: Mon Oct 18, 2004 12:58 pm
Posts: 19700
Location: long island
Gender: Female
made my head hurt

_________________
I Got Boner wrote:
ladies, its getting bigger...

ever dream of escaping


Top
 
 Post subject: Re: prolog is great
PostPosted: Fri Feb 01, 2008 7:48 am 
Offline
User avatar
Unthought Known
 Profile

Joined: Sun Oct 17, 2004 3:11 am
Posts: 6822
Location: College Station, TX, USA
Gender: Male
It could do Sudoku I supposed, since they're just glorified logic puzzles using only numbers.

_________________
.whoop


Top
 
 Post subject: Re: prolog is great
PostPosted: Fri Feb 01, 2008 8:02 am 
Offline
User avatar
Temporary Secretary
 WWW  Profile

Joined: Thu Apr 13, 2006 3:51 am
Posts: 43609
Location: My city smells like Cheerios
Gender: Male
i use tarski's world

_________________
"No matter how hard you kill Jesus, he would always just come back and hit you twice as hard."


Top
 
 Post subject: Re: prolog is great
PostPosted: Fri Feb 01, 2008 2:24 pm 
Offline
User avatar
Administrator
 Profile

Joined: Sat Oct 16, 2004 10:51 pm
Posts: 14534
Location: Mesa,AZ
ManiacalClown wrote:
It could do Sudoku I supposed, since they're just glorified logic puzzles using only numbers.


Hey, you just gave me something to try at work today!

_________________
John Adams wrote:
In my many years I have come to a conclusion that one useless man is a shame, two is a law firm, and three or more is a congress.


Top
 
 Post subject: Re: prolog is great
PostPosted: Fri Feb 01, 2008 2:33 pm 
Offline
User avatar
Founding Bitch
 Profile

Joined: Sun Oct 17, 2004 1:09 pm
Posts: 13868
Location: Norn Iron
What was that computer program from ages ago that made .bas files? Basic, was it? I remember playing around a lot with that in grammar school.

_________________
Wilderness 1:49-2:04. Diamond Dust.

Window Washer's Dream - Planet Sonata's Intension


Top
 
 Post subject: Re: prolog is great
PostPosted: Fri Feb 01, 2008 3:32 pm 
Offline
User avatar
Needs to start paying for bandwidth
 Profile

Joined: Fri Sep 02, 2005 5:20 am
Posts: 31173
Juvenal wrote:
What was that computer program from ages ago that made .bas files? Basic, was it? I remember playing around a lot with that in grammar school.

anyone remember this:
Image

when we first got that at home i got really good at it, then i went to a friends house who was running Windows 95 and i thought he was from the future or something. turned out i was like 10 years behind.


Top
 
 Post subject: Re: prolog is great
PostPosted: Fri Feb 01, 2008 4:56 pm 
Offline
User avatar
a saucerful of secrets
 Profile

Joined: Thu Feb 02, 2006 11:08 pm
Posts: 15892
Location: a wee green island
Gender: Male
Image

_________________
cutuphalfdead wrote:
Man, we were all a bunch of faggots.



You talkin to me?


Top
 
 Post subject: Re: prolog is great
PostPosted: Fri Feb 01, 2008 6:51 pm 
Offline
User avatar
Administrator
 Profile

Joined: Sat Oct 16, 2004 10:51 pm
Posts: 14534
Location: Mesa,AZ
Sudoku:

Code:
cell(1, _, _, _, _, _, _, _, _, _).
cell(2, _, _, _, _, _, _, _, _, _).
cell(3, _, _, _, _, _, _, _, _, _).
cell(4, _, _, _, _, _, _, _, _, _).
cell(5, _, _, _, _, _, _, _, _, _).
cell(6, _, _, _, _, _, _, _, _, _).
cell(7, _, _, _, _, _, _, _, _, _).
cell(8, _, _, _, _, _, _, _, _, _).
cell(9, _, _, _, _, _, _, _, _, _).

row(1, _, _, _, _, _, _, _, _, _).
row(2, _, _, _, _, _, _, _, _, _).
row(3, _, _, _, _, _, _, _, _, _).
row(4, _, _, _, _, _, _, _, _, _).
row(5, _, _, _, _, _, _, _, _, _).
row(6, _, _, _, _, _, _, _, _, _).
row(7, _, _, _, _, _, _, _, _, _).
row(8, _, _, _, _, _, _, _, _, _).
row(9, _, _, _, _, _, _, _, _, _).

col(1, _, _, _, _, _, _, _, _, _).
col(2, _, _, _, _, _, _, _, _, _).
col(3, _, _, _, _, _, _, _, _, _).
col(4, _, _, _, _, _, _, _, _, _).
col(5, _, _, _, _, _, _, _, _, _).
col(6, _, _, _, _, _, _, _, _, _).
col(7, _, _, _, _, _, _, _, _, _).
col(8, _, _, _, _, _, _, _, _, _).
col(9, _, _, _, _, _, _, _, _, _).

solve(A11, A12, A13, B14, B15, B16, C17, C18, C19, A21, A22, A23, B24, B25, B26, C27, C28, C29,
   A31, A32, A33, B34, B35, B36, C37, C38, C39, D41, D42, D43, E44, E45, E46, F47, F48, F49,
   D51, D52, D53, E54, E55, E56, F57, F58, F59, D61, D62, D63, E64, E65, E66, F67, F68, F69,
   G71, G72, G73, H74, H75, H76, I77, I78, I79, G81, G82, G83, H84, H85, H86, I87, I88, I89,
   G91, G92, G93, H94, H95, H96, I97, I98, I99) :-

   cell(1, A11, A12, A13, A21, A22, A23, A31, A32, A33 ),
   cell(2, B14, B15, B16, B24, B25, B26, B34, B35, B36 ),
   cell(3, C17, C18, C19, C27, C28, C29, C37, C38, C39 ),
   cell(4, D41, D42, D43, D51, D52, D53, D61, D62, D63 ),
   cell(5, E44, E45, E46, E54, E55, E56, E64, E65, E66 ),
   cell(6, F47, F48, F49, F57, F58, F59, F67, F68, F69 ),
   cell(7, G71, G72, G73, G81, G82, G83, G91, G92, G93 ),
   cell(8, H74, H75, H76, H84, H85, H86, H94, H95, H96 ),
   cell(9, I77, I78, I79, I87, I88, I89, I97, I98, I99 ),

   row(1, A11, A12, A13, B14, B15, B16, C17, C18, C19 ),
   row(2, A21, A22, A23, B24, B25, B26, C27, C28, C29 ),
   row(3, A31, A32, A33, B34, B35, B36, C37, C38, C39 ),
   row(4, D41, D42, D43, E44, E45, E46, F47, F48, F49 ),
   row(5, D51, D52, D53, E54, E55, E56, F57, F58, F59 ),
   row(6, D61, D62, D63, E64, E65, E66, F67, F68, F69 ),
   row(7, G71, G72, G73, H74, H75, H76, I77, I78, I79 ),
   row(8, G81, G82, G83, H84, H85, H86, I87, I88, I89 ),
   row(9, G91, G92, G93, H94, H95, H96, I97, I98, I99 ),

   col(1, A11, A21, A31, D41, D51, D61, G71, G81, G91 ),
   col(2, A12, A22, A32, D42, D52, D62, G72, G82, G92 ),
   col(3, A13, A23, A33, D43, D53, D63, G73, G83, G93 ),
   col(4, B14, B24, B34, E44, E54, E64, H74, H84, H94 ),
   col(5, B15, B25, B35, E45, E55, E65, H75, H85, H95 ),
   col(6, B16, B26, B36, E46, E56, E66, H76, H86, H96 ),
   col(7, C17, C27, C37, F47, F57, F67, I77, I87, I97 ),
   col(8, C18, C28, C38, F48, F58, F68, I78, I88, I98 ),
   col(9, C19, C29, C39, F49, F59, F69, I79, I89, I99 ),

   block([A11, A12, A13, A21, A22, A23, A31, A32, A33]),
   block([B14, B15, B16, B24, B25, B26, B34, B35, B36]),
   block([C17, C18, C19, C27, C28, C29, C37, C38, C39]),
   block([D41, D42, D43, D51, D52, D53, D61, D62, D63]),
   block([E44, E45, E46, E54, E55, E56, E64, E65, E66]),
   block([F47, F48, F49, F57, F58, F59, F67, F68, F69]),
   block([G71, G72, G73, G81, G82, G83, G91, G92, G93]),
   block([H74, H75, H76, H84, H85, H86, H94, H95, H96]),

   block([A11, A12, A13, B14, B15, B16, C17, C18, C19]),
   block([A21, A22, A23, B24, B25, B26, C27, C28, C29]),
   block([A31, A32, A33, B34, B35, B36, C37, C38, C39]),
   block([D41, D42, D43, E44, E45, E46, F47, F48, F49]),
   block([D51, D52, D53, E54, E55, E56, F57, F58, F59]),
   block([D61, D62, D63, E64, E65, E66, F67, F68, F69]),
   block([G71, G72, G73, H74, H75, H76, I77, I78, I79]),
   block([G81, G82, G83, H84, H85, H86, I87, I88, I89]),
   block([G91, G92, G93, H94, H95, H96, I97, I98, I99]),

   block([A11, A21, A31, D41, D51, D61, G71, G81, G91]),
   block([A12, A22, A32, D42, D52, D62, G72, G82, G92]),
   block([A13, A23, A33, D43, D53, D63, G73, G83, G93]),
   block([B14, B24, B34, E44, E54, E64, H74, H84, H94]),
   block([B15, B25, B35, E45, E55, E65, H75, H85, H95]),
   block([B16, B26, B36, E46, E56, E66, H76, H86, H96]),
   block([C17, C27, C37, F47, F57, F67, I77, I87, I97]),
   block([C18, C28, C38, F48, F58, F68, I78, I88, I98]),
   block([C19, C29, C39, F49, F59, F69, I79, I89, I99]),

   write([A11, A12, A13, B14, B15, B16, C17, C18, C19]), write('\n'),
   write([A21, A22, A23, B24, B25, B26, C27, C28, C29]), write('\n'),
   write([A31, A32, A33, B34, B35, B36, C37, C38, C39]), write('\n'),
   write([D41, D42, D43, E44, E45, E46, F47, F48, F49]), write('\n'),
   write([D51, D52, D53, E54, E55, E56, F57, F58, F59]), write('\n'),
   write([D61, D62, D63, E64, E65, E66, F67, F68, F69]), write('\n'),
   write([G71, G72, G73, H74, H75, H76, I77, I78, I79]), write('\n'),
   write([G81, G82, G83, H84, H85, H86, I87, I88, I89]), write('\n'),
   write([G91, G92, G93, H94, H95, H96, I97, I98, I99]), write('\n').

block(A) :-
   perm([1,2,3,4,5,6,7,8,9],A).

perm([], []).
perm([X|Y],Z) :- perm(Y,W), takeout(X,Z,W).

takeout(X, [X|R], R).
takeout(X, [F|R], [F|S]) :- takeout(X, R, S).


Takes forever to solve anything, since it has to brute force through every possible combination, but it's really easy to define the logic, and not nearly as complex as it would be if it were written in, say, lisp. But lisp is obviously better for problems like this, as it allows you to define not just the logic but the heuristics used to solve it.

_________________
John Adams wrote:
In my many years I have come to a conclusion that one useless man is a shame, two is a law firm, and three or more is a congress.


Top
 
 Post subject: Re: prolog is great
PostPosted: Fri Feb 01, 2008 6:53 pm 
Offline
User avatar
Needs to start paying for bandwidth
 Profile

Joined: Fri Sep 02, 2005 5:20 am
Posts: 31173
obviously.


Top
 
 Post subject: Re: prolog is great
PostPosted: Fri Feb 01, 2008 10:42 pm 
Offline
User avatar
Administrator
 Profile

Joined: Sat Oct 16, 2004 10:51 pm
Posts: 14534
Location: Mesa,AZ
I'm thinking it might have some superfluous logic in it, though. It might be able to work just with the "block" parts, but I'm not enough of a prolog expert really.

_________________
John Adams wrote:
In my many years I have come to a conclusion that one useless man is a shame, two is a law firm, and three or more is a congress.


Top
 
 Post subject: Re: prolog is great
PostPosted: Fri Feb 01, 2008 10:47 pm 
Offline
User avatar
Poney Girl
 Profile

Joined: Sat Oct 16, 2004 11:17 pm
Posts: 45120
conoalias wrote:
obviously.


Yeah, OBVIOUSLY.


I need to make me a Over My Head Rickticon!

_________________
Aliveguy1 wrote:
rediculous


Top
 
 Post subject: Re: prolog is great
PostPosted: Sat Feb 02, 2008 2:47 am 
Offline
User avatar
Yeah Yeah Yeah
 Profile

Joined: Tue Jun 28, 2005 6:28 pm
Posts: 4597
Location: meh
Can I have those two minutes back I just used to read this thread?

_________________
I'm annoyed at stuff


Top
 
 Post subject: Re: prolog is great
PostPosted: Sat Feb 02, 2008 4:17 am 
Offline
User avatar
Mike's Maniac
 Profile

Joined: Mon Oct 18, 2004 12:58 pm
Posts: 19700
Location: long island
Gender: Female
and still it makes my head hurt

_________________
I Got Boner wrote:
ladies, its getting bigger...

ever dream of escaping


Top
 
 Post subject: Re: prolog is great
PostPosted: Sat Feb 02, 2008 9:59 am 
Offline
User avatar
Unthought Known
 Profile

Joined: Sun Oct 17, 2004 3:11 am
Posts: 6822
Location: College Station, TX, USA
Gender: Male
I'm glad I gave you a neat little project to work on. :D

_________________
.whoop


Top
 
 Post subject: Re: prolog is great
PostPosted: Sat Feb 02, 2008 4:39 pm 
Offline
User avatar
Administrator
 Profile

Joined: Sat Oct 16, 2004 10:51 pm
Posts: 14534
Location: Mesa,AZ
ManiacalClown wrote:
I'm glad I gave you a neat little project to work on. :D


I'm thinking about doing it in lisp now, but that might make me go insane for a day or two.

_________________
John Adams wrote:
In my many years I have come to a conclusion that one useless man is a shame, two is a law firm, and three or more is a congress.


Top
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 21 posts ]  Go to page 1, 2  Next

Board index » Word on the Street... » General Discussion


Who is online

Users browsing this forum: No registered users and 30 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
It is currently Fri Feb 13, 2026 12:09 pm