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:

A lot of structures are align to power of two

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

New piece score values

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

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

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:


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

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

Added AddRange()

Added IsSlice()
New Initial value

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

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
  class function IFF(aCondition: boolean; aTrue, aFalse: T): T; inline;
{ TBool<T> }
class function TBool<T>.IFF(aCondition: boolean; aTrue, aFalse: T): T;
  if aCondition then
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
  R := TBool<integer>.IFF(aDepth > 6, 3, 2);

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

  if CurrentScore >= aBeta then
    FCache.Add(FBoard.GetBoardHash(FSide), NO_MOVE, aDepth, CurrentScore, htBeta);
    Exit(aBeta);  //Cutoff!
  end else
    if (CurrentScore <= -PieceValues[ptKing]) and (FMateExtension) then
      mate := True;
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


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:

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

New Update() method

New constant NO_MOVE = 0

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:

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

Speedup and history added
Non moves allowed

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

New IsPromotion() method

New DifferentSide() method

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

Stabilize a bit the Analyze command
New commands searchd and searcht

Download it in the download section (top right)