Skip to content

Instantly share code, notes, and snippets.

View SFantasy's full-sized avatar
🌝
ENJOY~

Fantasy SFantasy

🌝
ENJOY~
View GitHub Profile
@SFantasy
SFantasy / sudoku.pro
Last active December 10, 2015 02:58
I learned it from the book 'Seven languages in seven weeks', it is so fun solving Sudoku using Prolog! 一种用来快速解决Sudoku的编程方式--逻辑编程,Programming Logically! 如果用来解决6*6或者9*9的Sudoku,更改构造的Puzzle即可。
/*验证该列表中没有重复的数字*/
valid([]).
valid([Head|Tail]) :-
fd_all_different(Head),
valid(Tail).
/*构造Puzzle*/
sudoku(Puzzle, Solution) :-
Solution = Puzzle,
Puzzle = [S11, S12, S13, S14,