Git Product home page Git Product logo

libforchess's People

Contributors

jazzyb avatar

Watchers

 avatar  avatar

libforchess's Issues

Mac OS X Shark Profiler

Change the Makefile such that "make profiler" builds *.mshark files on Mac OS X instead of the default gprof.

Fix Memory Leaks

I don't know that any are actually there, but I'm filing this issue so that I remember to run valgrind over my code.

Switch to a Legitimate License

I've mostly made up the current license of the project. Look into applying a legitimate license to the library such as MIT, BSD, Apache, or maybe even LGPL.

Add fc_ai_next_ranked_moves()

Add a function to the AI API that returns all moves available to a player ranked based on the returned score for that move.

The definition should look similar to fc_ai_next_move:

int fc_ai_next_ranked_moves (fc_ai_t *ai, fc_mlist_t *list, fc_player_t player, int depth, unsigned int seconds, size_t num_threads);

Cannot Build with --std=c89 on 32-bit Systems

"gcc --std=c89" does not allow the ULL syntax to declare an unsigned long long constant. This feature was added with the C99 standard. I got around this originally by converting the UINT64_C(x) macro to "((uint64_t)x)". However, I only tested this on my 64-bit Mac OS X where longs (the default constant type) are 64 bits. When "make check" was run on a 32-bit Ubuntu box, the source files utilizing UINT64_C() failed to build.

I suggest that either we remove the C89 flag requirement for compilation or we convert all UINT64_C(x) to ((uint64_t) << 32) | ((uint64_t)) or some equivalent.

Update Game Config File Format

The current config files that can be read in to generate a board do not make a distinction between pawns of one color and those same pawns that are controlled by another player (due to the king being captured). The config file format should allow an intuitive way to specify which player controls which pawns.

Undo Moves to Board

The move structs now have enough info in them that we can undo a move to a board rather than making copies of the board and moving on those.

AI Move Timeout

Set a timeout value on the AI so that when the timeout is reached, the AI will return the best move it has found up to that point.

Create Iterative Version of fc_board_get_moves()

Create an iterative version of fc_board_get_moves() which gets moves for just one piece at a time. Call the function in question from the AI code instead of fc_board_get_moves(). This way we can take advantage of alphabeta cutoffs without mixing the AI and game logic.

Simple Example Depth and Time Options

The simple example program should accept options -d and -t. The -d option should take a number for the plycount that the program ought to search. The -t option should be the timeout value for the search algorithm. Both of these options may be optional, and if they are not provided by the user, the program should use sensible defaults.

Linux Cannot Find Shared Object File

When building LibForchess as a shared object library (with "make check", e.g.), I get the error:

error while loading shared libraries: libforchess.so: cannot open shared object file: No such file or directory

Need to figure out why gcc (even with the -L option) cannot find the library and fix the Makefile.

The work-around is to build LibForchess as a archive file: "make libforchess STATIC=1".

Combine ruby-forchess with libforchess

Add the ruby wrapper to this repo by putting the ruby source under the lib/ directory. The Rakefile that runs the tests can be put in the test/ directory along with all the test*.r files and invoked with "rake -f test/Rakefile".

Assertion Fails in fc_get_pawn_moves()

In commit d746891.

The example program when run with the parameters -d 4 2 4 results in a segfault for the moves (1: d1-e1 a5-a4 e5-e4 h4-h5).

The following GDB output shows that an assertion is failing in fc_get_pawn_moves() where the program can't find the orientation of a particular pawn.

libforchess.git$ gdb ./a.out
GNU gdb 6.3.50-20050815 (Apple version gdb-1515) (Sat Jan 15 08:33:48 UTC 2011)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin"...Reading symbols for shared libraries ... done

(gdb) run -d 4 2 4
Starting program: /Users/jazzyb/src/libforchess.git/a.out -d 4 2 4
Reading symbols for shared libraries ++. done
1:  d1-e1   :: 0s
2: warning: this program uses gets(), which is unsafe.
a5-a4
3:  e5-e4   :: 0s
4: h4-h5
Assertion failed: (0), function fc_get_pawn_moves, file src/board.c, line 460.

Program received signal SIGABRT, Aborted.
0x00007fff8329b0b6 in __kill ()
(gdb) where
#0  0x00007fff8329b0b6 in __kill ()
#1  0x00007fff8333b9f6 in abort ()
#2  0x00007fff833289bc in __assert_rtn ()
#3  0x00000001000074bb in fc_get_pawn_moves (board=0x100809900, moves=0x100100180, player=FC_FOURTH) at src/board.c:460
#4  0x0000000100007d29 in fc_board_get_moves (board=0x100809900, moves=0x100100180, player=FC_FOURTH) at src/board.c:701
#5  0x00000001000056ff in alphabeta (ai=0x7fff5fbfde90, ret=0x0, player=FC_FOURTH, depth=1, alpha=-50, beta=2147483647, max=0) at src/ai.c:163
#6  0x0000000100005904 in move_and_adjust_scores (mv=0x100802190, ai=0x7fff5fbfde90, ret=0x0, player=FC_THIRD, depth=2, alpha=0x7fff5fbfdb84, beta=0x7fff5fbfdb80, max=1) at src/ai.c:217
#7  0x00000001000057d9 in alphabeta (ai=0x7fff5fbfde90, ret=0x0, player=FC_THIRD, depth=2, alpha=-50, beta=2147483647, max=1) at src/ai.c:185
#8  0x0000000100005904 in move_and_adjust_scores (mv=0x100804800, ai=0x7fff5fbfde90, ret=0x0, player=FC_SECOND, depth=3, alpha=0x7fff5fbfdc84, beta=0x7fff5fbfdc80, max=0) at src/ai.c:217
#9  0x00000001000057d9 in alphabeta (ai=0x7fff5fbfde90, ret=0x0, player=FC_SECOND, depth=3, alpha=-2147483648, beta=2147483647, max=0) at src/ai.c:185
#10 0x0000000100005904 in move_and_adjust_scores (mv=0x100807028, ai=0x7fff5fbfde90, ret=0x7fff5fbfde60, player=FC_FIRST, depth=4, alpha=0x7fff5fbfdd84, beta=0x7fff5fbfdd80, max=1) at src/ai.c:217
#11 0x00000001000057d9 in alphabeta (ai=0x7fff5fbfde90, ret=0x7fff5fbfde60, player=FC_FIRST, depth=4, alpha=-2147483648, beta=2147483647, max=1) at src/ai.c:185
#12 0x0000000100005e29 in fc_ai_next_move (ai=0x7fff5fbfde90, ret=0x7fff5fbfde60, player=FC_FIRST, depth=4, seconds=0) at src/ai.c:362
#13 0x000000010000139f in make_computer_move (game=0x7fff5fbfdfe0, player=FC_FIRST, depth=4, timeout=0) at examples/cli/simple.c:205
#14 0x000000010000104f in main (argc=5, argv=0x7fff5fbfe040) at examples/cli/simple.c:120
(gdb)

Material Bitboards

Keep material scores for all players in the board and adjust the scores per move.

Remove Threading Support

I've spent some considerable time thinking about this, and I can find no reason to keep the threaded alphabeta/negascout functions in the code base. Threading functionality should be handled at a higher level than this engine, and there is nothing in the multithreaded algorithm that requires low-level access to the engine. We should allow the user to define any method of concurrency that they choose whether it be Erlang, the JVM, or iOS's dispatch queue.

Deprecate fc_board_setup

This function should be deprecated once the new Forchess Engine Communication Protocol and config format are in place.

Negascout

Convert AI code from alphabeta pruning to negascout.

Convert Code to C++

A C++ library might turn out to be more portable (and certainly more extensible) than the current C library allows. I have a suspicion that C++ would give user's more ability to modify how the AI behaves. If this gets done, it will take a major overhaul to the API.

Gprof + Pthreads

Make sure that gprof works correctly with pthreads and doesn't profile just the main thread.

Clean-up Game API

The game API (game.h/game.c) needs to either be re-engineered or removed entirely. If the latter choice is taken, then the example code will need to be rewritten.

Values in Moves

When we first determine the moves available to a player, keep track of the value of the position after the move, e.g. the capture of a rook will be 500, the promotion of a pawn to a queen will be 800. This can allow us to order the moves in the mlist based on their immediate advantage and hopefully find the best moves faster.

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.