Peter Downies chessPieceLogic

Soap Functions

Soap Tester




: http://soap.peterdownie.com/webServices/chessPieceLogic/petersWebServiceClassGenerator.php

PDF Auto Documentation


Software Version

: 2.41e

Greater Code Name(GCN)

: Atomic

Lesser Code Name(LCN)

: Proton

Service Version

: 1.04
* Chess Piece logic calculates legal moves or just makes them from a fen or arrays


( )
* This is the fen when the game starts
* This replaces the old version
   This replaces the old starting pieces, has less complexity and returns the value of set FEN.


( )
Gets the current fen


( #0 fen )
Set a fen!


( )
Check to see if you can connect to webservice. Also returns the class name for smarter connection. You do not really need to call this, makes connection easier.


( )
get the array white and then the array black in 1 and 2 in feed
This is just here for legacy reasons, you should really just return the FEN
   Possible output values


( #0 white , #1 black , #2 turn , #3 castlingAvialabilty , #4 enpassant_move , #5 halfMoveClock , #6 fullMoveClock )
sets the pieces of white and black. You could alos use startingPieces instead if the game has not started.
You may now pass null and it will leave the pieces as they are for that color. If you leave both null you will get a warning.
Turn is either 1 or 2
Castling availablity must be KQkq(any combination in order) or - It now be blank for neither
   Possible outputs


( #0 color , #1 move , #2 real )
MakeAMove takes an input and makes a move regardless if the move is legal or not. Used to return piece value. Now returns array of data."
.   ". See tech.
* Update! Returned to using 1 or 2
* Setting real to false disables this function. This is used to find moves that are illegal, which would otherwise write the moves as made!
   Color Possible Input Values
Move Possible inputs
should be of the format a2-a3, rank(small case) file then dash than the rank and file to without spaces. If you reach a promotion square than it must have the format equals and than the upper case piece. Not square is variable and not static like the examples. Castling will be explainedbelow promotion
Possible Promote Pieces
Castling is obtained when the king moves two squares instead of one to a preset square. This means if the program has been modified than it will not work likely. If the king is e and moves to g or if the king is e and moves c than it will castle. You need to make sure this is legal before doing it as strange results may occour if it is not possible.
Piece Arrays
contain all the pieces in an array'Pa2,'Pa3...'


( #0 color , #1 moves_csv )
MultiMove takes a move csv and calls makeAMove with the values. More Info in Tech. Returns an output see tech specs.
   Moves must conform with the specifications detailed at makeAMove tech. No longer returns pieces
Possible outputs!


( #0 color , #1 csvMoves )
netMoves calculates all legal moves and returns an array of moves. Returns in feed a2-a3,a2-a4,a7-a8=Q,e1-f1. Gets rid of illegal  moves
when the king is in check and cannot castle as well as enabling enpassante.
The csv Moves is for enpassante and such, it does not calculate from there as this uses addition computer resources.
   Explanation of parameters required.

CsvMoves: Must be in the form of e2-e4,e7-e5,g1-f3,b8-c6
White/Black pieces array takes an array of black pieces in the form Pa2,Pb2,...Nb1..


( #0 color , #1 move , #2 csvMoves )
Takes a move and makes sure that it is legal, does not check all of the other moves to save processing power
checkForLegalMove takes a move in the format square1-square2, ie a2-a3... The net moves takes a value from netMoves in an
array. If the value is in the array than the move is indeed legal. This function returns 1 of 3 values, the first is LEGAL_MOVE
and the second is ILLEGAL_MOVE. IF there are no moves than CHECKMATE or STALEMATE is given and the game is over
   Explanation of Inputs first and then returns.
colorMove: The move you intend to make, must be in the format of a2-a3, a7-a8=Q
csvMoves: moves in csv of the same format as move.
White/Black Pieces array is an array of pieces Pa2,Pb2...Possible outputs!