Application of connect-4 game, Computer Engineering

Assignment Help:

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.


Related Discussions:- Application of connect-4 game

Concept development of project, Concept Development Journal General In...

Concept Development Journal General Information: Once you have researched and gained some insight into the topic you must then begin developing your ideas and your conceptua

Moral and ethical implications, • Moral and Ethical Implications o Will ...

• Moral and Ethical Implications o Will this be safe to have on the road    Will the computers on board be able to handle extreme circumstances • Hazardous conditions o Ex

Problem based on banker''s algorithm, A system contains 10 units of resourc...

A system contains 10 units of resource class Ru. The resource requirements of three user processes P1, P2 and P3 are as follows

Name the approaches used for generating the control signals, What are the t...

What are the two approaches used for generating the control signals in proper sequence? Hardwired control Micro programmed control

Instruction cycle-flynn’s classification, Instruction Cycle The instruc...

Instruction Cycle The instruction cycle consists of a series of steps needed for the implementation of an instruction in a program. A typical instruction in a program is descri

Perceptrons in artificial neural network, Perceptrons in artificial neural ...

Perceptrons in artificial neural network- Artificial intelligence: The weights in any ANN are always only real numbers and the learning problem boils down to selecting the best

Signed 1’s complement representation, Q. Signed 1s complement representatio...

Q. Signed 1s complement representation? Another possibility that is also simple is use of signed 1's complement. Signed 1's complement has a principal. Add both numbers includi

Boundary tag management system, what are the two memory management scehme...

what are the two memory management scehme(boundary tag system,buddy system)

Types of classification-classification of parallel computers, Types Of Clas...

Types Of Classification The following classification of parallel computers have been recognized: 1)      Categorization based on the data streams and instruction 2)

What are the end-to-end layers of osi structure, What are the end-to-end la...

What are the end-to-end layers of OSI structure The layers 4-7 of ISO-OSI reference model communicate with peer entities in end systems. There is not any communication with ent

Write Your Message!

Captcha
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