Giter Site home page Giter Site logo

gearbox's People

Contributors

cosinekitty avatar

Watchers

 avatar  avatar  avatar  avatar

gearbox's Issues

Implement a UCI engine

Implement UCI protocol for making a Gearbox plugin engine. That way I can use WinBoard, etc as a UI.

Windows GUI: load piece images from executable's directory

Right now there is a hardcoded path to the piece images. This works only on my Windows 10 development machine. Change the code to look for these images in the same folder as the executable. Change the build process to copy the images to the build output directory.

Puzzle solver

Implement a simplistic min-max search that can solve checkmate and/or material-winning analysis, without any concept of positional play. Can test this with some lichess.org puzzles?

Windows GUI: default to finding endgame tables in executable folder

Right now the code requires the environment variable GEARBOX_TABLEBASE_DIR to point to the directory holding the endgame tables, in order to use them. This variable should still be supported, but it should be optional. When not set, the program should look in the same directory as the executable.

Linux GUI?

I'm thinking about creating a standalone GUI application for Linux. Bonus points if it can work for Windows also. I'm looking at Uno Platform.

Saw more invalid Score.Format() return values

I just saw the following invalid strings returned by Score.Format():

2021-01-05T20:32:28.5565523Z MOVE  Kf7          #-3 3Q4/5k1r/8/5P1p/pP5P/P5P1/5PK1/4R3 w - - 1 59
2021-01-05T20:32:28.5776730Z MOVE  Re7+          #3 3Q4/4Rk1r/8/5P1p/pP5P/P5P1/5PK1/8 b - - 2 59
2021-01-05T20:32:28.5777087Z MOVE  Kf6     #--523741824 3Q4/4R2r/5k2/5P1p/pP5P/P5P1/5PK1/8 w - - 3 60
2021-01-05T20:32:28.5783610Z MOVE  Qd6+          #2 8/4R2r/3Q1k2/5P1p/pP5P/P5P1/5PK1/8 b - - 4 60
2021-01-05T20:32:28.5783816Z MOVE  Kxf5    #--523741824 8/4R2r/3Q4/5k1p/pP5P/P5P1/5PK1/8 w - - 0 61
2021-01-05T20:32:28.5785771Z MOVE  Qe6#          #1 8/4R2r/4Q3/5k1p/pP5P/P5P1/5PK1/8 b - - 1 61
2021-01-05T20:32:28.5817165Z STATS  games=212, a_wins=106, a_losses=99, w_wins=107, w_losses=98, draws=7

Parallel table generator fails on Windows 10

Apparently recursive directory deletion is more brittle on Windows 10 than Linux.

2021-01-13T03:14:12.80Z  [00]  Backprop[15]: white changes = 0, black changes = 0, total = 0, prev = 0
Unhandled exception. System.IO.IOException: The process cannot access the file 'b.index' because it is being used by another process.
   at System.IO.FileSystem.RemoveDirectoryRecursive(String fullPath, WIN32_FIND_DATA& findData, Boolean topLevel)
   at System.IO.FileSystem.RemoveDirectory(String fullPath, Boolean recursive)
   at System.IO.Directory.Delete(String path, Boolean recursive)
   at EndgameTableGen.TableGenerator.GenerateTable(Int32[,] config) in c:\don\github\gearbox\src\EndgameTableGen\TableGenerator.cs:line 163
   at EndgameTableGen.ParallelTableGenerator.ThreadFunc(Object arg) in c:\don\github\gearbox\src\EndgameTableGen\ParallelTableGenerator.cs:line 159
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart(Object obj)

Hash board positions

Maintain a hash value inside the Board object as pieces move, etc.
Once this is implemented, it will make an efficient sanity check for PushMove/PopMove: PushMove can save the hash value in the unmove stack, and PopMove can check to make sure the restored hash value matches the popped hash value.

When endgame tables judge a position, Thinker search should not look deeper

Thinker.NegaMax() keeps searching deeper even when the endgame tables report an exact score for the position. No matter what the score is (win, loss, draw), the score should be considered final if the position is known. Probably need to split out the endgame checker to be a separate function from Thinker.Eval().

Windows GUI: allow undo/redo

In the Windows GUI, allow undoing one ply at a time. If undoing the ply results in a position where it is the computer's turn to move, turn off the computer, so it doesn't immediately start thinking again.

Also allow redo back toward the position from which undo was done. If any move is made which deviates from the forward path, snip the future branch and replace it with the single deviating move.

PGN game writer

Given a Board object, or a FEN + a list of Move, generate a PGN game file. Require passing in the minimal set of header tags, and allow arbitrary optional tags.

Board.GetGameResult() needs to know about non-stalemate draws, resignation

I'm adding a function Board.GetGameResult, but it currently only knows about checkmate and stalemate. It calls anything else "game in progress".

There should be a Resign function to indicate that the current player resigns.
The Board also needs to understand about various non-stalemate draws:

  • draw by a agreement. (This is another function like Resign that will have to be called to inform the Board of the free will of the players).
  • draw by repetition of the same position 3 times
  • draw by the 50 move rule
  • draw by insufficient mating material on both sides

The return value may end up being a struct that also includes a code that indicates why the game is a loss/draw, for display purposes in a UI.

Adjust scores in hash table for effective depth

When Thinker scores a position using a hash table hit, the score needs to be adjusted for the actual distance in the future, not the distance in the future when the position was evaluated. Also need to handle repeated positions: if position is repeated once, divide score in half.

Windows GUI: disable controls that don't make sense while computer is thinking.

Evaluate which GUI functions should be disabled while the computer is thinking. Make sure the game state is not corrupted by the computer trying to make a move onto a board that has changed due to user actions.

Also cancel any partially selected human move whenever OnTurnChanged is called. (Not sure this ever happens.)

Endgame tables larger than can fit in memory

I'm considering creating endgame tables for 3 non-king pieces. This will require considerable computation time and storage space. The most interesting issue will be how to make the Thinker class use such tables, since they will not fit in memory.

Possibilities:

  • Probing consists of opening the file, seeking to the correct table index, reading, and closing.
  • Instead of probing these larger tables at every level of the search, I could restrict probing them to the very top level, or the top 2 levels.
  • Once probed, they could be cached in the transposition table. Then I could experiment with allowing probe at any level of the search, just to see how bad performance really is. On a solid state drive this could be viable: every table hit is a perfect eval, and it eliminates any search tree beneath it.
  • Making a smaller version of the table that just has win/lose/draw (2-bit scores) could be extremely valuable for pruning the search, but would risk postponement of wins.
  • Could use 8-bit scores and treat any positions that take more than 127 plies to force mate as a draw, just to reduce disk space.

PGN game reader

Load a game from a PGN file into a Board object. This may imply that the Board needs to store all the tag values, so that it can save back to an identical PGN file (see issue #3).

Windows GUI: splash screen and/or endgame background load

It takes a while to load the endgame tables. This causes a long delay before the chess board is visible. Ideally, I could load the endgame tables in the background and wait until the thinker starts; then block in the thinker thread, instead of blocking the whole UI. If that isn't practical, I should at least have a splash screen so the user can tell something is happening.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.