View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from
Chess Master

4.8 | 4 ratings Rate this file 22 Downloads (last 30 days) File Size: 144 KB File ID: #30594 Version: 1.4
image thumbnail

Chess Master



02 Mar 2011 (Updated )

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

| Watch this File

File Information

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 (9)
04 Oct 2016 Irfan Darmawan

30 Jan 2013 ACLNM

ACLNM (view profile)

very nice work

30 Nov 2011 Muhammad Hussain

good work....

22 Nov 2011 Suleman Shafqat

first issue can be solved by writing
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

Comment only
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.(

24 Mar 2011 Suleman Shafqat

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

Comment only
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.

Comment only
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.

Comment only
22 Mar 2011 Jason

Jason (view profile)

Thanks, gonna try it later. Looks interesting!

Comment only
04 Mar 2011 1.1


22 Mar 2011 1.4


Contact us