# Prolog|人工智能|机器学习|作业代写

2020/3/15 Prolog-Puzzle-Assignment
Prolog-Puzzle-Assignment
23:59 100 pdf pl
Use PROLOG to solve a logic puzzle.
Use PROLOG to write down all the rules provided in the puzzle, and then use PROLOG to determine where to place the X’s and O’s in the logic puzzle.
You can check the solutions to any puzzle by going to https://www.printable-puzzles.com/printable- logic-puzzles.php#list (https://www.printable-puzzles.com/printable-logic-puzzles.php#list) and entering the puzzle ID. Our graders will be doing this to check your results and so you should do it too.
You will need to solve one of the “challenging” logic puzzles:
B924SH.pdf Q315GN.pdf V898TT.pdf Y074UR.pdf
For EXTRA CREDIT you may do the portion of the assignment in red. Solve one of the “fiendish” logic puzzles:
O498WI.pdf X775RR.pdf
A brute-force attempt to evaluate every possible solution will no longer be feasible for these puzzles, you will have to be clever in how you whittle down the solution space in order to solve these in minimal time.
You should be able to deduce the solutions to each logic puzzle using PROLOG. To do so, you will create a .pl file for the puzzle and enter all the rules provided with the puzzle. You should then be able to formulate queries to fill in the table.
HINTS:
It may be tedious to type in all those queries, but SWI-PROLOG lets you produce output from within the .pl file if you add something like this to the end:
https://miamioh.instructure.com/courses/110345/assignments/1184470
1/3
ºÍ ÐÍÀà¼þÎÄ ¼þÎÄ´«ÉÏ·ÝÒ» ½»Ìá ·ÖµÃ Ç°Ö® £¬¶þÆÚÐÇ ¼äÊ±Ö¹½Ø
Òµ×÷½»Ìá

2020/3/15 Prolog-Puzzle-Assignment
:- forall((condition1(X), condition2(Y), …), (rule(X, Y, …)) )
where, of course, condition1(X) would be an expression and “rule” is a rule implementing some of the logic of the puzzle. In this case X and Y are temporary variable that can be used only within the forall.
It is also useful to use SWI’s implication “->” operator.
hypothesis -> conclusion
where hypothesis is a prolog predicate and conclusion is a statement that is true if conclusion is true. Many clues are worded this way.
Do not forget to use the member predicate as well. What To Submit:
The submission requirements have been updated — you are not responsible for the items in RED. Only the items in BLUE
1. You will submit a write-up, as a PDF
In order to make submission easier, this is all that is required as of Feb 28:
1. A PDF version of the complete source-code to your .pl file including comments. The PDF should include line numbers, and it can be generated by a variety of tools that are a short Google search away.
2. Your submission should indicate which rules of your .pl file are associated with which statement in the puzzle, indicate by repeating the prolog statements as comments in your .pl file
3. The solution as a table.
The solution is just a single table that you can check online using the link above in the problem description.
A good way to present this is as a comment showing the output of your prolog program, however you should make sure it
is formatted as a temple (the columns should line up).
No longer required
1. Your write-up will have two sections — one for the “challenging” puzzle and one for the
“fiendish” puzzle.
2. Each section will include a scanned in (or digitally edited) copy of the puzzle that has been
completely filled in. It must include the puzzle ID.
3. Each section will include the source-listing of a .pl file with all the rules of the logic puzzle.
Please make sure you include line-numbers and syntax highlighting to make these readable.
https://miamioh.instructure.com/courses/110345/assignments/1184470
2/3

2020/3/15 Prolog-Puzzle-Assignment
4. Each section will include a listing of the interactive queries used to fill in the solution table. (It is possible to include these in the .pl file as well…)
5. Each section will also include a listing of the interactive querries for the entire grid. 2. You will submit the .pl file for the “challenging” puzzle.
3. You will sunmit the .pl file for the “feindish” puzzle.
EXTRA CREDIT
A very small number of you may have attempted the feindish puzzle. The brute-force strategy will not work there, but some of you may have made some progress. I will adjust the rubric for the assignment so that the feindish puzzle is EXTRA CREDIT worth up to 20% of the problem set. You will be able to get partial credit.
Prolog-Puzzle
Submits a PDF Writeup
10.0
Submits .pl for “challenging” puzzle
5.0
Submits .pl for “fiendish” puzzle
1.0
The “challenging” .pl file is correct
The writeup demonstrates that the .pl file for the puzle can be used to fill in the solution table and any other query on the grid.
85.0
The “fiendish” .pl file is correct
The writeup demonstrates that the .pl file for the puzle can be used to fill in the solution table and any other query on the grid.
19.0
120.0 120.0
https://miamioh.instructure.com/courses/110345/assignments/1184470
3/3
·Ö
·Ö
·Ö
·Ö ·Ö
·ÖÂú£¬
:·ÖµÃ×Ü
·ÖµÃ ¼¶ µÈ
×¼±ê