A playable UI

Finally The UI And Game Class


The UIBoard  class is too long for me to explain, but the gist is that the UI and the Game class are entirely separated, except for a few methods, and the UI class controls the  Game  class.The methods in the UI class are pretty self-explanatory, but here are the few main points on the mechanics:

a)  The pieces are shown on CustomJLabels so that they can be highlighted and the previous color and the normal color can be stored.

b) For actual creation of UI, the JPanels are arranged in a GridBagLayout.
c) Well...  nothing more is there.


The Game class is also very small with the primary objective of acting as an interface between the UI and the AI.Only two important methods are there,  compMove()  and playerMove(), both of which returns a string pertaining to the move made.That's it.

The methods other than that are mostly used for debugging , except the nextPos(), removePrevPos()  and the  numRepeats()  method which are used for stalemate checking.

These are pretty much the main workings of the chess engine, the ones covered by the last few blogs.

Comments

Popular posts from this blog

Small-to-Large

Segment Tree Beats - An introduction

Getting prepared for RMO