Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

Your representation should be an internal representation used for evaluating positions in the game; it should not be the external representation shown in the pictures and used for communicating with a human player. You should note that states (a) and (b), as well as states (c) and (d), are equivalent to each other for the purpose of playing the game. (a) and (b) are equivalent because the cells that
are shown in blue and yellow have no subsequent e ect on the play of the game. (c) and (d) are equivalent because the ordering of the groups of unmarked cells also has no e ect. Your representation should represent equivalent states by identical terms.

In the remaining questions state means internal state.

 Write a Prolog predicate print state(X) which will print a state X to the terminal using an asterisk to represent a markable cell and a space to represent a gap between runs of markable cells.

 Write a Prolog predicate next(S,T) which will succeed if T is a state of the game that can be reached from S in one move. Backtracking should generate all such states T, and findall(T,next(S,T),U) should unify U to the list of all of these states.

Also write a predicate print next states(S) which will use your next predicate to nd and print out all states obtainable from S in one move.

 Write a Prolog predicate win(S), which will succeed for any game state S which is a winning position for the player to play, and will fail otherwise. win(S) is found to be true or false by a depth- rst search through the game tree. You should, if you can, make use of the assert
predicate to avoid the search exploring any position more than once (which will greatly speed it up).

Two tests you can use to check that your predicate is giving the right answers are that a run of markable cells of any odd length is always a win for the rst player, while a state consisting of two groups of markable cells of the same length is always a loss for the rst player.
Write a predicate test value(N), which will apply your win predicate to each of the starting states corresponding to boards of size 1; 2; : : : ;N and print a 1 if the predicate win succeeds and a 0 otherwise. For example:

?- test_value(60).
111011101111101111101110111011111011101110111111111110111011 true.

Write a Prolog predicate choose move(S,T), which will choose a winning move for a player faced with the position S, if there is one, the resulting position being T. Backtracking should generate all winning moves. If there are no winning moves the predicate should fail.

Write another Prolog predicate show winning moves(S), which, by using choose move, prints out all of the winning moves for the player whose turn it is to move from position S.

Write a predicate test winning moves(N), which will apply your show winning moves predicate to each of the starting states corresponding to boards of size 1; 2; 3; : : : ;N, printing out both the board size and the winning moves (if any) from that state. For example
?- test_winning_moves(20).
1 :empty
2 :empty
3 :empty
4 :
5 :* *
6 :****, * **
7 :****, ** **
8 :
9 :*** ***
10 :********, * ******
11 :********, * *******, ** ******, **** ****
12 :** *******
13 :***** *****
14 :
15 :**** ********, ****** ******
16 :**************, ****** *******
17 :**************, *** ***********, ***** *********, ******* *******
18 :*** ************, ***** **********
19 :******** ********
20 :
true.

here empty means a winning move without any cell left to mark for the next player, a blank ne means no winning move, and commas separate winning moves.

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M9896122
  • Price:- $70

Priced at Now at $70, Verified Solution

Have any Question?


Related Questions in Computer Engineering

Can someone please help me with this pleasetaskthe purpose

Can Someone please help me with this please: Task: The purpose of this assignment is to empirically measure attributes for binary search trees. Steps: Create a program that will build a binary search tree (BST) by adding ...

Question after you have analyzed the existing material used

Question: After you have analyzed the existing material used by the company for their day-to-day duties, the current Access database, and the additional requirements that the current system does not meet, the following r ...

Suppose mpc is 07 government spending increases by 10

Suppose MPC is 0.7. Government spending increases by $10 billion, and taxes decrease by $5 billion. How would the following items change, and by how much? Disposable income Private saving Public( Government) saving Equil ...

As part of a bear population study data were gathered on a

As part of a bear population study, data were gathered on a sample of black bears in the western United States to examine the relationship between the Bear's neck girth (distance around the neck) and the weight of the be ...

What is the lithium by mass in a sample of pure lithium

What is the % lithium by mass in a sample of pure lithium carbonate that has a sample size of 10.0g?

Java program that prompts the user to enter the base and

Java program that prompts the user to enter the base and slant height for a regular pyramid shape, then calculates and outputs its volume and surface area. A and B are requirements A It is required to use JOptionPane's I ...

Can someone please help me with this pleasetaskthe purpose

Can Someone please help me with this please: Task: The purpose of this assignment is to empirically measure attributes for binary search trees. Steps: Create a program that will build a binary search tree (BST) by adding ...

The demand for salt is relatively price inelastic while the

The demand for salt is relatively price inelastic, while the demand for pretzels is relatively price elastic. How can you best explain why and elaborate your answer.

Explain how amazon and walmart companies use information

Explain how Amazon and Walmart companies use Information and Communication Technologies (ICT) in their competitive strategies. Highlight the differences in their use of ICT.

Reduce setup timehammond inc has analyzed the setup time on

Reduce Setup Time Hammond Inc. has analyzed the setup time on its computer-controlled lathe. The setup requires changing the type of fixture that holds a part. The average setup time has been 135 minutes, consisting of t ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As