Test Case Chess Game Design With Implementation

Test Case 12:

Input: when it is a checkmate for the king.

Status: Performed

Output: if there was a checkmate for the king then the system will display a message box as shown below.

Errors that occurred during the development of the project:

There are some errors that occurred during the development of the project which are rectified are given below

Error 1:

Input: Moving a pawn diagonally.

Status: Performed

Output: Pawn has moved diagonally as shown below.

The above figures shows the illegal move of the pawn which is going diagonally ,as per the rules of the game moving of the pawn diagonally  without having a castle against the opponent piece is an illegal move  and will not satisfy the rules of the chess.

So this is one of the type of error that is occurred at the start of the development which was later on rectified , similarly type of errors has occurred with the other pieces has also been managed and rectified.

Error message 2:

Input: Moving the black pawn

Status: Performed

Output: The move is performed, black pawn moved a step.

From the above figures we can see the pieces of black can be moved which can’t be possible as the game is developed between human and computer we can’t the move the pieces of the computer but which are moved here, so this type of error are notified and rectified.

Error Message 3:

Input: Kill the king and move next step.

Status: Performed

Output: The king was killed and the next step is also moved.

The above figures describes that even after the king is killed the game is still commencing without displaying any messages of whether the game is over or not, or it is a checkmate or not, this is error is also rectified.

Test Case for Chess Game Document Sample

Test Case 10:

Input: checking the move of the kills performed each and every piece.

Status: Performed

Output: It is satisfying the rules of the game if any other move that is not a valid move for killing is performed an dialog box will be displayed, the dialog boxes for the test cases are shown below the screen shots for the test cases.

In the above figures when the white pawn is in a castle position with the black pawn according to the rules of chess it can kill the opponent piece.

Similarly in the case of the king.

In the above figures when the white pawn is in a castle position with the black pawn according to the rules of chess it can kill the opponent piece.

Like above each and every piece is following its rule which are shown below

Staring with knight:

Similarly with Rook:

Similarly with Bishop:

And finally the Queen:

Test Case 11:

Input: when it is a check for the king.

Status: Performed

Output: if there was a check for the king then the system should allow any other moves except king if any other move has been made a message has to be displayed.

When there is any other move that is leading for check would be cautioned by a message box as shown below

Introduction to Test Case Design

Any project goals or deliverables are depend upon them implementation and testing, if these two factors are not properly considered then the quality of the project would be less, so for this purpose a steady and good testing is required for the project, so for that purpose the tester has to thoroughly test the system and it is his duty to make sure that deliverables are achieved properly or not, according to the artefact given by magazine that in the present software field 50% of the employers that are working in the technical department are testers. That means theoretically 50% of the time has been given for testing in the development of the project, so by seeing these facts it is understood that for good software a proper testing is required.

Considering an important report which is given the authors (B Boehm & V Basili, 2001) on the topic Software defect reduction top 10 lists, so consider the steps given below at the early stages for the development

  1. It costs 100 times more difficult for searching and rectifying the bug when the software is developed than solving the problem in the early stages of the development during the development.
  2. Most of the projects that are developed in the present world consume 40 to 50 percentage of work to rework for fixing the problems, so reducing the most of the rework can significantly improve the time in the project and the productivity of the software.
  3. Similarly the author says that the 80 percentage of rework will occur due to 20 percentage of the defect only, so reducing more defects reduced will efficiently grow the development of the project.

The author also suggest that every tester has a certain requirement such as assuming a certain scenario in performing the testing which are stated below

  1. Analysing the requirement: in this phase to do the work without any issues will be developed by assuming some function point in the project check the requirement are feasible or not
  2. Designing: in this phase the tester checks whether the designed project is meeting to the architecture that is taken into consideration at the initial step,.
  3. Coding: This is the phase where tester test the actual product completely and also asks a couple of voluntary people to test the system so that any software bugs would be detected.

For this project some of the test cases that are highly taken into consideration and they are giving according to the priority are

  • Tested whether each and every field is accessed on the applet or not.
  • The screen shots of each and every test field  is properly described for the user
  • Thoroughly checked whether each and every error that was popped while testing are properly handled or not.

Test Cases for Chess Game

Test Case 1:

Input given: To compile the program without the errors.

Status: changed

Output: The program is compiled properly without any errors if any errors are occurred it will be displayed below the compilation input, so in this test case there are no errors so the compilation was successful and was preceded to the next step.

Test Case 2:

Input given: To execute the applet by giving the command.

Status: applet displayed

Output: After entering the code for execution of the program the command prompt will automatically pop up an applet which as shown below, if there are any internal errors in the program the applet will not appear.

After entering the command in the command prompt as shown above and executed it will be redirected to the applet which is shown below

Test Case 3:

Input given: Check whether all the pieces of the both sides are available or not and also check whether they are properly organised or not.

Status:  Performed

Output: All the pieces are available and fairly organised for both sides which are satisfying the basic rules of the game is shown below.

Before going to play the chess a proper check for the moves of each and every piece is tested and the test cases of them and their results are shown below

Test Case 4:

Input: checking the move of the pawn.

Status: Performed

Output: It is satisfying the rules of the game if any other move that is not a valid move of pawn is performed an dialog box will be displayed, the dialog boxes for the test cases are shown below the screen shots for the test cases.

The above screen shots shows the valid moves of the pawn, and if any other moves for the pawn are the dialog box appears as shown below.

Test Case 5:

Input: checking the move of the knight.

Status: Performed

Output: It is satisfying the rules of the game if any other move that is not a valid move of Knight is performed an dialog box will be displayed, the dialog boxes for the test cases are shown below the screen shots for the test cases.

The above screen shots shows the valid moves of the Knight, and if any other moves for the Knight are the dialog box appears as shown below

Test Case 6:

Input: checking the move of the Rook.

Status: Performed

Output: It is satisfying the rules of the game if any other move that is not a valid move of Rook is performed an dialog box will be displayed, the dialog boxes for the test cases are shown below the screen shots for the test cases.

The above screen shots shows the valid moves of the Rook, and if any other moves for the Rook are the dialog box appears as shown below

Chess Game Design Java

Design of this chess game is divided in to following modules: 

  1. Board representation
  2. Move representation
  3. Piece representation
  4. Analyzer

Move representation: 

Representing the possible moves is really an important aspect in designing the chess game and this section explains the actual procedure followed to handle all the possible moves in this application. A separate module known as chess engine is designed in this program to handle all the possible moves and a separate module of code is required as the possible moves are really high in a chess game. Move against the human move from the computer side need lot of estimations and eliminations and in there, typical tree search algorithm can be used to search for the best move possible. These moves are mainly decided by the position of the piece on the chess board and few predefined moves are assigned to the piece based on the nature of the piece on the board. A typical switch and case condition loop is used to check the type of piece initially and then based on the case identified the moves are defined. The moves are assigned to these pieces based on the square positions, the corresponding characters assigned to the squares and position of the square on the total board. All the possible conditions are checked for all the pieces with respect to the position of the board initially and later the actual moves against the human moves are done in a separate way. The famous tree search algorithm known as alpha beta pruning algorithm is used to decide the best move for the computers from all the possible moves in front of the computer. To proceed with this algorithm, initially alpha and beta variables are considered and an initial depth is assigned as an integer and then these values are incremented or decremented and compared to follow the tree search process. Moves are represented based on the depth value of the alpha and beta and the kind of piece with respect to this depth position on the chess board. Alpha and beta are used to represent the current square position of the piece that need to be moved and the beta represents the target move and thus from the value of the depth calculated as discussed above, the actual move of the desired piece is decided. Once the best move is decided from all the possible moves, the actual move is shown to the users using the same graphic class of the Java Applet package. All the required action listeners are added to the piece movements and the most common among them are the mouse listeners and the computer always recognizes the moves made by the human player using the mouse action listeners and the moves are compared to the predefined moves saved at the memory with the moves made by the human player and as discussed these moves are identified using the mouse action listeners and even the validity of the moves made by the human player is also checked against many conditions. 

Piece representation: 

The very next once the move representation is done is to represent the graphical user interface of the pieces and the corresponding moves of them on the chess board considered. All the images of the required pieces are taken in the same folder where the coding files are maintained and the reference to them are made using the file path in the design process. All these pieces are placed on the squares of the chess board based on the characters assigned to the squares using the character array as discussed in the board representation section of this document. A separate method is used to represent the pieces on the board and is named as drawFigure and the parameters given to this method are like character for the square assigned, x-axis position and y-axis position. Board design takes care of the square positions and the corresponding square positions are designed with respect to the pieces and their respective placement on the squares. Properties for the pieces are assigned at the chess engine level and the corresponding hash codes are assigned as the constant values with respect to these pieces at the backend of the chess engine design. Few methods are defined these pieces in the form of a separate interface and these methods holds the required properties for the corresponding pieces used across the board. Moment of these pieces is defined with respect to the changing positions of the board and the required attributes are set accordingly in these methods. 

Analyzer: 

Design of the analyzer include the time controls used across the chess game and a detailed coding aspects to the alpha beta pruning algorithm based on the time limits imposed across the chess game. Five different time intervals are considered in this design like 50, 100, 300, 600 and 1800 and the corresponding limitations with respect to the time are given based on the human moves. As discussed in the previous section, the human player moves are captured by the mouse action listeners and the corresponding moves are compared against the time limits set across this design.  Time frame allocated in this design is incremented using exponential functions and if the time limit is reached the corresponding action to be taken by the computer program are also defined in this analyzer module. A minimum time limit is given to the human player during the initial moves and gradually the game process, more time limits is allocated to the player in the middle of the game, as the player need more time to analyze the moves and make the right move. A multi threading program is designed in this case to handle the time limits assigned to the human players. 

Chess Board Representation Java

Introduction to Chess Board Representation Java:

Board representation is the key aspect in the chess design and in general 8X8 grid chess board is designed across many computer based chess games. There are different approaches that were followed while designing the chess board and even there are few cases where a chess board of size 10X12 grid is also used and the main reason to use this type of broad representation is to identify the out of bound and the corresponding illegal moves across the board. In this project an 8X8 grid board is used and the Java applet coding is used to design the board window.

A total of 64 squares are used in this case and the board is represented as an array of integers in the memory using the int variables. All the squared in the board are assigned either black or white color based on few conditions and they are as explained. Graphics object of Java applet class is used to draw the basic board and once the empty board is represented, now the colors to the squares are assigned using setColor method of the graphics class from the Applet package.

Few offset values are assigned to the square initially and they are incremented using the while loop and then the corresponding black and white colors are assigned to the corresponding squares by checking these offset values and this procedure is repeated for all the 64 squares and all the squares are assigned either black or white color. Few characters and alphabets are assigned to each and every square of the board and the colors to the board are assigned by checking the position of these characters using the if loop and this loop iterated till every character choosen is assigned a color.

A special character array is used hold all these characters assigned to the squares and these characters are fetched from the array as per the user requirement based on their index in the array considered. Important conditions like rotating the board at any condition of the game is also handled and the colors to the square of the board are assigned considering these entire rotation angles and the corresponding conditions. A string variable is used to handle the complete rotation aspects of the board and few conditions are used to check the board position using this string variable. 

Online Chess Game Source Code

Introduction to Online Chess Game Project:

 Among all the games and their types chess is really a interesting game with great scope to play with a higher levels of interest and chess has a great capability to improve the logical and reasoning skills among the users and even it provides a great interest with the number of moves between the users and each and every user uses their intellectual skills to block the other user.

Even chess game is played under different modes like single user and two users and among these types, a single user chess game is really interesting as the player need to play with the computer as his opponent.

In general, when compared to a human move, computer moves are really logical and critical to crack the reason behind the move and thus in most of the cases, gamming players show their ample interest to play the chess against a computer rather than a human and thus single user chess is famous among the gaming world.

 Download Online Chess Game Source Code.

MS Dissertation Project on A Development of Computerized Chess Game Board Source Code

Aims and Objectives

Following are the aims and objectives of this research

Aim: To develop a desktop application for Chess Game that can be played between human player and computer using the tools related to artificial intelligence techniques.

Objectives:

Following are the research objectives

  • To critically review the computer games and the usage range of these games
  • To identify the role of AI in developing a chess game and different algorithms used across to develop a desktop chess game
  • To develop a single user desktop chess game that can be used to play against the computer
  • To evaluate the performance of the AI algorithm in terms of their moves 

Deliverables 

  • A Desktop game for Chess board that can be played against human and computer.
  • The application offers some major features like undo and redo functions, and also has an option for loading and saving the game and also the application will be a user friendly application that will have a good GUI (Graphical User Interface).
  • The application that’s developed will meet all the requirements and the validation of moves for the chess board. 

Research question(s):

  • How can Artificial Intelligence improve the challenge and entertainment of the chess game?
  • Which artificial tools would be more suited?

 Download MS Dissertation Project on A Development of Computerized Chess Game Board Source Code.

MS Dissertation Topic on Distributed Network for Detecting Faults across Network

The main aim of this MS Dissertation project is to evaluate the role of mobile agents in detecting the faults across the distributed networks and incur the fault tolerance techniques across the networks. To prove the proposed concept, Java based application is used in this project and the corresponding design is given in this project. A master server is used in this project and this server can handle two servers and each server considered can handle a maximum of two clients.

A distributed mode to the network is also provided in this project, where the newly clients are added to the next server if the maximum limit of the servers are done and in this way the load on the server is reduced a lot. Java Swings are used to design the user interface and the corresponding implementation procedure is given in this project along with the key discussion to important code is also given and a detailed evaluation to the results is also given.  From the detailed analysis of the results it is clear that there could be many chances for the faults to be occurred across the distributed networks and these faults can be in the range of link failures or distributed network failures.

All these link failures are identified by the mobile agent and displayed to the administrator at any point of time and this information is captured using a perfect database and now the administrators can handle these issues immediately by either setting the link status to ON or suggesting the users to choose an alternative path for the communication to happen. Few distributed network options like adding the clients and servers and sending the information to the desired clients and servers are also provided in this application.

Thus from the overall analysis it is clear that distributed networks are porn to faults and a perfect mobile agent can handle these faults and set back the network on state and ensure each and every client is always connected to the desired server even in the case of faults as the mobile agent can handle all the faults in an efficient manner and even the load on the servers are also reduced due to this mobile agents. The traditional handlings of faults across the distributed network are resolved using the mobile agent based approach. 

 Future work 

Apart from the work done against proving the importance of mobile agent in detecting the faults across the distributed network, future work can be done in this application to improve the scope of the application and it is listed as well. 

  • A detailed evaluation to the mobile agent methodology can be done in future to improve the quality of finding and detecting the faults across the distributed networks
  • Few real time simulation tools can be used to evaluate and compare different agent based fault tolerance techniques across the distributed networks
  • More number of servers and clients can be added to the application to understand the real impact of load on faults across the distributed networks.
This paper is written and submitted by sai