Friday, December 31, 2010

Sirio on Youtube

Finally I manage to upload this video made with DosBox:



Soon I will upload the sources...

ChessKISS 0.7

Last day of the year and a new version..., from readme.txt:


31/12/10 0.7 update:

-General
A lot of structures are align to power of two

-Board
FillMoves() also fills Pawns
Get rid off UpdateIndices(), a new approach is used

-Definitions
New piece score values

-Engine
Movements now use TStack<string>
Movements are now cleared after each game
Eval command now returns debug info

-Evaluation
New debug info
Isolated double pawns are counted
UndevelopedKnightRookComboPenalty() was used as bonus when it a penalty
Castling bonus removed
No castling rights are penalty only are initial and middle stages
Fianchetto bonus fixed
Pawn penalty now uses fixed values rather than incremental values (for the moment)
Blocked center penalty improved
KING_NOT_ON_SIDE_PENALTY uses a new approach

-Moves
Now En passant moves have the sufix "/ep"

Tuesday, December 21, 2010

ChessKISS 0.6

Well, another update, this is getting close to the end...

From readme:


21/12/10, 0.6 update:

-General
Cleaning

-Board
GenerateEvasions() works but still not used
Fixed castling rights
Pawn generation optimized a bit
GetCastlingRights() was also setting rights
Now the engine correctly choose the rook side once is discarding castling rights

-Evaluation
Unstoppable bonus error
BLOCKING_CENTER was issued to all pawns rather than to only one
A bit of pawn storm

-Moves
Added AddRange()

-Pieces
Added IsSlice()
New Initial value

-Search
Checks in Quiescent() not done until Captures stage
Checks in See() go to good captures even if they loose material
Removed temporally the dynamic window

-Zobrist
Finally the hash takes into account the castling rights

Sunday, December 12, 2010

Ternary operator ? in Delphi

Delphi does not have an ternary operator, but with templates we can do something similar:


TBool<T> = class
public
  class function IFF(aCondition: boolean; aTrue, aFalse: T): T; inline;
end;
{ TBool<T> }
class function TBool<T>.IFF(aCondition: boolean; aTrue, aFalse: T): T;
begin
  if aCondition then
    Exit(aTrue)
  else
    Exit(aFalse);
end;
I use it in ChessKISS (just for fun) in this way:
//Null moves
mate := False;
if (FUseNullMove and FAllowNullMove) and (CurrentCheck = checkNo) and (CurrentStage <> sPawnEnding) then
begin
  R := TBool<integer>.IFF(aDepth > 6, 3, 2);

  Switch;
  FAllowNullMove := False;  //do not use recursive null moves
  CurrentScore := -AlphaBeta(-aBeta, -aBeta + 1, aDepth - R);
  FAllowNullMove := True;
  Switch;

  if CurrentScore >= aBeta then
  begin
    FCache.Add(FBoard.GetBoardHash(FSide), NO_MOVE, aDepth, CurrentScore, htBeta);
    Exit(aBeta);  //Cutoff!
  end else
    if (CurrentScore <= -PieceValues[ptKing]) and (FMateExtension) then
      mate := True;
end;
The main problem with that is that both expressions are evaluated before the call is make, which it should not be a problem I we know that, but avoid expensive calls like:
TBool<boolean>IFF(i > 3, ExpensiveTrue(), ExpensiveFalse())
Since it will call both functions, both functions will be evaluated. This another example that can even be worse:
TBool<integer>IFF(list <> nil, list.Count, 'null')
If the list is null then Houston we have a problem since it will anyway evaluate List.Count.

Monday, December 6, 2010

ChessKISS 0.5

Hi

After long time I think that finally I have a stable version, is difficult to conciliate work, family and hobbies, I've made some silly errors that should not happend in a normal situation, but well, that's life. Nevertheless I'm quite proud of this creature...


From readme:


06/12/10, 0.5 update:

-Search
Added contempt factor
Fixed nasty error, a whole node ignored by futility always returned DRAW
Removed OutOfBoard(), now is called InsideBoard() and uses a new schema
Removed all try/finally

-History
New Update() method

-Moves
New constant NO_MOVE = 0

-Evaluation
New bonus added in Rooks
No king pawn penalty missing left col
Fixed king attack Path[]
Fixed silly error, returning negative values in king attack rather than positive values
Fixed PawnInfo initialization

Friday, December 3, 2010

ChessKISS, new version 0.4

A new version has been deployed, from readme:


03/12/10, 0.4 update:

-Board,
New GenerateEvassions(), not working 100%
Fixed some minor issues
New Perft() method

-Transposition
Speedup and history added
Non moves allowed

-Evaluation
General optimization
New king attack scheme
Removed pinning in pawn and queen
Fixed double pawns (both pawns were penalized)
New rook connection
New bishop pair scheme
More pawn rewards
New mobility scheme
Added fianchetto
Added king weak pawn

-Moves
New IsPromotion() method

-Piece
New DifferentSide() method

-Search
Fix nasty reduction error
New iterative deepening scheme
Remove bad captures in Quiescent() unless in check

-Engine
Stabilize a bit the Analyze command
New commands searchd and searcht

Download it in the download section (top right)