Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

The game Connect-4 is played on a board that has seven columns. There are six spaces on each column. The board is initially empty. Two players take turns dropping one piece (black or grey in the diagram below, but "X" or O" in our game) in a column. The piece falls into the lowest unoccupied row. A player cannot move in a column if the top-most row of that column already has a piece in it. The first player to get four of their counters in a line (horizontally, vertically, or diagonally) is the winner. 

You have been provided with two files for this problem: minimax.lisp, which contains lisp code for the minimax algorithm, and  connect-4.lisp, which contains a working Lisp implementation of the Connect-4 game. 

As the Connect-4 implementation currently stands, you should  have absolutely no problem beating the program. Try it:  

[1]> (load 'minimax)

;; Loading file C:\CSE2AIF\minimax.lisp ...

;; Loaded file C:\CSE2AIF\minimax.lisp

T

[3]> (load connect-4)

;; Loading file C:\CSE2AIF\connect-4.lisp ...

;; Loaded file C:\CSE2AIF\connect-4.lisp

T

[3]> (play)  

The program plays poorly because it has a poor-quality heuristic. The function static, which evaluates a position from the point of view of a particular player, is currently defined as follows: (defun static (board player) 0)

This means that each board configuration receives exactly the same evaluation; i.e., 0.  Your task for this question is to develop and implement a good heuristic for the Connect-4 game.  The only LISP code that you are required to write is a LISP function static, which accepts a board and player as input arguments, and returns an evaluation of the board state from the point of view of player. You can, of course, write as many helper functions as you like.  

To assist you, the code you have been supplied with contains a parameter *all-c4-lines* which is a list of all of the 69 possible ways to win in Connect-4. Each element of this list is a list of length four, such as

 ((3 5) (4 5) (5 5) (6 5))

Each element of this is the column and row. For example, the above list indicates that there is a line of length four that includes a piece at the 4th column of the 6th row, the 5th  column of the 6th row, the 6th column of the 6th row, and the 7th column of the 6th row.

 Note that rows and column indexing starts at 0.

The Lisp built-in function  aref can be used to find what piece, if any, is at a specified location. For example, to find what piece, if any, occupies column col and row row of the current board state, evaluate the following code 

   (aref board col row)

This will return either nil, x or o.

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M9523283
  • Price:- $95

Guranteed 48 Hours Delivery, In Price:- $95

Have any Question?


Related Questions in Computer Engineering

With more persons working from home how does one separate

With more persons working from home, how does one separate data intended for the employer form what might be considered personal property? What policies could be put in place to ensure employees adhere to safe guidelines ...

Question what are the risks of transmitting data over an

Question : What are the risks of transmitting data over an unsecured Wi-Fi network? What steps are necessary to secure Wi-Fi Protected Access Network? Distinguish between client/server and file server architecture. Is te ...

There are 30 male democrats and 14 female democrats 2 male

There are 30 male Democrats and 14 female Democrats, 2 male Independents and zero female Independents, 48 male Republicans and 6 female Republicans. Find P (M ∩ D)

Innbspmid-2009 rite aid hadnbspccc-ratednbsp20-year bonds

In? mid-2009, Rite Aid had? CCC-rated, 20-year bonds outstanding with a yield to maturity of 17.3%. At the? time, similar maturity Treasuries had a yield of 5%. Suppose the market risk premium is 4% and you believe Rite? ...

Systems and networksconsider sending a large file from a

(Systems and Networks) Consider sending a large file from a host to another host using a reliable connection such as TCP. Suppose the reliable connection uses additive-increase, multiplicative-decrease (AIMD) without slo ...

The scenario is to create a program for a windows company

The scenario is to create a program for a windows company. The program should display the total amount a customer owes, given the number of windows ordered and the price per window. Total owed is calculated by multiplyin ...

Questionthe stable matching problem as discussed in the

Question The Stable Matching Problem, as discussed in the text, assumes that all men and women have a fully ordered list of preferences. In this problem we will consider a version of the problem in which men and women ca ...

Respond to the statement below in at least 100 words or

Respond to the statement below in at least 100 words or more. Original responses only. When the software developments requirements are written in vague language it unlocks the door for interpretation and can be a source ...

Question the project presentation should demonstrate

Question: The project presentation should demonstrate knowledge in the chosen area. The presentation should be formatted as follows: 12-point font using Times New Roman Use APA style correctly throughout the presentation ...

A report claims that for the investment portfolios with a

A report claims that for the investment portfolios with a single stock had a standard deviation of 0.57, while the returns for portfolios with 31 stocks have a standard deviation of 0.325. Explain how the standard deviat ...

  • 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