Application of connect-4 game, Computer Engineering

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.

Posted Date: 2/20/2013 7:59:18 AM | Location : United States







Related Discussions:- Application of connect-4 game, Assignment Help, Ask Question on Application of connect-4 game, Get Answer, Expert's Help, Application of connect-4 game Discussions

Write discussion on Application of connect-4 game
Your posts are moderated
Related Questions
What do you mean by Electronic Funds Transfer? Electronic Funds Transfer: It’s an electronic payment method which transfers the money value through one bank account to o

write algorithm and draw flowchart for exchange the values of two variables.

What is computer virus?  A  computer  virus  is  a  computer  program  that  is  designed  to  spread  itself between   computers.   Computer virus are inactive when standing a

The concept of Mouse was designed by Douglas C. Engelbart of Stanford Research institute and first Mouse was designed by Xerox corporation.  Mouse itself is a device that gives you

It is possible to enter one or more criteria in the rows which can influence your database significantly. >="Callahan" this returns all the several records from Callahan to the

Performance of computer system: Computer performance is frequently described in terms of clock speed (usually in MHz or GHz). It refers to the cycles per second of the main cl

Accumulator is the register in which Arithmetic and Logic calculations are completed.


Compare excess 3 codes and gray code. Ans. Excess 3 Codes 1. This is the other form of BCD code. All decimal digits are coded in 4 bit binary code. 2. The code

Probelm: (a) Show the attributes used by Regular Expression Pattern in a WSDL document. (b) Describe the three standard wire formats for transmitting Web Service requests a