4.66667

4.7 | 3 ratings Rate this file 29 Downloads (last 30 days) File Size: 144 KB File ID: #30594
image thumbnail

Chess Master

by

 

02 Mar 2011 (Updated )

Simple logic, easy to understand code, well commented 4 beginners, must try once.

| Watch this File

File Information
Description

Its a two player game, i am working on developing artificial intelligence based computer player.
American Chess rules are applied.
A 2D array is updated by the position of the chess pieces which are numbered (each piece corresponding to a number)
As the player selects a piece the corresponding number is checked for all possible places where it can move, then the program waits for the second place where it has to be moved.
After each turn the program calls the function "wholoses.m" which will see whether the king is there or not. I am working to change this logic as it should check for CHECK MATE also.

The main function to run is CHESS_on_MATLAB.m
that will call its fig itself
the main m file just calls function "playerturn.m" as the input is given by the user.
this function then calls different functions to check the position of the piece, win loss, etc
"checkfp.m" checks whether the position desired is possible or not, and gives the message if not possible.
Currently the winner has to kill the king while i realized that it should not be the case, it should detect the checkmate condition, so dont worry i am gonna update this in few coming days.

MATLAB release MATLAB 7.9 (R2009b)
Other requirements GUI
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (8)
30 Jan 2013 ACLNM

very nice work

30 Nov 2011 Muhammad Hussain

good work....

22 Nov 2011 Suleman Shafqat

first issue can be solved by writing
h.plrmark=1;
in opening function of the main function that is:
write "h.plrmark=1;" in line number "162" in "CHESS_on_MATLAB.m"

2nd Issue (En_passant) will be solved in next version of CHESS MASTER

thanks for ur feedback

29 Sep 2011 Bharath Lohray

* Black plays first!
* Clicking on the opposite side causes an error to throw in the console (MATLAB 2011b)
* En passsant is not implemented and is claimed as a wrong move.(http://en.wikipedia.org/wiki/En_passant).

24 Mar 2011 Suleman Shafqat

@Newell: The aim is to understand how things work. You can reproduce code as per your OS's requirements.

24 Mar 2011 Suleman Shafqat

The code included is commented for better understanding as well as future work for improvement, if you find any block elusive feel free to ask.

22 Mar 2011 Andrew Newell

I'm eager to try this, but it's not compatible with a Unix-based system because it uses '\' for a file separator. It shouldn't take long to replace this by "filesep" wherever it occurs.

22 Mar 2011 Jason

Thanks, gonna try it later. Looks interesting!

Updates
04 Mar 2011

Summary
Description
Tags

22 Mar 2011

Description

Contact us