Purchase Solution

Chess game in C

Not what you're looking for?

Ask Custom Question

Create table game characters 8x8, where will store THE POSITION OF Figure each
time on this chessboard. The creation of the list must be made with commitment memory. In addition
create structure (struct move) to be used for the registration movements with the elements:
CHAR OVER, char prevpos[2], char nexpos[2], move *next, move *prev. The program, with the
start-up phase, shows the screen menu the following options:

MAIN MENU Thema 1
[N] Start New Game Thema 2
[S] Score Thema 3
[U] Undo Thema 4
[E] End Program
Selection (N, S, U, E):

The program will goes only in the case given valid choice (one of the above mentioned letters),
in any other case will again expects to one new selection. After the execution of a selection
return in the mainly menu. TERMINATES WHEN given E.

Choice N Starts a new game. Firstly make a double connected list Moves with nodes move, where it will be stored in sequence of
moves.Create two stacks black and white, where will be maintained file of pieces of figures that
wins every player. The list black (white) corresponds in the player with black (white) pieces
and are stored the white (blacks) Figures. Afterwards the game begins and the computer asks the
sequence of movements with the way as it is descriped in subjects 3 and 4 at the first work project. You Can use or
your own corresponding code or the proposed solutions of first work where
shape suitably.

For each valid movement, you supplement suitably the elements of one node move and
add in the double connected list, and inform proportionally the table game. If in
final square of movement exists rival piece, it is eaten and removed from the dash (game),
it is registered in stack the player (white or black) and is added node with nexPos= ` - - `. If
piece Figure is the King of opponent, then is not placed in no list and we consider that the player
that makes the movement it Wins: is printed suitable message in the screen and the game terminates. If
exists his own piece Figure, the movement is cancelled and is required to give a valid move. The process is repeated up to
the user types instead of movement the symbol baluster (#), therefore will return in
main Menu.

Choice S will evaluate the existing situation and will elect the winner for the case
that the game terminates without winner (for example when has been agreed concrete biggest duration
game). In order to becomes this, from each stack are removed the Figure pieces, are printed message
description in the screen and are registered the points in the corresponding player, according to the values
that appear in table 1. The player with most points, is the winner and
it is announced in the screen. If there is equal total points, is printed message of draw.

Subject 4: Undo of movements
When is given the choice U in the main Menu, the program asks the player how much movements it wants
it reverses. The figure that is given concerns successive movements, independent player, beginning from
the last one. For the recantation is used the double connected list, from where a-one
movements are described in the screen and are informed suitably the table. Proportionally they become also
changes in the two stacks. Obviously, it should it is recognized in who belongs the movement when
` is eaten' figure piece.

Purchase this Solution

Solution Summary

The solution contains a basic immitation of a chess game. The chess board is displayed with letters standing for figures. Movements are not restricted in any direction, but you cannot step on to your own piece. After each move an update board is displayed. There is also an Undo operation available.

Solution Preview

Attached is the compete solution C-source code file. There are plenty of comments. The main menu looks ...

Purchase this Solution


Free BrainMass Quizzes
Word 2010: Table of Contents

Ever wondered where a Table of Contents in a Word document comes from? Maybe you need a refresher on the topic? This quiz will remind you of the keywords and options used when working with a T.O.C. in Word 2010.

C++ Operators

This quiz tests a student's knowledge about C++ operators.

Basic Computer Terms

We use many basic terms like bit, pixel in our usual conversations about computers. Are we aware of what these mean? This little quiz is an attempt towards discovering that.

Javscript Basics

Quiz on basics of javascript programming language.

Word 2010: Tables

Have you never worked with Tables in Word 2010? Maybe it has been a while since you have used a Table in Word and you need to brush up on your skills. Several keywords and popular options are discussed as you go through this quiz.