Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Programming in Logic Mr. Haytock Project 4: Sport Jump Goals: To use the Prolog engine to find a list of steps to solve “jumping” puzzles. To modify the triangle jumper solution for more precise purposes. Overview: This project is going to create a simulation of the “triangle” puzzles that you see at Cracker Barrel. Starting with an empty peg, you must perform a series of checkers-style “jumps” to reduce the number of pegs to one. After writing the code for this, you will see how long the computer takes to find such solutions. Then, you will perform a number of modifications: 1. Can you have the computer generate all possible solutions, given an original empty hole? 2. Can you have the computer generate a solution where the final peg is left in the original empty hole? In this case, is there a solution for every N? 3. Can you have the computer solve a slightly different problem, where the solution is that there are eight pegs remaining and no possible moves? 4. Finally, modify the triangle puzzle with a different layout—the “Sport Jump” puzzle. Sample Run: A sample run will call the routine in a manner similar to the following: ?-triangle(3). The output generated for the above data file could be a list of triangle configurations that leads to the solution (I won’t duplicate it here to save space). Predicates: The predicates that you would need to define could be: triangle. solve_triangle. legal_jump. initialize_triangle. peg. jump. set_peg. % The starting query % Recursive routine that generates the list of steps % Performs a legal jump from one triangle % configuration to another % Initializes the first triangle with a specified %empty hole; you’ll need about 15 of these % Determines whether or not a peg is in a given hole; % you’ll need about 15 of these % Specifies a valid line of jumping, from X over Y %into Z. You’ll need quite a number of these % Sets the value of a position to 1 (inserts a peg) %or 0 (removes a peg); you’ll need about 15 of %these show_triangles. print_triangle. sp. reverse_list. append_list. % Loops to show each step in our solution % Prints a single triangle configuration in a user%friendly format % Prints a specified number of spaces % Reverses a list % Used by “reverse_list” Format: Your final work ought to be placed in a file (possibly multiple files) in an identifiable place on your Linux directory. I’ll look for a file that will run the program, and possibly a configuration file (in case you use a config for the board setup). Be sure that you comment your work well with appropriate comments—be sure that the file has general documentation, and then put in-line documentation explaining a bit of your reasoning for some of the rules. Hand in to me a printout of your source code when you are finished. The project is due: Friday, May 2.