Java Chess

Description

I wanted to attempt to simulate chess. model it without checking how others had done it before, Pseudo code it and then implement those design decisions to get a working Chess Game.

to this i needed to define Pieces, Player,Board Game and Square Objects.

I utilize static methods heavily at this time to allow for continuity and there is substantial re factoring required regards allowing for multiple game instances.

 

  • when a player chooses one of their available pieces, Based on the piece type an array of allowed moves is generated using the current layout of the board.
  • The possible movement of the pieces are then highlighted on the board.
  • if and when the player chooses one of the allowed moves the board gets updated, checking for a check scenario, if the move was legal the game continues swapping the board
  • the check algorithm utilities a two step optimization approach, removing most of the brute force checks on each cycle.
  • although it is unable to move into check, the game itself does not currently define a checkMate scenario at this time.

 

I have used Third party Icons for the pieces, and have used photo shopped images of marble for the board effect.

 http://www.rw-designer.com/icon-detail/7582

I have a checkMate algorithm that is not fully functional  and is mostly Pseudo at this time .

as I am tempted to make a stab at creating an AI Object to play as the second player, this algorithm is subject to change.

 

EDIT -15.12-14

V1.2 alpha

-Added “Optimist Prime” my naive AI Algorithm( very slow and full of wishful thinking). the AI operates given the current state of the board it plays the next 3 moves for each piece against all enemy possible moves to 3 scenarios, this semi-brute force approach is woefully slow taking 40sec or so to return when Queens have a full range of motion.

– the Alogrithim currently focuses on the best possible outcome rather than assuming the enemy will play to their advantage! (Hence Optimist).

-Optimization of this algorithm is very much needed including a refusal to recommend a negative Check scenario as best option.

-Players have the option to play with another Human or against the AI.

-Minor bug fixes

-Major bugs added 😛

 

– WARNING  – This is very much Alpha, the AI System uses (Wastes) large amount of RAM hitting over 4Gigs at one stage in testing

 

TRY IT!

 

 

Language Used

1.7


Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *