Skip to content

Commit

Permalink
Merge ead4219 into bfd70fc
Browse files Browse the repository at this point in the history
  • Loading branch information
bsamseth committed Nov 15, 2018
2 parents bfd70fc + ead4219 commit 111fa0b
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 11 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
cmake_minimum_required(VERSION 3.0)

# Set project name here.
project(Goldfish VERSION 1.6.0 LANGUAGES CXX)
project(Goldfish VERSION 1.7.0 LANGUAGES CXX)


# Include stuff. No change needed.
Expand Down
30 changes: 22 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ original author for his great work. Starting with this project meant a stable
starting point, with all the rules sorted out, basic search in place and a test
suite to make sure it all works as expected.

At this point, the newest version of Goldfish has been substantially revamped and improved
in most aspects (see [Road map](#road-map)).

## Why Goldfish?

For some reason, several top chess engines have names of different fish, e.g.
Expand All @@ -40,25 +43,36 @@ and so it seemed only fitting for my somewhat limited program to be named this.

## Road map

The current plan for the project is to improve the strength, including, but not
limited to:
The current plan for the project is to improve the strength. The following is a
non-exhaustive list of possibilities for future additions, including all features that have
been added so far. The list is inspired in large part by [this writeup](http://www.frayn.net/beowulf/theory.html).

- [X] Making the engine playable on [lichess.org](lichess.org)
- [X] Complete refactoring of base types
- [X] Null move pruning
- [X] Transposition table
- [X] Check extensions
- [X] Killer move heuristic
- [ ] Passed pawn
- [X] Principal variation search
- [ ] Internal iterative deepening
- [ ] Aspiration window search
- [ ] Futility pruning
- [ ] Staged move generation
- [ ] Better search algorithms, such as MTD-bi
- [ ] Better search algorithms, such as MTD-bi (?)
- [ ] More sophisticated static evaluation
+ [ ] Extra considerations for passed pawns
+ [ ] Piece square tables
+ [ ] King safety
+ [ ] Center control
+ [ ] Rooks on the 7th rank
+ [ ] Bishops on main diagonals


Each significant change will result in a new version of the engine (see
releases). In the following you see a relative rating between the current
versions. In this rating system, v1.0 is held at 2000 rating points, and the
others are adjusted accordingly. This gives an impression of the relative
improvements of the engine over time.
[releases](https://github.com/bsamseth/Goldfish/releases)). In the following
you see a relative rating between the current versions. In this rating system,
v1.0 is held at 2000 rating points, and the others are adjusted accordingly.
This gives an impression of the relative improvements of the engine over time.

|# |PLAYER | RATING | POINTS | PLAYED | (%)|
|:---:|---|:---:|:---:|:---:|:---:|
Expand Down
45 changes: 43 additions & 2 deletions src/search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,34 @@ void Search::search_root(Depth depth, int alpha, int beta) {
protocol.send_status(false, current_depth, current_max_depth, total_nodes, current_move, current_move_number);

position.make_move(move);
int value = -search(depth - 1, -beta, -alpha, ply + 1);
int value;
//
// Principal Variation Search
//
// Search first move fully, then just check for moves that will
// improve alpha using a 1-point search window. If first move was
// best, then we will save lots of time as bounding is much faster than
// finding exact scores. Given a good ordering (which we have due to
// iterative deepening) the first move will be very good, and lots of
// cutoffs can be made.
//
// If we find a later move that actually improves alpha, we must search this
// properly to find its value. The idea is that this drawback is smaller than
// the improvements gained.
//
if (depth > 2 and i > 0) {

value = -search(depth - 1, -alpha - 1, -alpha, ply + 1);

if (value >= alpha) {
// PV search failed high, need to do a full search.
value = -search(depth - 1, -beta, -alpha, ply + 1);
}
}
// First move, or to shallow for PV search - search fully.
else {
value = -search(depth - 1, -beta, -alpha, ply + 1);
}
position.undo_move(move);

if (abort) {
Expand Down Expand Up @@ -513,7 +540,21 @@ int Search::search(Depth depth, int alpha, int beta, int ply) {
position.make_move(move);
if (!position.is_check(~position.active_color)) {
searched_moves++;
value = -search(depth - 1, -beta, -alpha, ply + 1);
//
// Principal Variation Search (see search_root for details).
//
if (depth > 1 and i > 0) {

value = -search(depth - 1, -alpha - 1, -alpha, ply + 1);

if (value >= alpha) {
// PV search failed high, need to do a full search.
value = -search(depth - 1, -beta, -alpha, ply + 1);
}
} else {
// First move or to shallow - do full search.
value = -search(depth - 1, -beta, -alpha, ply + 1);
}
}
position.undo_move(move);

Expand Down

0 comments on commit 111fa0b

Please sign in to comment.