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
In a frame transmission, CRC stands for? CRC stands for Cyclic Redundancy Check, in a frame transmission.

how to find the type of cohesion in a module

The Variant data type has a numeric storage size of 16 bytes and can have data up to the range of a Decimal, or a character storage size of 22 bytes (plus string length),and can ke

what is interference of light explain the nessicity of coharent source for obtaining sustain interference pattern


Q. How to calculate register indirect addressing? The effective address of operand in this technique is calculated as: EA= (R) and D = (EA)  Address capability of regi

1) What does the term entrepreneurship mean to you?  What are some basic characteristics of entrepreneurs? 2) What is e-commerce?  Why are the Internet economy and e-commerce he

Byteland county is very famous for luminous jewels. Luminous jewels are used in making beautiful necklaces. A necklace consists of various luminous jewels of particular colour. Nec

Parent class of all Java classes is? All Java class's parent class is java. lang.object.

What are included in scope of Supply Chain Management Consultancy? Supply Chain Management Consultancy's scope is extensive, and classically includes as given here: a. Sales