Skip to content

Commit

Permalink
Merge pull request #138 from kenshinthebattosai/working
Browse files Browse the repository at this point in the history
Version 0.1 Update
aggravates issue #132
fixes #64
  • Loading branch information
artfuldev committed Feb 13, 2013
2 parents d22d924 + 671b961 commit 9143c15
Show file tree
Hide file tree
Showing 63 changed files with 1,345 additions and 167 deletions.
File renamed without changes.
18 changes: 18 additions & 0 deletions RIGHTS.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* This file is part of "Kenny ClassIQ", (c) Kenshin Himura, 2013.
*
* "Kenny ClassIQ" is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* "Kenny ClassIQ" is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with "Kenny ClassIQ". If not, see <http://www.gnu.org/licenses/>.
*
*/

22 changes: 11 additions & 11 deletions ReadMe.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#Kenny ClassIQ
* Author: Kenshin Himura *(Sudarsan Balaji)*
* License: *GNU GPL v3 and CC-BY-NC-SA Licenses* (see gpl.txt and ccbyncsa.txt)
* Latest Application Version: 0.0.17 build 1698 *([Version History](Version%20History.md#version-history))*
* Latest Stable Version: [-.--](https://github.com/kenshinthebattosai/KennyClassIQ/tree/stable) *([Versioning](Versioning.md#versioning))*
* ReadMe Version: 2.4
* License: *GNU GPL v3* (see COPYING.txt)
* Latest Application Version: 0.1 build 2081 *([Version History](Version%20History.md#version-history))*
* Latest Stable Version: [0.1](https://www.sourceforge.net/projects/kennyclassiq)
*([Versioning](Versioning.md#versioning))*
* ReadMe Version: 2.5

##Description

Expand All @@ -17,13 +18,14 @@ Having completed it successfully, I've gained the confidence to proceed with Ken
Game-breaking features (why you *can't* play against it now):

* Plays only the first move it can find.
* Does not know about checks or mates or draw.
* Does not know about draws.
* Does not do search or evaluation.
* Does not know set-up position properly.

Niceties under the hood (why you *should* play against it later):

* Multi-protocol support: *UCI* and *WinBoard*
* Multi-protocol support: *UCI* and *WinBoard*.
* Lots of things planned! ;)
* Better *Move* system *(Players make Moves in the Game)*.
* Automatic *MoveList* of *Game* updation.
* Better *printMainLine()* implementation.
Expand All @@ -44,8 +46,6 @@ Other features yet to come! :D
* To have a close-to-real-world representation of the game inside the program

###Short Term
* To do legal move checking (if in check or not).
* To make the engine understand how the game ends.
* To finish defining *Game*.
* To finish adding commentary to all uploaded files.
* To design a logo and an icon.
* To start defining the evaluation function.
* To add some sort of search.
* To finish adding commentary to all uploaded files.
18 changes: 15 additions & 3 deletions Version History.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,24 @@
#Kenny ClassIQ
* Author: Kenshin Himura *(Sudarsan Balaji)*
* License: *GNU GPL v3 and CC-BY-NC-SA Licenses* (see gpl.txt and ccbyncsa.txt)
* Latest Application Version: 0.0.17 build 1698
* Latest Stable Version: [-.--](https://github.com/kenshinthebattosai/KennyClassIQ/tree/stable) *([Versioning](Versioning.md#versioning))*
* License: *GNU GPL v3* (see COPYING.txt)
* Latest Application Version: 0.1 build 2081
* Latest Stable Version: [0.1](https://www.sourceforge.net/projects/kennyclassiq) *([Versioning](Versioning.md#versioning))*
* Version History Document Version: 1.6

##Version History

####Version 0.1 (2081) - First Playable Version (nickname *Shinta*)
* Tested a thousand times. Playable, doesn't crash. First stable release.
* Simply plays the first move it can find. Don't expect searches or evaluations in the first playable version.
* Added legal-move-checking. Was a huge pain, but my efforts weren't in vain.
* Improved *Player, Game, Board, AI, Move, Executor, XBoardExecutor, UCIExecutor,* and probably any class you can name.
* Plays legal move it generates.
* Can Play both sides.
* Can play in both *UCI* and *XBoard* modes.
* Fixed lots of major crashes.
* Fixed lots of errors in the undocumented builds. Woah! Took me a hell of a time to clear all those.
* Made installer and hosted it on sourceforge.

#####Version 0.0.17 (1698)
* Improved *Player*.
* Added promotion moves to *Pawn*.
Expand Down
2 changes: 1 addition & 1 deletion Versioning.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Kenny ClassIQ
* Author: Kenshin Himura *(Sudarsan Balaji)*
* License: *GNU GPL v3 and CC-BY-NC-SA Licenses* (see gpl.txt and ccbyncsa.txt)
* License: *GNU GPL v3* (see COPYING.txt)
* Versioning Document Version: 1.6

##Versioning
Expand Down
67 changes: 0 additions & 67 deletions ccbyncsa.txt

This file was deleted.

23 changes: 21 additions & 2 deletions src/com/kenny/classiq/Main.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
/*
* This file is part of "Kenny ClassIQ", (c) Kenshin Himura, 2013.
*
* "Kenny ClassIQ" is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* "Kenny ClassIQ" is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with "Kenny ClassIQ". If not, see <http://www.gnu.org/licenses/>.
*
*/

package com.kenny.classiq;

import java.util.Scanner;
Expand All @@ -13,7 +31,7 @@
* first received commands. Later, this may be expanded to tell
* the difference between GUI and a user. The commands received from
* the GUI are used to play the game (internally).
* @author Kenshin Himura (Sudarsan Balaji)
* @author Kenshin Himura
*
*/
public class Main
Expand Down Expand Up @@ -52,7 +70,8 @@ public static void main(String[] args)
{
//Print introductory and debug messages
System.out.println(Definitions.engineName+" "+Definitions.engineVersion
+" by "+Definitions.authorName);
+" by "+Definitions.authorName+" ("+Definitions.internalAuthorName
+")");
System.out.println("Available Processors: "
+Runtime.getRuntime().availableProcessors());
System.out.println("Available Memory: "
Expand Down
133 changes: 124 additions & 9 deletions src/com/kenny/classiq/board/Board.java
Original file line number Diff line number Diff line change
@@ -1,16 +1,35 @@
/*
* This file is part of "Kenny ClassIQ", (c) Kenshin Himura, 2013.
*
* "Kenny ClassIQ" is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* "Kenny ClassIQ" is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with "Kenny ClassIQ". If not, see <http://www.gnu.org/licenses/>.
*
*/

package com.kenny.classiq.board;

import java.util.ArrayList;

import com.kenny.classiq.game.Game;
import com.kenny.classiq.game.Move;
import com.kenny.classiq.pieces.Piece;

/**
* The <code>Board</code> class is the class which represents a chess board.
* It is made up of objects of the class <code>Square</code>, which are
* also members of objects of classes <code>Rank</code>, <code>File</code>,
* and <code>Diagonal</code>.
* @author Kenshin Himura (Sudarsan Balaji)
* @author Kenshin Himura
*
*/
public class Board
Expand Down Expand Up @@ -216,12 +235,26 @@ public Square getSquare(byte index)
{
return square[index];
}
/**
* Used to get a particular <code>Rank<code> of the <code>Board</code>,
* by specifying its rank index in the <code>Board</code>.
* @param rankIndex The index of the required <code>Rank</code> in
* the <code>Board</code>, as a <code>byte</code> from 0-7.
* @return The specified <code>Rank</code> of this <code>Board</code>.
*/
public Rank getRank(byte rankIndex)
{
if((rankIndex>-1)&&(rankIndex<8))
return rank[rankIndex];
return null;
}
/**
* Used to get a particular <code>File<code> of the <code>Board</code>,
* by specifying its file index in the <code>Board</code>.
* @param fileIndex The index of the required <code>File</code> in
* the <code>Board</code>, as a <code>byte</code> from 0-7.
* @return The specified <code>File</code> of this <code>Board</code>.
*/
public File getFile(byte fileIndex)
{
if((fileIndex>-1)&&(fileIndex<8))
Expand Down Expand Up @@ -250,6 +283,13 @@ public void setGame(Game game)
{
this.game = game;
}
/**
* Used to get the list of <code>Squares</code> which are occupied by
* white pieces. Uses the getOccupiedSquares() function and removes the
* <code>Square</code>s which are occupied by black pieces.
* @return An <code>ArrayList</code> of <code>Square</code>s having
* white <code>Piece</code>s.
*/
public ArrayList<Square> getWhiteOccupiedSquares()
{
ArrayList<Square> returnList=getOccupiedSquares();
Expand All @@ -261,6 +301,13 @@ public ArrayList<Square> getWhiteOccupiedSquares()
}
return returnList;
}
/**
* Used to get the list of <code>Squares</code> which are occupied by
* black pieces. Uses the getOccupiedSquares() function and removes the
* <code>Square</code>s which are occupied by white pieces.
* @return An <code>ArrayList</code> of <code>Square</code>s having
* black <code>Piece</code>s.
*/
public ArrayList<Square> getBlackOccupiedSquares()
{
ArrayList<Square> returnList=getOccupiedSquares();
Expand All @@ -272,6 +319,13 @@ public ArrayList<Square> getBlackOccupiedSquares()
}
return returnList;
}
/**
* Used to get the list of <code>Squares</code> which are occupied by
* pieces. Checks if the </code>Square</code>s are empty and adds the
* <code>Square</code>s which are occupied by pieces.
* @return An <code>ArrayList</code> of <code>Square</code>s having
* <code>Piece</code>s.
*/
public ArrayList<Square> getOccupiedSquares()
{
ArrayList<Square> returnList=new ArrayList<Square>();
Expand All @@ -280,6 +334,13 @@ public ArrayList<Square> getOccupiedSquares()
returnList.add(getSquare(i));
return returnList;
}
/**
* Used to get the list of <code>Squares</code> which are not occupied by
* pieces. Checks if the </code>Square</code>s are empty and adds the
* <code>Square</code>s which are not occupied by pieces.
* @return An <code>ArrayList</code> of <code>Square</code>s not having
* <code>Piece</code>s.
*/
public ArrayList<Square> getEmptySquares()
{
ArrayList<Square> returnList=new ArrayList<Square>();
Expand All @@ -288,16 +349,70 @@ public ArrayList<Square> getEmptySquares()
returnList.add(getSquare(i));
return returnList;
}
public ArrayList<Square> getWhiteCanMoveToSquares()
/**
* Used to get the <code>Square</code> in which the white <code>
* King</code> is present. Used to calculate legality of <code>
* Move</code>s.
* @return The <code>Square</code> in which the white <code>
* King</code> is present.
*/
public Square getWhiteKingSquare()
{
ArrayList<Square> returnList=getEmptySquares();
returnList.addAll(getBlackOccupiedSquares());
return returnList;
for(byte i=0;i<getWhiteOccupiedSquares().size();i++)
if(getWhiteOccupiedSquares().get(i).getPiece().
getShortAlgebraicNotation().matches("K"))
{
return getWhiteOccupiedSquares().get(i);
}
return null;
}
public ArrayList<Square> getBlackCanMoveToSquares()
/**
* Used to get the <code>Square</code> in which the black <code>
* King</code> is present. Used to calculate legality of <code>
* Move</code>s.
* @return The <code>Square</code> in which the black <code>
* King</code> is present.
*/
public Square getBlackKingSquare()
{
ArrayList<Square> returnList=getEmptySquares();
returnList.addAll(getWhiteOccupiedSquares());
return returnList;
for(byte i=0;i<getBlackOccupiedSquares().size();i++)
if(getBlackOccupiedSquares().get(i).getPiece().
getShortAlgebraicNotation().matches("K"))
{
return getBlackOccupiedSquares().get(i);
}
return null;
}
/**
* Used to check if the side specified by the <code>boolean</code>
* is in the checked position on the <code>Board</code>
* @param white The side for which the isChecked test should be
* made.
* @return <code>true</code> if the side's <code>King</code> is in
* check, <code>false</code> otherwise.
*/
public boolean isChecked(boolean white)
{
ArrayList<Square> enemySquares=null;
ArrayList<Move> testMoves=null;
if(white)
enemySquares=getBlackOccupiedSquares();
else
enemySquares=getWhiteOccupiedSquares();
for(byte i=0;i<enemySquares.size();i++)
{
testMoves=enemySquares.get(i).getPiece().getMoves();
if(testMoves!=null)
for(byte j=0;j<testMoves.size();j++)
{
Move testMove=testMoves.get(j);
if(testMove!=null)
if(testMove.isCapturingMove())
if(testMove.getCapturedPiece().
getShortAlgebraicNotation().matches("K"))
return true;
}
}
return false;
}
}
18 changes: 18 additions & 0 deletions src/com/kenny/classiq/board/File.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
/*
* This file is part of "Kenny ClassIQ", (c) Kenshin Himura, 2013.
*
* "Kenny ClassIQ" is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* "Kenny ClassIQ" is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with "Kenny ClassIQ". If not, see <http://www.gnu.org/licenses/>.
*
*/

package com.kenny.classiq.board;

public class File
Expand Down
18 changes: 18 additions & 0 deletions src/com/kenny/classiq/board/Rank.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
/*
* This file is part of "Kenny ClassIQ", (c) Kenshin Himura, 2013.
*
* "Kenny ClassIQ" is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* "Kenny ClassIQ" is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with "Kenny ClassIQ". If not, see <http://www.gnu.org/licenses/>.
*
*/

package com.kenny.classiq.board;

public class Rank
Expand Down

0 comments on commit 9143c15

Please sign in to comment.