crazywa.git
8 years agoAllow up to 1GB hash
H.G.Muller [Tue, 7 Feb 2017 20:57:25 +0000]
Allow up to 1GB hash

Previously 256MB was the maximum.

8 years agoInherit killers from before check + evasion
H.G.Muller [Tue, 7 Feb 2017 20:49:58 +0000]
Inherit killers from before check + evasion

Normally killers of the next level are cleared when we enter a new node.
But if the move reaching the new node was a check evasion, we now set them
to the killers at this evasion level, to see if those still work after a
spite check.

8 years agoReduce thinking time in Wa Shogi
H.G.Muller [Tue, 7 Feb 2017 19:53:00 +0000]
Reduce thinking time in Wa Shogi

Due to the high branching factor time was too aggressively used up in
Wa Shogi. The timeusage is now reduced by 33% to avoid time trouble.

8 years agoPrevent check evasions can become killers
H.G.Muller [Tue, 7 Feb 2017 19:28:38 +0000]
Prevent check evasions can become killers

Check evasions are tactical replies specific to the preceding moves
(as checks cannot be pre-existing), and are thus not suitable for trying
in sibbling nodes that do not check. It is even unlikely they would carry
over to other checks.

8 years agoImplement mate killers
H.G.Muller [Tue, 7 Feb 2017 19:23:12 +0000]
Implement mate killers

Moves that force mate aftera check evasion are remembered in a mateKillers
table, indexed by the preceding evasion. Such moves are tried in QS as
reply to the same evasion. This should make it more difficult to push
tsume mates over the horizon by spite checks in a hisshi situation.

8 years agoAdapt PST for small variants
H.G.Muller [Tue, 7 Feb 2017 19:09:39 +0000]
Adapt PST for small variants

In mini- and Judkins' Shogi generals now get a bonus of 30 for being
an Alfil jump away from the King corner. And the King gets abonus for
staying in its corner, and less penalty for being in front of his Pawn.

8 years agoAssign correct PST in all Shogi variants
H.G.Muller [Tue, 7 Feb 2017 19:04:42 +0000]
Assign correct PST in all Shogi variants

The available piece-square tables are now assigned dependent on the
variant, where a new variant-idexed table of strings indicates which
table goes with which piece.

8 years agoReject obviously wrong hash move
H.G.Muller [Mon, 6 Feb 2017 22:13:01 +0000]
Reject obviously wrong hash move

A move with a piece of the wrong color, or a drop of a piece not in hand
will now not be accepted as hash move, and cause the hashed in-check info
to be ignored.

8 years agoAllow only moves that beat alpha to become best move
H.G.Muller [Mon, 6 Feb 2017 22:02:30 +0000]
Allow only moves that beat alpha to become best move

In case of a fail low we don't want to sort a garbage move in front for
the next iteration.

8 years agoDo not try killers when in check
H.G.Muller [Mon, 6 Feb 2017 21:57:38 +0000]
Do not try killers when in check

Killer moves are unlikely to be check evasions. Also do not try to test
null killers for (pseudo-)legality.

8 years agoFix null move
H.G.Muller [Mon, 6 Feb 2017 21:49:19 +0000]
Fix null move

The null-move search used a null window at alpha, instead of beta.

8 years agoFix crash by input-buffer overrun
H.G.Muller [Mon, 6 Feb 2017 21:38:37 +0000]
Fix crash by input-buffer overrun

The input buffer was too small to hold Wa-Shogi FENs.

8 years agoImplement history heuristic
H.G.Muller [Mon, 6 Feb 2017 21:35:25 +0000]
Implement history heuristic

The non-captures are now sorted by history score before searching them.

8 years agoKeep track of checking history
H.G.Muller [Mon, 6 Feb 2017 21:27:05 +0000]
Keep track of checking history

An array checkHist[] records checks from the game as well as the search.

8 years agoUse CECP mate-score convention
H.G.Muller [Mon, 6 Feb 2017 19:54:09 +0000]
Use CECP mate-score convention

Mate in N is now printed as 100000+N.

8 years agoAllow e.p. capture as check evasion
H.G.Muller [Mon, 6 Feb 2017 18:24:38 +0000]
Allow e.p. capture as check evasion

The routine NonEvade, which vets move when in check before making them,
now recognizes e.p. captures (i.e. diagonal Pawn moves to an empty square)
when a Pawn is checking as a valid evasion.

8 years agoIndicate last rank in zone table
H.G.Muller [Mon, 6 Feb 2017 18:15:18 +0000]
Indicate last rank in zone table

The least-sigificant bit in the zone table is nowused to indicate first
and second rank. This is used to forbid Pawn drops as check evasions.
Which is OK for crazyhouse, but is overruled on 1st rank for Shogi.
The last-2-ranks bits are suppressed in mini-Shogi (which has no Knight).

8 years agoFix deferral
H.G.Muller [Mon, 6 Feb 2017 18:05:37 +0000]
Fix deferral

Pieces that could promote would not be allowed to defer. Which is OK for
Crazyhouse, but not for Shogi. Now only pieces that have the must-promote
ormust-promote-one-last-2-ranks flags set get their promotion suppressed
where these flags request it.

8 years agoBeef up pseudo-legality checking
H.G.Muller [Mon, 6 Feb 2017 17:57:05 +0000]
Beef up pseudo-legality checking

The routine PseudoLegal, used test killer moves for legality, now checks
if the move is a non-capture, if a dropped piece has the right color,
and accepts Pawn moves (including double-pushes). Castlings are still
rejected.

8 years agoPenalize King view in eval
H.G.Muller [Mon, 6 Feb 2017 17:22:26 +0000]
Penalize King view in eval

An asymmetric eval penalty is given for each square from which a distant
check can be given.

8 years agoAlter Pawn-shield scoring
H.G.Muller [Mon, 6 Feb 2017 17:17:22 +0000]
Alter Pawn-shield scoring

8 years agoFix King location in Eval
H.G.Muller [Mon, 6 Feb 2017 17:07:43 +0000]
Fix King location in Eval

The evaluation routine still assumed location[] was an array of 64,
rather than 96, so it expected the King location in the wrong place.

8 years agoPenalize King advance
H.G.Muller [Mon, 6 Feb 2017 17:01:19 +0000]
Penalize King advance

Advancing the King to before the Pawns now gets penalized, both in the
normal evaluation and in the King Seige term. Impasses because of reaching
the promotion zone are awarded.

8 years agoIncrease mate score
H.G.Muller [Mon, 6 Feb 2017 16:50:51 +0000]
Increase mate score

Scores can now run to +/- 15000 centi-Pawn; 8000 was dangerously close
to what eval scores could be.

8 years agoMake minimum LMR depth a macro, foreasy tuning
H.G.Muller [Sat, 14 Jan 2017 18:07:55 +0000]
Make minimum LMR depth a macro, foreasy tuning

8 years agoRespect minimum LMR depth during hash probing
H.G.Muller [Sat, 14 Jan 2017 18:00:06 +0000]
Respect minimum LMR depth during hash probing

We can add the reduction to the actual search depth to determine up to
which depth a probe result ca be used, but only if the actual depth is
at least the miimumdepth where LMR is allowed.

8 years agoPrune futile interpositions at d <= 1
H.G.Muller [Sat, 14 Jan 2017 17:50:56 +0000]
Prune futile interpositions at d <= 1

A variable ipMask records squares attacked by board moves along the
check ray, immediately after move generation. Evasion drops are then
limited only to such squares, at depth <= 1.

8 years agoAssert no unexpected King capture
H.G.Muller [Sat, 14 Jan 2017 17:40:30 +0000]
Assert no unexpected King capture

A hash-key collision sometimes leaves a King up for grabs.

8 years agoFix depth reporting
H.G.Muller [Sat, 14 Jan 2017 17:33:00 +0000]
Fix depth reporting

Use the original reduction for depth bootstrapping.

8 years agoPut drops start after castlings
H.G.Muller [Sat, 14 Jan 2017 12:11:54 +0000]
Put drops start after castlings

8 years agoValue castling rights
H.G.Muller [Sat, 14 Jan 2017 12:06:23 +0000]
Value castling rights

The evaluation now takes possesion of castling rights into account.
It is also figured out if castling is actually possible.

8 years agoKeep track of attacked squares near King
H.G.Muller [Sat, 14 Jan 2017 11:48:19 +0000]
Keep track of attacked squares near King

The move generator now marks all attacked squares on an auxiliary board.
At the end it counts the number of such squares next to the enemy King,
empty squares and captures separately. It also counts the number of
unattacked empty squares next to the King.

8 years agoDisarm printing of debug boards
H.G.Muller [Sat, 14 Jan 2017 10:39:13 +0000]
Disarm printing of debug boards

When running under XBoard, printing a board would be seen as Thinking
Output. Now the board lines are prefixedwith #, as CECP requires.

8 years agoKeep track of total hand values
H.G.Muller [Sat, 14 Jan 2017 10:30:20 +0000]
Keep track of total hand values

With the aidof two new tables, handBulk[] (piece-list size) and dropBulk[]
(board sized), we now keep track of the total value of pieces in the hands.
This is stored in the promoGain for piece type 30, (which is not used in
any variant), to easily index it with the side to move.

8 years agoImplement drop restrictions for Shogi
H.G.Muller [Wed, 28 Dec 2016 19:39:23 +0000]
Implement drop restrictions for Shogi

The various routines for dropping pieces now repect the rules that
pieces should not be dropped where they have no moves.

8 years agoSuppress check test after null move
H.G.Muller [Wed, 28 Dec 2016 18:26:47 +0000]
Suppress check test after null move

After null move we should never be in check, but the test for determining
it would use variables that might not be initialized (like to-square).
Make sure we indicate there is no check (also in checkDist, which is used
testing for distant checks).

8 years agoImplement castling
H.G.Muller [Wed, 28 Dec 2016 16:40:27 +0000]
Implement castling

MoveGen() now also generates castlings. Legality is tested by the kludge
of replacing the Rook by a second King during the (early) move generation
in the next ply. MakeMove() is refactored to make sure both King and Rook
victim are saved. In addition promotion is now implemented by OR'ing the
promoInc into the piece code,tomake the engine resistent to promoting an
already-promoted piece (e.g. due to hash-move mixup).

8 years agoPrint setup and piece commands in engine-defined variants
H.G.Muller [Wed, 28 Dec 2016 16:01:16 +0000]
Print setup and piece commands in engine-defined variants

A setup command with the start position is now sent whenever a variant
is initialized, and ptc[] contains a piece-to-char table for that variant.
In addition, piece commands are sent when betza[] contains move definitions
for that variant.

8 years agoReorder pieces, and define values for all variants
H.G.Muller [Wed, 28 Dec 2016 15:47:23 +0000]
Reorder pieces, and define values for all variants

Lance now immediately follows Pawn, so that they can be taken out of the
droppable set together when calculating evasion drops on last rank. The
downside is that the Lance will participate in mini- and Judkins' Shogi
as a non-present piece. The piece IDs of Wa Shogi are changed to conform
with Sjaak II's assigment,and the startup FEN is changed accordingly.
Piece values are assigned for all variants.

8 years agoMake variants also accessible through systematic names
H.G.Muller [Wed, 28 Dec 2016 14:17:18 +0000]
Make variants also accessible through systematic names

The engine-defined variants are now also announced as 5x5+5_shogi etc.,
and such names are matched based on the board parameters in the variant-
definition table.

8 years agoPut Tori Shogi 6th in variant-description list
H.G.Muller [Wed, 28 Dec 2016 14:10:53 +0000]
Put Tori Shogi 6th in variant-description list

This to put all variants that have non-Pawn pieces with drop restriction
contiguously.

8 years agoFix reading of Shogi-promoted pieces in FEN
H.G.Muller [Wed, 28 Dec 2016 14:05:17 +0000]
Fix reading of Shogi-promoted pieces in FEN

The '+' sign in FENs was considered a digit, and thus did not have the
intended effect.

8 years agoAdd and initialize some more piece-square tables
H.G.Muller [Wed, 28 Dec 2016 13:59:58 +0000]
Add and initialize some more piece-square tables

The number of PST in increased to 9 pairs, and they are initialized
to be useful for various groups of pieces (e.g. Shogi generals).

8 years agoImplement randomizing
H.G.Muller [Fri, 21 Oct 2016 12:57:36 +0000]
Implement randomizing

The first 10 half-moves are now randomized by adding a small random bonus
to each move in the root.

8 years agoInitial version of engine
H.G.Muller [Fri, 21 Oct 2016 12:38:05 +0000]
Initial version of engine

Crazyhouse sort of works here.