Upcoming SlideShare
×

# Friday (9 dec) Slides

334 views

Published on

Published in: Technology, Art & Photos
0 Likes
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

• Be the first to like this

Views
Total views
334
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
10
0
Likes
0
Embeds 0
No embeds

No notes for slide

### Friday (9 dec) Slides

1. 1. Exercise ClassPROLOG
2. 2. Recursive operation Factorial Example in C++
3. 3. Termination Ruleif (n == 0) return 1;
4. 4. Coloring Map
5. 5. a(1,2). a(2,1).
6. 6. a(1,2).a(2,1).a(1,3).a(3,1).a(1,4).a(4,1).a(1,5).a(5,1).a(2,3).a(3,2).a(2,4).a(4,2).a(3,4).a(4,3).a(4,5).a(5,4).
7. 7. Encode a and b aj(1,2).colorings. aj(2,1).color(1,red,a). aj(1,3).color(1,red,b). aj(3,1). aj(1,4).color(2,blue,a).color(2,blue,b). aj(4,1). aj(1,5).color(3,green,a). aj(5,1).color(3,green,b). aj(2,3).color(4,yellow,a). aj(3,2). aj(2,4).color(4,blue,b).color(5,blue,a). aj(4,2).color(5,green,b). aj(3,4). aj(4,3). aj(4,5). aj(5,4).
8. 8. conflict(Coloring) :-adjacent(X,Y),color(X,Color,Coloring), aj(1,2). color(1,red,a).color(Y,Color,Coloring). aj(2,1). color(1,red,b). conflict(Coloring) :- aj(1,3). color(2,blue,a). aj(X,Y), aj(3,1). color(X,Color,Coloring), color(2,blue,b). color(Y,Color,Coloring). aj(1,4). aj(4,1). color(3,green,a). aj(1,5). color(3,green,b). aj(5,1). color(4,yellow,a). aj(2,3). color(4,blue,b). aj(3,2). color(5,blue,a). aj(2,4). color(5,green,b). aj(4,2). aj(3,4). aj(4,3). aj(4,5). aj(5,4).
9. 9. Talk to Prolog Making a chat bot: repeat for ever… predict answers Have global answers Save the chat….
10. 10. Reading and writing in prolog: