Write recursive programs with lists and backtracking

Assignment Help Programming Languages
Reference no: EM13920533

Objectives: For this assignment, you'll learn how to use Prolog to write recursive programs with lists and backtracking.

Problem: There are three parts to this assignment. They are all related.

Part I) (see the included file "chess.pl")

Consider the problem of chess moves of a Knight on a 5x5 chess board. (For now, we shall simplify our problem to just a 5x5 chess board. The solution is the same when we expand it to a 8x8 chess board.)

570_img1.png

Starting at position A (3,3), a Knight can move to any position B. Its rule is that a Knight can move 1 step in the x-direction and 2 steps in the y-direction in one move, or 2-step in the x-direction and 1 step in the y-direction.

The predicate "move1( (X1,Y1), (X2,Y2) )" holds if a Knight can move from the position (X1,Y1) to the position (X2,Y2) in a single move. (See the file "chess.pl" for details.)

Your problem for part (I) is to define a new predicate "path( (X1,Y1), (X2,Y2) , N, P )" which holds if there exists a non-cyclic path P from (X1,Y1) to (X2,Y2) in less than N moves.

Part II) Using your solution to part (I), you are required to define a predicate "shortest( (X1,Y1), (X2,Y2) , P )" which holds if P is a shortest path from position (X1,Y1) to (X2,Y2).

Part III) Finally, you are required to define a predicate "visit ( (X,Y), P, N )" which holds if P is a path starting from (X,Y) from which a Knight can move and that the path ends in exactly N moves.

Attachment:- chess-in-prolog.zip

Reference no: EM13920533

Questions Cloud

Explain the importance of standardized protocol or systems : Explain the importance of standardized protocol or systems when a practice has multiple offices in a given geographic area and employees are expected to rotate among different offices.
Determine the percentage of assets : Determine the percentage of assets that were provided by retained earnings. How much cash is in the retained earnings account?
Flexibility to identify many different information systems : The case study company has provided you with the flexibility to identify many different information systems that are used by the employees. Some systems need strict access control while others should be available to everyone.
Implications of health economic concepts for health care : Assess the value of health care professionals and decision makers understanding the discipline of health economics - Assess current economic trends that influence the cost, quality, and access to care.
Write recursive programs with lists and backtracking : Objectives: For this assignment, you'll learn how to use Prolog to write recursive programs with lists and backtracking. Problem: There are three parts to this assignment. They are all related
Formulate a linear programming model and then solve it : Formulate a linear programming model, and then solve it, to determine how many hours process 1 should be operated each week and how many hours process 2 should be operated each week.
Example of the coercive power of a manager : Question 1: Write down an example of the coercive power of a manager? Question 2: According to the trait model, which of the following trait of leadership helps managers avoid acting selfishly, control their feelings, and admit when they have made..
Service companies that manage inventory : Determine the types of inventories these companies currently manage and describe their essential inventory characteristics. Analyze how each of their goods and service design concepts are integrated.
Total liabilities and stockholders : Total liabilities and stockholders' equity $3,640,500 It was determined at the date of the purchase that the fair value of the identifiable net assets of Conchita was $2,786,200.

Reviews

Write a Review

Programming Languages Questions & Answers

  Write a haskell program to calculates a balanced partition

Write a program in Haskell which calculates a balanced partition of N items where each item has a value between 0 and K such that the difference b/w the sum of the values of first partition,

  Create an application to run in the amazon ec2 service

In this project you will create an application to run in the Amazon EC2 service and you will also create a client that can run on local machine and access your application.

  Explain the process to develop a web page locally

Explain the process to develop a Web page locally

  Write functions

These 14 questions covers java class, Array, link list , generic class.

  Programming assignment

If the user wants to read the input from a file, then the output will also go into a different file . If the user wants to read the input interactively, then the output will go to the screen .

  Write a prolog program using swi proglog

Write a Prolog program using swi proglog

  Create a custom application using eclipse

Create a custom Application Using Eclipse Android Development

  Create a application using the mvc architecture

create a application using the MVC architecture. No scripting elements are allowed in JSP pages.

  Develops bespoke solutions for the rubber industry

Develops bespoke solutions for the rubber industry

  Design a program that models the worms behavior

Design a program that models the worm's behavior.

  Writing a class

Build a class for a type called Fraction

  Design a program that assigns seats on an airplane

Write a program that allows an instructor to keep a grade book and also design and implement a program that assigns seats on an airplane.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd