Skip to content

jimpo/srat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

SRAT

This is a program that generates the solution to the self-referential aptitude test. The program is written in Prolog, a logical programming language.

Running

Find the solution (takes ~15 seconds):

docker run --rm -v "$(pwd):/app" -w /app swipl swipl -g "consult('srat.pl'), (solve(ANS) -> write(ANS) ; write('No solution')), nl, halt."

Interactive REPL:

docker run --rm -it -v "$(pwd):/app" -w /app swipl swipl
?- [srat].  % Load the program

?- solve([d,a,d,b,e,d,d,e,d,a,b,a,d,b,a,d,b,a,b,e]).  % Verify a solution
true.

?- solve([a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a]).  % Test invalid solution
false.

?- solve(ANS).

About

Solution to the self-referential aptitude test using logical programming

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages