Created
September 7, 2011 20:27
-
-
Save mark-d-holmberg/1201636 to your computer and use it in GitHub Desktop.
Eight Queens as a List Help (Prolog)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Mark Holmberg, Dixie State College of Utah | |
CS 3520, Programming Languages | |
7 Sept. 2011 | |
Some help with 8-queens so you don't have to type as much. | |
If you want to test your 8-Queens predicate you can NOT write a test predicate | |
like Russ said. Although it does work, it only returns true or false NOT the | |
list of the proper queen locations. The following is the test case I used. | |
eight_queens( [Q1,Q2,Q3,Q4,Q5,Q6,Q7,Q8] ). | |
If your test is successful you should get output like this: | |
Q1 = 1, | |
Q2 = 5, | |
Q3 = 8, | |
Q4 = 6, | |
Q5 = 3, | |
Q6 = 7, | |
Q7 = 2, | |
Q8 = 4 . | |
You can type ; to get more solutions. | |
Best of luck. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment