Sudoku in Prolog

  Рет қаралды 31,898

The Power of Prolog

The Power of Prolog

Күн бұрын

Пікірлер
@nancyabigail1985
@nancyabigail1985 5 жыл бұрын
I have just watched 1 minute and I’m loving your video because you explained the relation betweens sudoku and combinatorial problems. Thank you so much!!!
@reasonerenlightened2456
@reasonerenlightened2456 3 жыл бұрын
The problem of Prolog is that the meaning is assigned by the human . d( [], X, X). d( [X | Y], Z, [X | W]) :- d( Y, Z, W). for Prolog is different than end( [], X, X). end( [X | Y], Z, [X | W]) :- end( Y, Z, W). but both are just the same as append( [], X, X). append( [X | Y], Z, [X | W]) :- append( Y, Z, W). Basically, the meaning remains in the head of the human and Prolog is completely void of capturing the meaning of the predicates, functors, atoms, etc. The same applies to any other programming language I am aware of. THEY ALL FAIL TO CAPTURE MEANING, AWARENESS, CONTEXT, etc. ! Why the programming languages are still not self-aware in the 21-st century ! That should really trouble you all.
@DaveYostCom
@DaveYostCom 11 ай бұрын
A lucid introduction to Prolog! Bravo.
@funkymaniak
@funkymaniak 4 жыл бұрын
Always such high quality videos, with such charming visuals. Thank you!
@ceving865
@ceving865 7 ай бұрын
Very well illustrated.
@DenisG631
@DenisG631 4 жыл бұрын
This is awesome. Thanks for the lecture!
@GeorgeElswefy
@GeorgeElswefy Жыл бұрын
what a masterpiece!
@MarkVolkmann
@MarkVolkmann Жыл бұрын
Regarding my previous comment, it does solve the puzzle if I give it one more clue. For example, if I tell it that the last value on the first row is 8 then it works.
@HakanKjellerstrand
@HakanKjellerstrand 5 жыл бұрын
Excellent!
@MrArteez
@MrArteez 5 жыл бұрын
really interesting video!
@ooloncolluphid9975
@ooloncolluphid9975 4 жыл бұрын
13:30 would we also be able to "generate" these "valid" sudoku puzzles using the predicate? that is, sudoku puzzles which admit one solution, say with N givens ? like if our role was to generate valid sudoku puzzles and not solve them :D ?
@ThePowerOfProlog
@ThePowerOfProlog 4 жыл бұрын
Yes, that's possible, using this code as a building block: Simply generate a fully instantiated Sudoku Latin square (possibly also given hints), and then remove hints as long as they still uniquely determine the Latin square!
@jcr11011966
@jcr11011966 5 жыл бұрын
very interesting. Nice talk
@junderfitting8717
@junderfitting8717 3 жыл бұрын
:- use_module(library(clpfd)).
@junderfitting8717
@junderfitting8717 3 жыл бұрын
add this line at the beginning to resolve"sudoku.pl:3:28: Syntax error: Operator expected"
@freddyjoaquinbasiliorojas2926
@freddyjoaquinbasiliorojas2926 3 жыл бұрын
Hello, Is there someone there who can help with some exercise in Prolog. I am new in language.
@mvaliente2001
@mvaliente2001 4 жыл бұрын
It'll be useful, for a newbie perspective, to include the code to import the required libraries in these videos, not just in the video description.
@ThePowerOfProlog
@ThePowerOfProlog 4 жыл бұрын
Yes, this may seem useful at first sight. However, it would be counterproductive: My goal is not to cement the status quo (i.e., the different system-specific libraries that must currently still be loaded to run these examples in some Prolog systems), but to encourage implementors of Prolog systems to make the needed functionality more readily available, so that fewer libraries need to be imported to run Prolog code in the first place! This will only work if enough people demand this from implementors. My goal is to enhance portability of code between different Prolog systems, and this will only work of more system-specific libraries are autoloaded or otherwise made accessible. For instance, Scryer Prolog already shows a recommended sample configuration file (~/.scryerrc) in its documentation, so that many libraries do not have to be loaded manually. Thank you for your interest, enjoy!
@reasonerenlightened2456
@reasonerenlightened2456 3 жыл бұрын
​@@ThePowerOfProlog Why the programming languages are still not self-aware in the 21-st century ! That should really trouble you all. The problem with Prolog is that the meaning is assigned by the human . d( [], X, X). d( [X | Y], Z, [X | W]) :- d( Y, Z, W). for Prolog is different than end( [], X, X). end( [X | Y], Z, [X | W]) :- end( Y, Z, W). but both are just the same as append( [], X, X). append( [X | Y], Z, [X | W]) :- append( Y, Z, W). Basically, the meaning remains in the head of the human and Prolog is completely void of capturing the meaning of the predicates, functors, atoms, etc. The same applies to any other programming language I am aware of. THEY ALL FAIL TO CAPTURE MEANING, AWARENESS, CONTEXT, etc. ! Prolog was supposed to be the language of AI but it is still not self-aware.
@ighmur
@ighmur 2 жыл бұрын
@@reasonerenlightened2456 As a human being I experiment daily awareness without intelligence and intelligence without awareness.
@jonnathan4189
@jonnathan4189 5 жыл бұрын
pl:8: Syntax error: operator_expected -> Vs ins 1..9,
@MrArteez
@MrArteez 5 жыл бұрын
check documentation of ins, it requires a module to be used.
@fabianschnieder5681
@fabianschnieder5681 2 жыл бұрын
@@MrArteez I used the module clpfd / clpz and its saying the same thing as before. I dont know what to change here.
@srdjanapostolovic3723
@srdjanapostolovic3723 4 жыл бұрын
Please help me, :-use_module(library(clpfd)). sudoku(R) :- length(R,9), /*red je duzine 9*/ maplist(same_length(R),R), /*svi redovi su iste duzine*/ append(R,E), /*elemente svih redova gurnem u jednu listu*/ E ins 1..9, /* svi elementi te liste su veci od 1 i manji od 9*/ maplist(all_distinct,R), /*svi elementi po redovimasu medjusobno razliciti*/ transpose(R,C), /*rotira matricu 90 stepeni u desno i time kolone postaju redovi*/ maplist(all_distinct, C), R = [A,B,C,D,E,F,G,H,I], /*svaki red dobije ime*/ kvadratic(A,B,C), /* predkat kvadratic ce se pobrinuti da*/ kvadratic(D,E,F), /* kvadrati 3 x 3 unutar matrice takodje*/ kvadratic(G,H,I). /* sadrze medjusobno razlicite elemente*/ kvadratic([],[],[]). /* ako smo dosli do praznih lista stane */ kvadratic([E1,E2,E3|T1],[E4,E5,E6|T2],[E7,E8,E9|T3]) :- all_distinct([E1,E2,E3,E4,E5,E6,E7,E8,E9]), kvadratic(T1,T2,T3). /* pozovemo za ostatak listi */ This is my code and for some reason it returns false no matter what, thanks in advance.
@ThePowerOfProlog
@ThePowerOfProlog 4 жыл бұрын
To find the goals that cause this to fail, you can systematically comment out or remove some of the goals. When you then insert the goal again, you can pinpoint when the program becomes too specific!
N-Queens in Prolog
40:27
The Power of Prolog
Рет қаралды 21 М.
School Timetabling with Prolog
53:47
The Power of Prolog
Рет қаралды 11 М.
Don’t Choose The Wrong Box 😱
00:41
Topper Guild
Рет қаралды 62 МЛН
Правильный подход к детям
00:18
Beatrise
Рет қаралды 11 МЛН
Quando A Diferença De Altura É Muito Grande 😲😂
00:12
Mari Maria
Рет қаралды 45 МЛН
A Sudoku Secret to Blow Your Mind - Numberphile
6:08
Numberphile
Рет қаралды 2,1 МЛН
Python Sudoku Solver - Computerphile
10:53
Computerphile
Рет қаралды 1,2 МЛН
Writing Code That Runs FAST on a GPU
15:32
Low Level
Рет қаралды 572 М.
Knights and Knaves in Prolog
13:41
The Power of Prolog
Рет қаралды 8 М.
"Production Prolog" by Michael Hendricks
39:58
Strange Loop Conference
Рет қаралды 52 М.
What Happens When You Use Prolog to Enhance LLMs?
10:04
Future Is Amazing
Рет қаралды 2 М.
Programming In Prolog Part 1 - Facts, Rules and Queries
11:50
Ryan Schachte
Рет қаралды 267 М.
Prolog Integer Arithmetic
11:08
The Power of Prolog
Рет қаралды 6 М.
Don’t Choose The Wrong Box 😱
00:41
Topper Guild
Рет қаралды 62 МЛН