├── LICENSE.md ├── README.md ├── extensions ├── PHP5 │ ├── cboard │ │ ├── calloc.c │ │ ├── calloc.h │ │ ├── carray.c │ │ ├── carray.h │ │ ├── cboard.cpp │ │ ├── chess.c │ │ ├── chess.h │ │ ├── config.m4 │ │ ├── config.w32 │ │ ├── fen.c │ │ ├── fen.h │ │ ├── generate.c │ │ ├── generate.h │ │ ├── move.c │ │ ├── move.h │ │ ├── parse.c │ │ ├── parse.h │ │ ├── php_cboard.h │ │ ├── position.c │ │ ├── position.h │ │ ├── print.c │ │ ├── print.h │ │ ├── unmove.c │ │ └── unmove.h │ ├── ccboard │ │ ├── ccboard.cpp │ │ ├── config.m4 │ │ ├── config.w32 │ │ ├── php_ccboard.h │ │ ├── xiangqi.cpp │ │ └── xiangqi.h │ ├── ccegtbprobe │ │ ├── GROUP.dat │ │ ├── LZMA │ │ │ ├── 7zTypes.h │ │ │ ├── Alloc.c │ │ │ ├── Alloc.h │ │ │ ├── Compiler.h │ │ │ ├── CpuArch.c │ │ │ ├── CpuArch.h │ │ │ ├── LzFind.c │ │ │ ├── LzFind.h │ │ │ ├── LzHash.h │ │ │ ├── LzmaDec.c │ │ │ ├── LzmaDec.h │ │ │ ├── LzmaEnc.c │ │ │ ├── LzmaEnc.h │ │ │ ├── LzmaLib.c │ │ │ ├── LzmaLib.h │ │ │ └── Precomp.h │ │ ├── ccegtbprobe.cpp │ │ ├── config.m4 │ │ ├── config.w32 │ │ ├── php_ccegtbprobe.h │ │ ├── piece_set.cpp │ │ ├── piece_set.h │ │ └── xiangqi.h │ └── xxhash │ │ ├── .gitignore │ │ ├── README.md │ │ ├── config.m4 │ │ ├── config.w32 │ │ ├── php_xxhash.c │ │ ├── php_xxhash.h │ │ ├── xxh3.h │ │ ├── xxhash.c │ │ └── xxhash.h └── PHP7 │ ├── README.txt │ ├── cboard │ ├── calloc.c │ ├── calloc.h │ ├── carray.c │ ├── carray.h │ ├── cboard.cpp │ ├── chess.c │ ├── chess.h │ ├── config.m4 │ ├── config.w32 │ ├── fen.c │ ├── fen.h │ ├── generate.c │ ├── generate.h │ ├── move.c │ ├── move.h │ ├── parse.c │ ├── parse.h │ ├── php_cboard.h │ ├── position.c │ ├── position.h │ ├── print.c │ ├── print.h │ ├── unmove.c │ └── unmove.h │ ├── ccboard │ ├── ccboard.cpp │ ├── config.m4 │ ├── config.w32 │ ├── php_ccboard.h │ ├── xiangqi.cpp │ └── xiangqi.h │ ├── ccegtbprobe │ ├── GROUP.dat │ ├── LZMA │ │ ├── 7zTypes.h │ │ ├── Alloc.c │ │ ├── Alloc.h │ │ ├── Compiler.h │ │ ├── CpuArch.c │ │ ├── CpuArch.h │ │ ├── LzFind.c │ │ ├── LzFind.h │ │ ├── LzHash.h │ │ ├── LzmaDec.c │ │ ├── LzmaDec.h │ │ ├── LzmaEnc.c │ │ ├── LzmaEnc.h │ │ ├── LzmaLib.c │ │ ├── LzmaLib.h │ │ └── Precomp.h │ ├── ccegtbprobe.cpp │ ├── config.m4 │ ├── config.w32 │ ├── php_ccegtbprobe.h │ ├── piece_set.cpp │ ├── piece_set.h │ └── xiangqi.h │ ├── judy │ ├── .gitignore │ ├── .travis.yml │ ├── CREDITS │ ├── EXPERIMENTAL │ ├── LICENSE │ ├── README.md │ ├── config.m4 │ ├── config.w32 │ ├── examples │ │ ├── judy-bench-bitset.php │ │ ├── judy-bench-int_to_int.php │ │ ├── judy-bench-string_to_int.php │ │ └── judy.php │ ├── judy_arrayaccess.c │ ├── judy_arrayaccess.h │ ├── judy_handlers.c │ ├── judy_handlers.h │ ├── judy_iterator.c │ ├── judy_iterator.h │ ├── package.xml │ ├── php_judy.c │ ├── php_judy.h │ └── tests │ │ ├── 001.phpt │ │ ├── bitset_001.phpt │ │ ├── bitset_002.phpt │ │ ├── bitset_003.phpt │ │ ├── bitset_004.phpt │ │ ├── bitset_005.phpt │ │ ├── bitset_006.phpt │ │ ├── bitset_007.phpt │ │ ├── github_issue15_001.phpt │ │ ├── github_issue15_002.phpt │ │ ├── github_issue1_001.phpt │ │ ├── github_issue1_002.phpt │ │ ├── github_issue2_001.phpt │ │ ├── github_issue2_002.phpt │ │ ├── github_issue2_003.phpt │ │ ├── github_issue3_001.phpt │ │ ├── int_to_int_001.phpt │ │ ├── int_to_int_002.phpt │ │ ├── int_to_int_003.phpt │ │ ├── int_to_int_004.phpt │ │ ├── int_to_int_005.phpt │ │ ├── int_to_int_006.phpt │ │ ├── int_to_int_007.phpt │ │ ├── int_to_int_008.phpt │ │ ├── int_to_mixed_001.phpt │ │ ├── int_to_mixed_002.phpt │ │ ├── int_to_mixed_003.phpt │ │ ├── int_to_mixed_004.phpt │ │ ├── int_to_mixed_005.phpt │ │ ├── int_to_mixed_006.phpt │ │ ├── int_to_mixed_007.phpt │ │ ├── judy_error.phpt │ │ ├── judy_foreach_bitset.phpt │ │ ├── judy_foreach_int_to_int.phpt │ │ ├── judy_foreach_int_to_mixed.phpt │ │ ├── judy_foreach_string_to_int.phpt │ │ ├── judy_foreach_string_to_mixed.phpt │ │ ├── judy_type.phpt │ │ ├── string_to_int_001.phpt │ │ ├── string_to_int_002.phpt │ │ ├── string_to_int_003.phpt │ │ ├── string_to_int_004.phpt │ │ ├── string_to_int_005.phpt │ │ ├── string_to_mixed_001.phpt │ │ ├── string_to_mixed_002.phpt │ │ ├── string_to_mixed_003.phpt │ │ ├── string_to_mixed_004.phpt │ │ ├── string_to_mixed_005.phpt │ │ ├── strings_as_keys.phpt │ │ └── strings_as_values.phpt │ └── xxhash │ ├── .gitignore │ ├── README.md │ ├── config.m4 │ ├── config.w32 │ ├── php_xxhash.c │ ├── php_xxhash.h │ ├── xxh3.h │ ├── xxhash.c │ └── xxhash.h ├── scripts ├── advance.php ├── advancec.php ├── book.py ├── bootstrap.php ├── bootstrapc.php ├── dumper.php ├── dumperc.php ├── update.php └── updatec.php ├── web ├── cdb.php ├── chessdb.php ├── cloudbook_api.html ├── cloudbook_api_en.html ├── cloudbook_info.html ├── cloudbook_info_en.html ├── cloudbookc_api.html ├── cloudbookc_api_en.html ├── cloudbookc_info.html ├── cloudbookc_info_en.html ├── file │ ├── auto.png │ ├── ba.png │ ├── bb.png │ ├── bc.png │ ├── bk.png │ ├── bn.png │ ├── bp.png │ ├── br.png │ ├── bturn.png │ ├── camera.png │ ├── cap.gif │ ├── chess.js │ ├── chess │ │ ├── bb.svg │ │ ├── bk.svg │ │ ├── bn.svg │ │ ├── bp.svg │ │ ├── bq.svg │ │ ├── br.svg │ │ ├── bturn.png │ │ ├── cap.gif │ │ ├── chess.svg │ │ ├── point.gif │ │ ├── select.gif │ │ ├── waypoint.gif │ │ ├── wb.svg │ │ ├── wk.svg │ │ ├── wn.svg │ │ ├── wp.svg │ │ ├── wq.svg │ │ ├── wr.svg │ │ └── wturn.png │ ├── del.gif │ ├── move.gif │ ├── oo.gif │ ├── ooo.gif │ ├── point.gif │ ├── queue.png │ ├── refresh.png │ ├── select.gif │ ├── sorttable.js │ ├── style.css │ ├── style_candy.css │ ├── style_mint.css │ ├── wa.png │ ├── waypoint.gif │ ├── wb.png │ ├── wc.png │ ├── wk.png │ ├── wn.png │ ├── wp.png │ ├── wr.png │ ├── wturn.png │ └── xiangqi.gif ├── index.php ├── query │ ├── file │ │ └── xiangqi.js │ └── index.html ├── query_en │ ├── file │ │ └── xiangqi.js │ └── index.html ├── queryc │ ├── file │ │ └── cdb.js │ └── index.html ├── queryc_en │ ├── file │ │ └── cdb.js │ └── index.html ├── stats.php └── statsc.php └── workers ├── Client_Chess ├── App.config ├── ChessDBClient.csproj ├── ChessDBClient.sln ├── ChessDotNet │ ├── CastlingType.cs │ ├── ChessGame.cs │ ├── ChessUtilities.cs │ ├── DetailedMove.cs │ ├── GameCreationData.cs │ ├── Move.cs │ ├── MoveType.cs │ ├── PgnException.cs │ ├── PgnReader.cs │ ├── Piece.cs │ ├── Pieces │ │ ├── Bishop.cs │ │ ├── King.cs │ │ ├── Knight.cs │ │ ├── Pawn.cs │ │ ├── Queen.cs │ │ └── Rook.cs │ ├── Players.cs │ ├── Position.cs │ └── PositionDistance.cs ├── Program.cs ├── Properties │ └── AssemblyInfo.cs └── app.manifest ├── Client_Xiangqi ├── App.config ├── ChessDBClient.csproj ├── ChessDBClient.sln ├── Program.cs ├── Properties │ └── AssemblyInfo.cs └── app.manifest ├── Discover_Chess ├── ChessDBDiscover.sln └── ChessDBDiscover │ ├── App.config │ ├── ChessDBDiscover.csproj │ ├── ChessDotNet │ ├── CastlingType.cs │ ├── ChessGame.cs │ ├── ChessUtilities.cs │ ├── DetailedMove.cs │ ├── GameCreationData.cs │ ├── Move.cs │ ├── MoveType.cs │ ├── PgnException.cs │ ├── PgnReader.cs │ ├── Piece.cs │ ├── Pieces │ │ ├── Bishop.cs │ │ ├── King.cs │ │ ├── Knight.cs │ │ ├── Pawn.cs │ │ ├── Queen.cs │ │ └── Rook.cs │ ├── Players.cs │ ├── Position.cs │ └── PositionDistance.cs │ ├── Program.cs │ └── Properties │ └── AssemblyInfo.cs ├── Discover_Xiangqi ├── ChessDBDiscover.sln └── ChessDBDiscover │ ├── App.config │ ├── ChessDBDiscover.csproj │ ├── Program.cs │ └── Properties │ └── AssemblyInfo.cs ├── Sel_Chess ├── ChessDBSel.sln └── ChessDBSel │ ├── App.config │ ├── ChessDBSel.csproj │ ├── Program.cs │ └── Properties │ └── AssemblyInfo.cs └── Sel_Xiangqi ├── ChessDBSel.sln └── ChessDBSel ├── App.config ├── ChessDBSel.csproj ├── Program.cs └── Properties └── AssemblyInfo.cs /LICENSE.md: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | -------------------------------------------------------------------------------- /extensions/PHP5/cboard/calloc.c: -------------------------------------------------------------------------------- 1 | #include "calloc.h" 2 | 3 | #include 4 | 5 | static int alloc_count = 0; 6 | 7 | void* chess_alloc(size_t size) 8 | { 9 | alloc_count++; 10 | return malloc(size); 11 | } 12 | 13 | void* chess_realloc(void* ptr, size_t size) 14 | { 15 | return realloc(ptr, size); 16 | } 17 | 18 | void chess_free(void* ptr) 19 | { 20 | alloc_count--; 21 | free(ptr); 22 | } 23 | 24 | int chess_alloc_count(void) 25 | { 26 | return alloc_count; 27 | } 28 | -------------------------------------------------------------------------------- /extensions/PHP5/cboard/calloc.h: -------------------------------------------------------------------------------- 1 | #ifndef CHESSLIB_ALLOC_H_ 2 | #define CHESSLIB_ALLOC_H_ 3 | 4 | #include 5 | 6 | void* chess_alloc(size_t size); 7 | void* chess_realloc(void* ptr, size_t size); 8 | void chess_free(void* ptr); 9 | 10 | int chess_alloc_count(void); 11 | 12 | #endif /* CHESSLIB_ALLOC_H_ */ 13 | -------------------------------------------------------------------------------- /extensions/PHP5/cboard/carray.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "carray.h" 6 | #include "calloc.h" 7 | 8 | void chess_array_init(ChessArray* array, size_t elem_size) 9 | { 10 | array->elem_size = elem_size; 11 | array->size = 0; 12 | array->max_size = 0; 13 | } 14 | 15 | void chess_array_cleanup(ChessArray* array) 16 | { 17 | if (array->max_size > 0) 18 | chess_free(array->data); 19 | } 20 | 21 | size_t chess_array_size(const ChessArray* array) 22 | { 23 | return array->size; 24 | } 25 | 26 | const void* chess_array_data(const ChessArray* array) 27 | { 28 | assert(array->size > 0); 29 | return array->data; 30 | } 31 | 32 | const void* chess_array_elem(const ChessArray* array, size_t index) 33 | { 34 | assert(index < array->size); 35 | return (const char*)array->data + (index * array->elem_size); 36 | } 37 | 38 | void chess_array_clear(ChessArray* array) 39 | { 40 | if (array->max_size > 0) 41 | { 42 | chess_free(array->data); 43 | array->size = 0; 44 | array->max_size = 0; 45 | } 46 | } 47 | 48 | void chess_array_set_elem(ChessArray* array, size_t index, const void* value) 49 | { 50 | void* dest; 51 | assert(index < array->size); 52 | dest = (char*)array->data + (index * array->elem_size); 53 | memcpy(dest, value, array->elem_size); 54 | } 55 | 56 | static void expand(ChessArray* array) 57 | { 58 | size_t new_size = array->max_size ? array->max_size * 2 : 8; 59 | if (array->max_size > 0) 60 | array->data = chess_realloc(array->data, new_size * array->elem_size); 61 | else 62 | array->data = chess_alloc(new_size * array->elem_size); 63 | array->max_size = new_size; 64 | } 65 | 66 | void chess_array_push(ChessArray* array, const void* elem) 67 | { 68 | if (array->size == array->max_size) 69 | { 70 | expand(array); 71 | } 72 | assert(array->size < array->max_size); 73 | chess_array_set_elem(array, array->size++, elem); 74 | } 75 | 76 | void chess_array_pop(ChessArray* array, void* elem) 77 | { 78 | assert(array->size > 0); 79 | if (elem) 80 | { 81 | size_t index = array->size - 1; 82 | void* src = (char*)array->data + (index * array->elem_size); 83 | memcpy(elem, src, array->elem_size); 84 | } 85 | array->size--; 86 | } 87 | 88 | void chess_array_prune(ChessArray* array, size_t size) 89 | { 90 | assert(size <= array->size); 91 | array->size = size; 92 | } 93 | -------------------------------------------------------------------------------- /extensions/PHP5/cboard/carray.h: -------------------------------------------------------------------------------- 1 | #ifndef CHESSLIB_ARRAY_H_ 2 | #define CHESSLIB_ARRAY_H_ 3 | 4 | typedef struct ChessArray 5 | { 6 | size_t elem_size; 7 | size_t size; 8 | size_t max_size; 9 | void* data; 10 | } ChessArray; 11 | 12 | void chess_array_init(ChessArray*, size_t elem_size); 13 | void chess_array_cleanup(ChessArray*); 14 | 15 | size_t chess_array_size(const ChessArray*); 16 | const void* chess_array_data(const ChessArray*); 17 | const void* chess_array_elem(const ChessArray*, size_t index); 18 | 19 | void chess_array_clear(ChessArray*); 20 | void chess_array_set_elem(ChessArray*, size_t index, const void* elem); 21 | void chess_array_push(ChessArray*, const void* elem); 22 | void chess_array_pop(ChessArray*, void* elem); 23 | void chess_array_prune(ChessArray*, size_t size); 24 | 25 | #endif /* CHESSLIB_ARRAY_H_ */ 26 | -------------------------------------------------------------------------------- /extensions/PHP5/cboard/chess.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "chess.h" 6 | 7 | static const char piece_chars[] = "PpNnBbRrQqKk"; 8 | static const char rank_chars[] = "12345678"; 9 | static const char file_chars[] = "abcdefgh"; 10 | 11 | ChessColor chess_color_other(ChessColor color) 12 | { 13 | assert(color == CHESS_COLOR_WHITE || color == CHESS_COLOR_BLACK); 14 | return (color == CHESS_COLOR_WHITE) ? CHESS_COLOR_BLACK : CHESS_COLOR_WHITE; 15 | } 16 | 17 | ChessColor chess_piece_color(ChessPiece piece) 18 | { 19 | assert(piece >= CHESS_PIECE_WHITE_PAWN && piece <= CHESS_PIECE_BLACK_KING); 20 | return (piece % 2); 21 | } 22 | 23 | ChessPiece chess_piece_of_color(ChessPiece piece, ChessColor color) 24 | { 25 | assert(piece >= CHESS_PIECE_WHITE_PAWN && piece <= CHESS_PIECE_BLACK_KING); 26 | return (piece & ~1) + color; 27 | } 28 | 29 | char chess_piece_to_char(ChessPiece piece) 30 | { 31 | assert(piece >= CHESS_PIECE_WHITE_PAWN && piece <= CHESS_PIECE_BLACK_KING); 32 | return piece_chars[piece - CHESS_PIECE_WHITE_PAWN]; 33 | } 34 | 35 | ChessPiece chess_piece_from_char(char c) 36 | { 37 | char* s = strchr(piece_chars, c); 38 | return (s && *s) ? CHESS_PIECE_WHITE_PAWN + (s - piece_chars) : CHESS_PIECE_NONE; 39 | } 40 | 41 | ChessSquare chess_square_from_fr(ChessFile file, ChessRank rank) 42 | { 43 | assert(file >= CHESS_FILE_A && file <= CHESS_FILE_H); 44 | assert(rank >= CHESS_RANK_1 && rank <= CHESS_RANK_8); 45 | return rank * 8 + file; 46 | } 47 | 48 | ChessFile chess_square_file(ChessSquare square) 49 | { 50 | return (square % 8); 51 | } 52 | 53 | ChessRank chess_square_rank(ChessSquare square) 54 | { 55 | return (square / 8); 56 | } 57 | 58 | ChessFile chess_file_from_char(char c) 59 | { 60 | char *s = strchr(file_chars, c); 61 | return (s && *s) ? s - file_chars : CHESS_FILE_INVALID; 62 | } 63 | 64 | ChessRank chess_rank_from_char(char c) 65 | { 66 | char *s = strchr(rank_chars, c); 67 | return (s && *s) ? s - rank_chars : CHESS_RANK_INVALID; 68 | } 69 | 70 | char chess_file_to_char(ChessFile file) 71 | { 72 | assert(file >= CHESS_FILE_A && file <= CHESS_FILE_H); 73 | return file_chars[file]; 74 | } 75 | 76 | char chess_rank_to_char(ChessRank rank) 77 | { 78 | assert(rank >= CHESS_RANK_1 && rank <= CHESS_RANK_8); 79 | return rank_chars[rank]; 80 | } 81 | -------------------------------------------------------------------------------- /extensions/PHP5/cboard/config.m4: -------------------------------------------------------------------------------- 1 | PHP_ARG_ENABLE(cboard, whether to enable CBoard, 2 | [ --enable-cboard Enable CBoard extension]) 3 | 4 | if test "$PHP_CBOARD" != "no"; then 5 | AC_DEFINE(HAVE_CBOARD,1,[ ]) 6 | PHP_REQUIRE_CXX() 7 | PHP_ADD_LIBRARY(stdc++, "", EXTRA_LDFLAGS) 8 | PHP_NEW_EXTENSION(cboard, cboard.cpp calloc.c carray.c chess.c fen.c generate.c move.c parse.c position.c print.c unmove.c, $ext_shared) 9 | fi 10 | -------------------------------------------------------------------------------- /extensions/PHP5/cboard/config.w32: -------------------------------------------------------------------------------- 1 | ARG_ENABLE("cboard", "CBoard Support", "no"); 2 | 3 | if (PHP_CBOARD == "yes") { 4 | EXTENSION("cboard", "cboard.cpp calloc.c carray.c chess.c fen.c generate.c move.c parse.c position.c print.c unmove.c"); 5 | AC_DEFINE('HAVE_CBOARD', 1, 'Have CBoard support', false); 6 | } 7 | -------------------------------------------------------------------------------- /extensions/PHP5/cboard/fen.h: -------------------------------------------------------------------------------- 1 | #ifndef CHESSLIB_FEN_H_ 2 | #define CHESSLIB_FEN_H_ 3 | 4 | #include "chess.h" 5 | #include "position.h" 6 | 7 | /* Longest possible FEN string is about 102 characters */ 8 | #define CHESS_FEN_MAX_LENGTH 128 9 | 10 | extern const char* const CHESS_FEN_STARTING_POSITION; 11 | 12 | ChessBoolean chess_fen_load(const char* s, ChessPosition*); 13 | int chess_fen_save(const ChessPosition*, char* s); 14 | 15 | #endif /* CHESSLIB_FEN_H_ */ 16 | -------------------------------------------------------------------------------- /extensions/PHP5/cboard/generate.h: -------------------------------------------------------------------------------- 1 | #ifndef CHESSLIB_GENERATE_H_ 2 | #define CHESSLIB_GENERATE_H_ 3 | 4 | #include 5 | #include "chess.h" 6 | #include "position.h" 7 | #include "carray.h" 8 | 9 | typedef struct 10 | { 11 | const ChessPosition* position; 12 | ChessSquare sq; 13 | ChessSquare to; 14 | int d; 15 | ChessMovePromote promote; 16 | ChessCastleState castle; 17 | bool is_ep; 18 | } ChessMoveGenerator; 19 | 20 | void chess_generate_init(void); 21 | 22 | void chess_move_generator_init(ChessMoveGenerator*, const ChessPosition*); 23 | ChessMove chess_move_generator_next(ChessMoveGenerator*); 24 | 25 | void chess_generate_moves(const ChessPosition*, ChessArray*); 26 | ChessBoolean chess_generate_is_square_attacked(const ChessPosition*, ChessSquare, ChessColor); 27 | ChessBoolean chess_generate_check_impossible(const ChessPosition*, ChessSquare, ChessColor); 28 | bool chess_has_legal_ep(const ChessPosition* position); 29 | 30 | #endif /* CHESSLIB_GENERATE_H_ */ 31 | -------------------------------------------------------------------------------- /extensions/PHP5/cboard/move.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "chess.h" 5 | #include "move.h" 6 | 7 | static const char promote_chars[] = "qrbn"; 8 | 9 | ChessMove CHESS_MOVE_NULL = 0x80000000; 10 | 11 | ChessMovePromote chess_move_promote_from_char(char c) 12 | { 13 | char* s = strchr(promote_chars, c); 14 | return (s && *s) ? CHESS_MOVE_PROMOTE_QUEEN + (s - promote_chars) : CHESS_MOVE_PROMOTE_NONE; 15 | } 16 | 17 | char chess_move_promote_to_char(ChessMovePromote promote) 18 | { 19 | assert(promote >= CHESS_MOVE_PROMOTE_QUEEN && promote <= CHESS_MOVE_PROMOTE_KNIGHT); 20 | return promote_chars[promote - CHESS_MOVE_PROMOTE_QUEEN]; 21 | } 22 | 23 | ChessSquare chess_move_from(ChessMove move) 24 | { 25 | return move & 077; 26 | } 27 | 28 | ChessSquare chess_move_to(ChessMove move) 29 | { 30 | return (move >> 6) & 077; 31 | } 32 | 33 | ChessMovePromote chess_move_promotes(ChessMove move) 34 | { 35 | return (move >> 12) & 017; 36 | } 37 | 38 | ChessMove chess_move_make(ChessSquare from, ChessSquare to) 39 | { 40 | return from | (to << 6); 41 | } 42 | 43 | ChessMove chess_move_make_promote(ChessSquare from, ChessSquare to, ChessMovePromote promote) 44 | { 45 | return from | (to << 6) | (promote << 12); 46 | } 47 | -------------------------------------------------------------------------------- /extensions/PHP5/cboard/move.h: -------------------------------------------------------------------------------- 1 | #ifndef CHESSLIB_MOVE_H_ 2 | #define CHESSLIB_MOVE_H_ 3 | 4 | #include "chess.h" 5 | 6 | typedef int ChessMove; 7 | 8 | typedef enum 9 | { 10 | CHESS_MOVE_PROMOTE_NONE = 0, 11 | CHESS_MOVE_PROMOTE_QUEEN = 1, 12 | CHESS_MOVE_PROMOTE_ROOK = 2, 13 | CHESS_MOVE_PROMOTE_BISHOP = 3, 14 | CHESS_MOVE_PROMOTE_KNIGHT = 4 15 | } ChessMovePromote; 16 | 17 | extern ChessMove CHESS_MOVE_NULL; 18 | 19 | ChessMovePromote chess_move_promote_from_char(char); 20 | char chess_move_promote_to_char(ChessMovePromote); 21 | 22 | ChessSquare chess_move_from(ChessMove); 23 | ChessSquare chess_move_to(ChessMove); 24 | ChessMovePromote chess_move_promotes(ChessMove); 25 | 26 | ChessMove chess_move_make(ChessSquare from, ChessSquare to); 27 | ChessMove chess_move_make_promote(ChessSquare from, ChessSquare to, ChessMovePromote); 28 | 29 | #endif /* CHESSLIB_MOVE_H_ */ 30 | -------------------------------------------------------------------------------- /extensions/PHP5/cboard/parse.h: -------------------------------------------------------------------------------- 1 | #ifndef CHESSLIB_PARSE_H_ 2 | #define CHESSLIB_PARSE_H_ 3 | 4 | #include "move.h" 5 | #include "position.h" 6 | 7 | typedef enum { 8 | CHESS_PARSE_MOVE_OK = 0, 9 | CHESS_PARSE_MOVE_ERROR, 10 | CHESS_PARSE_MOVE_ILLEGAL, 11 | CHESS_PARSE_MOVE_AMBIGUOUS 12 | } ChessParseMoveResult; 13 | 14 | ChessParseMoveResult chess_parse_move(const char* s, const ChessPosition*, ChessMove*); 15 | 16 | #endif /* CHESSLIB_PARSE_H_ */ 17 | -------------------------------------------------------------------------------- /extensions/PHP5/cboard/php_cboard.h: -------------------------------------------------------------------------------- 1 | #ifndef PHP_CBOARD_H 2 | #define PHP_CBOARD_H 3 | 4 | extern zend_module_entry cboard_module_entry; 5 | #define phpext_cboard_ptr &cboard_module_entry 6 | 7 | PHP_MINIT_FUNCTION(cboard); 8 | PHP_FUNCTION(cbgetfen); 9 | PHP_FUNCTION(cbmovegen); 10 | PHP_FUNCTION(cbmovemake); 11 | PHP_FUNCTION(cbmovesan); 12 | PHP_FUNCTION(cbincheck); 13 | 14 | PHP_FUNCTION(cbgetBWfen); 15 | PHP_FUNCTION(cbgetBWmove); 16 | 17 | PHP_FUNCTION(cbfen2hexfen); 18 | PHP_FUNCTION(cbhexfen2fen); 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /extensions/PHP5/cboard/position.h: -------------------------------------------------------------------------------- 1 | #ifndef CHESSLIB_POSITION_H_ 2 | #define CHESSLIB_POSITION_H_ 3 | 4 | #include "chess.h" 5 | #include "move.h" 6 | #include "unmove.h" 7 | 8 | typedef struct 9 | { 10 | /* Variables that store the current state of the board. */ 11 | ChessPiece piece[64]; 12 | ChessColor to_move; 13 | ChessCastleState castle; 14 | ChessFile ep; 15 | int fifty; 16 | int move_num; 17 | /* The remaining members are private and should not be used. */ 18 | ChessSquare wking, bking; 19 | } ChessPosition; 20 | 21 | void chess_position_copy(const ChessPosition* from, ChessPosition* to); 22 | 23 | /* Validates the given position by checking some simple invariants, and if 24 | * valid, sets up any extra internal state. This method MUST be called after 25 | * setting up a new position. If position is invalid, returns CHESS_FALSE. 26 | * 27 | * The following invariants are checked: 28 | * 1. Both sides have one king each. 29 | * 2. There are no pawns on the first or last rank. 30 | * 3. The opponent's king can not immediately be captured. 31 | * 32 | * In addition, any castle or en-passant states are cleared if they are 33 | * impossible (e.g. if the king is not on its starting square). 34 | */ 35 | ChessBoolean chess_position_validate(ChessPosition*); 36 | 37 | ChessBoolean chess_position_is_check(const ChessPosition*); 38 | ChessBoolean chess_position_move_is_legal(const ChessPosition*, ChessMove); 39 | ChessBoolean chess_position_move_is_capture(const ChessPosition*, ChessMove); 40 | ChessResult chess_position_check_result(const ChessPosition*); 41 | 42 | ChessUnmove chess_position_make_move(ChessPosition*, ChessMove); 43 | void chess_position_undo_move(ChessPosition*, ChessUnmove); 44 | 45 | #endif /* CHESSLIB_POSITION_H_ */ 46 | -------------------------------------------------------------------------------- /extensions/PHP5/cboard/print.h: -------------------------------------------------------------------------------- 1 | #ifndef CHESSLIB_PRINT_H_ 2 | #define CHESSLIB_PRINT_H_ 3 | 4 | #include "move.h" 5 | #include "position.h" 6 | 7 | int chess_print_move(ChessMove, char* s); 8 | int chess_print_move_san(ChessMove, const ChessPosition*, char* s); 9 | int chess_print_position(const ChessPosition*, char* s); 10 | int chess_print_result(ChessResult, char* s); 11 | 12 | #endif /* CHESSLIB_PRINT_H_ */ 13 | -------------------------------------------------------------------------------- /extensions/PHP5/cboard/unmove.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "unmove.h" 4 | 5 | ChessUnmove chess_unmove_make( 6 | ChessSquare from, ChessSquare to, ChessUnmoveCaptured captured, 7 | ChessBoolean promotion, ChessUnmoveEp ep, 8 | ChessCastleState castle, int fifty) 9 | { 10 | /* When capturing ep, captured piece must be NONE */ 11 | assert(ep != CHESS_UNMOVE_EP_CAPTURE || captured == CHESS_UNMOVE_CAPTURED_NONE); 12 | assert(ep >= CHESS_UNMOVE_EP_NONE); 13 | assert((int)ep <= CHESS_UNMOVE_EP_AVAILABLE + CHESS_FILE_H); 14 | 15 | return from /* 6 bits */ 16 | | (to << 6) /* 6 bits */ 17 | | (captured << 12) /* 3 bits */ 18 | | (promotion << 15) /* 1 bit */ 19 | | (ep << 16) /* 4 bits */ 20 | | (castle << 20) /* 4 bits */ 21 | | (fifty << 24); /* remaining 8 bits */ 22 | } 23 | 24 | ChessSquare chess_unmove_from(ChessUnmove unmove) 25 | { 26 | return unmove & 077; 27 | } 28 | 29 | ChessSquare chess_unmove_to(ChessUnmove unmove) 30 | { 31 | return (unmove >> 6) & 077; 32 | } 33 | 34 | ChessUnmoveCaptured chess_unmove_captured(ChessUnmove unmove) 35 | { 36 | return (unmove >> 12) & 07; 37 | } 38 | 39 | ChessBoolean chess_unmove_promotion(ChessUnmove unmove) 40 | { 41 | return (unmove >> 15) & 1; 42 | } 43 | 44 | ChessUnmoveEp chess_unmove_ep(ChessUnmove unmove) 45 | { 46 | return (unmove >> 16) & 0xf; 47 | } 48 | 49 | ChessCastleState chess_unmove_castle(ChessUnmove unmove) 50 | { 51 | return (unmove >> 20) & 0xf; 52 | } 53 | 54 | int chess_unmove_fifty(ChessUnmove unmove) 55 | { 56 | return (unmove >> 24); 57 | } 58 | -------------------------------------------------------------------------------- /extensions/PHP5/cboard/unmove.h: -------------------------------------------------------------------------------- 1 | #ifndef CHESSLIB_UNMOVE_H_ 2 | #define CHESSLIB_UNMOVE_H_ 3 | 4 | #include "chess.h" 5 | 6 | typedef unsigned int ChessUnmove; 7 | 8 | typedef enum 9 | { 10 | CHESS_UNMOVE_CAPTURED_NONE = 0, 11 | CHESS_UNMOVE_CAPTURED_PAWN = 1, 12 | CHESS_UNMOVE_CAPTURED_KNIGHT = 2, 13 | CHESS_UNMOVE_CAPTURED_BISHOP = 3, 14 | CHESS_UNMOVE_CAPTURED_ROOK = 4, 15 | CHESS_UNMOVE_CAPTURED_QUEEN = 5 16 | } ChessUnmoveCaptured; 17 | 18 | typedef enum 19 | { 20 | CHESS_UNMOVE_EP_NONE = 0, 21 | CHESS_UNMOVE_EP_CAPTURE = 1, 22 | CHESS_UNMOVE_EP_AVAILABLE = 2 23 | /* values 2->9 correspond to the file if you subtract 2 */ 24 | } ChessUnmoveEp; 25 | 26 | /* Constructor */ 27 | ChessUnmove chess_unmove_make( 28 | ChessSquare from, ChessSquare to, ChessUnmoveCaptured captured, 29 | ChessBoolean promotion, ChessUnmoveEp ep, 30 | ChessCastleState castle, int fifty); 31 | 32 | /* Accessors */ 33 | ChessSquare chess_unmove_from(ChessUnmove); 34 | ChessSquare chess_unmove_to(ChessUnmove); 35 | ChessUnmoveCaptured chess_unmove_captured(ChessUnmove); 36 | ChessBoolean chess_unmove_promotion(ChessUnmove); 37 | ChessUnmoveEp chess_unmove_ep(ChessUnmove); 38 | ChessCastleState chess_unmove_castle(ChessUnmove); 39 | int chess_unmove_fifty(ChessUnmove); 40 | 41 | #endif /* CHESSLIB_UNMOVE_H_ */ 42 | -------------------------------------------------------------------------------- /extensions/PHP5/ccboard/config.m4: -------------------------------------------------------------------------------- 1 | PHP_ARG_ENABLE(ccboard, whether to enable CCBoard, 2 | [ --enable-ccboard Enable CCBoard extension]) 3 | 4 | if test "$PHP_CCBOARD" != "no"; then 5 | AC_DEFINE(HAVE_CCBOARD,1,[ ]) 6 | PHP_REQUIRE_CXX() 7 | PHP_ADD_LIBRARY(stdc++, "", EXTRA_LDFLAGS) 8 | PHP_NEW_EXTENSION(ccboard, ccboard.cpp xiangqi.cpp, $ext_shared) 9 | fi 10 | -------------------------------------------------------------------------------- /extensions/PHP5/ccboard/config.w32: -------------------------------------------------------------------------------- 1 | ARG_ENABLE("ccboard", "CCBoard Support", "no"); 2 | 3 | if (PHP_CCBOARD == "yes") { 4 | EXTENSION("ccboard", "ccboard.cpp xiangqi.cpp"); 5 | AC_DEFINE('HAVE_CCBOARD', 1, 'Have CCBoard support', false); 6 | } 7 | -------------------------------------------------------------------------------- /extensions/PHP5/ccboard/php_ccboard.h: -------------------------------------------------------------------------------- 1 | #ifndef PHP_CCBOARD_H 2 | #define PHP_CCBOARD_H 3 | 4 | extern zend_module_entry ccboard_module_entry; 5 | #define phpext_ccboard_ptr &ccboard_module_entry 6 | 7 | PHP_MINIT_FUNCTION(ccboard); 8 | PHP_FUNCTION(ccbgetfen); 9 | PHP_FUNCTION(ccbmovegen); 10 | PHP_FUNCTION(ccbmovemake); 11 | PHP_FUNCTION(ccbincheck); 12 | 13 | PHP_FUNCTION(ccbgetLRfen); 14 | PHP_FUNCTION(ccbgetBWfen); 15 | PHP_FUNCTION(ccbgetLRBWfen); 16 | 17 | PHP_FUNCTION(ccbgetLRmove); 18 | PHP_FUNCTION(ccbgetBWmove); 19 | PHP_FUNCTION(ccbgetLRBWmove); 20 | 21 | PHP_FUNCTION(ccbfen2hexfen); 22 | PHP_FUNCTION(ccbhexfen2fen); 23 | 24 | PHP_FUNCTION(ccbrulecheck); 25 | PHP_FUNCTION(ccbruleischase); 26 | #endif 27 | -------------------------------------------------------------------------------- /extensions/PHP5/ccegtbprobe/GROUP.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/noobpwnftw/chessdb/0dbd2296097104694a0277027a45752a9f9a7999/extensions/PHP5/ccegtbprobe/GROUP.dat -------------------------------------------------------------------------------- /extensions/PHP5/ccegtbprobe/LZMA/Alloc.h: -------------------------------------------------------------------------------- 1 | /* Alloc.h -- Memory allocation functions 2 | 2021-07-13 : Igor Pavlov : Public domain */ 3 | 4 | #ifndef __COMMON_ALLOC_H 5 | #define __COMMON_ALLOC_H 6 | 7 | #include "7zTypes.h" 8 | 9 | EXTERN_C_BEGIN 10 | 11 | void *MyAlloc(size_t size); 12 | void MyFree(void *address); 13 | 14 | #ifdef _WIN32 15 | 16 | void SetLargePageSize(void); 17 | 18 | void *MidAlloc(size_t size); 19 | void MidFree(void *address); 20 | void *BigAlloc(size_t size); 21 | void BigFree(void *address); 22 | 23 | #else 24 | 25 | #define MidAlloc(size) MyAlloc(size) 26 | #define MidFree(address) MyFree(address) 27 | #define BigAlloc(size) MyAlloc(size) 28 | #define BigFree(address) MyFree(address) 29 | 30 | #endif 31 | 32 | extern const ISzAlloc g_Alloc; 33 | 34 | #ifdef _WIN32 35 | extern const ISzAlloc g_BigAlloc; 36 | extern const ISzAlloc g_MidAlloc; 37 | #else 38 | #define g_BigAlloc g_AlignedAlloc 39 | #define g_MidAlloc g_AlignedAlloc 40 | #endif 41 | 42 | extern const ISzAlloc g_AlignedAlloc; 43 | 44 | 45 | typedef struct 46 | { 47 | ISzAlloc vt; 48 | ISzAllocPtr baseAlloc; 49 | unsigned numAlignBits; /* ((1 << numAlignBits) >= sizeof(void *)) */ 50 | size_t offset; /* (offset == (k * sizeof(void *)) && offset < (1 << numAlignBits) */ 51 | } CAlignOffsetAlloc; 52 | 53 | void AlignOffsetAlloc_CreateVTable(CAlignOffsetAlloc *p); 54 | 55 | 56 | EXTERN_C_END 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /extensions/PHP5/ccegtbprobe/LZMA/Compiler.h: -------------------------------------------------------------------------------- 1 | /* Compiler.h 2 | 2021-01-05 : Igor Pavlov : Public domain */ 3 | 4 | #ifndef __7Z_COMPILER_H 5 | #define __7Z_COMPILER_H 6 | 7 | #ifdef __clang__ 8 | #pragma clang diagnostic ignored "-Wunused-private-field" 9 | #endif 10 | 11 | #ifdef _MSC_VER 12 | 13 | #ifdef UNDER_CE 14 | #define RPC_NO_WINDOWS_H 15 | /* #pragma warning(disable : 4115) // '_RPC_ASYNC_STATE' : named type definition in parentheses */ 16 | #pragma warning(disable : 4201) // nonstandard extension used : nameless struct/union 17 | #pragma warning(disable : 4214) // nonstandard extension used : bit field types other than int 18 | #endif 19 | 20 | #if _MSC_VER >= 1300 21 | #pragma warning(disable : 4996) // This function or variable may be unsafe 22 | #else 23 | #pragma warning(disable : 4511) // copy constructor could not be generated 24 | #pragma warning(disable : 4512) // assignment operator could not be generated 25 | #pragma warning(disable : 4514) // unreferenced inline function has been removed 26 | #pragma warning(disable : 4702) // unreachable code 27 | #pragma warning(disable : 4710) // not inlined 28 | #pragma warning(disable : 4714) // function marked as __forceinline not inlined 29 | #pragma warning(disable : 4786) // identifier was truncated to '255' characters in the debug information 30 | #endif 31 | 32 | #ifdef __clang__ 33 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 34 | #pragma clang diagnostic ignored "-Wmicrosoft-exception-spec" 35 | // #pragma clang diagnostic ignored "-Wreserved-id-macro" 36 | #endif 37 | 38 | #endif 39 | 40 | #define UNUSED_VAR(x) (void)x; 41 | /* #define UNUSED_VAR(x) x=x; */ 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /extensions/PHP5/ccegtbprobe/LZMA/LzHash.h: -------------------------------------------------------------------------------- 1 | /* LzHash.h -- HASH functions for LZ algorithms 2 | 2019-10-30 : Igor Pavlov : Public domain */ 3 | 4 | #ifndef __LZ_HASH_H 5 | #define __LZ_HASH_H 6 | 7 | /* 8 | (kHash2Size >= (1 << 8)) : Required 9 | (kHash3Size >= (1 << 16)) : Required 10 | */ 11 | 12 | #define kHash2Size (1 << 10) 13 | #define kHash3Size (1 << 16) 14 | // #define kHash4Size (1 << 20) 15 | 16 | #define kFix3HashSize (kHash2Size) 17 | #define kFix4HashSize (kHash2Size + kHash3Size) 18 | // #define kFix5HashSize (kHash2Size + kHash3Size + kHash4Size) 19 | 20 | /* 21 | We use up to 3 crc values for hash: 22 | crc0 23 | crc1 << Shift_1 24 | crc2 << Shift_2 25 | (Shift_1 = 5) and (Shift_2 = 10) is good tradeoff. 26 | Small values for Shift are not good for collision rate. 27 | Big value for Shift_2 increases the minimum size 28 | of hash table, that will be slow for small files. 29 | */ 30 | 31 | #define kLzHash_CrcShift_1 5 32 | #define kLzHash_CrcShift_2 10 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /extensions/PHP5/ccegtbprobe/LZMA/LzmaLib.c: -------------------------------------------------------------------------------- 1 | /* LzmaLib.c -- LZMA library wrapper 2 | 2015-06-13 : Igor Pavlov : Public domain */ 3 | 4 | #include "Alloc.h" 5 | #include "LzmaDec.h" 6 | #include "LzmaEnc.h" 7 | #include "LzmaLib.h" 8 | 9 | MY_STDAPI LzmaCompress(unsigned char *dest, size_t *destLen, const unsigned char *src, size_t srcLen, 10 | unsigned char *outProps, size_t *outPropsSize, 11 | int level, /* 0 <= level <= 9, default = 5 */ 12 | unsigned dictSize, /* use (1 << N) or (3 << N). 4 KB < dictSize <= 128 MB */ 13 | int lc, /* 0 <= lc <= 8, default = 3 */ 14 | int lp, /* 0 <= lp <= 4, default = 0 */ 15 | int pb, /* 0 <= pb <= 4, default = 2 */ 16 | int fb, /* 5 <= fb <= 273, default = 32 */ 17 | int numThreads /* 1 or 2, default = 2 */ 18 | ) 19 | { 20 | CLzmaEncProps props; 21 | LzmaEncProps_Init(&props); 22 | props.level = level; 23 | props.dictSize = dictSize; 24 | props.lc = lc; 25 | props.lp = lp; 26 | props.pb = pb; 27 | props.fb = fb; 28 | props.numThreads = numThreads; 29 | 30 | return LzmaEncode(dest, destLen, src, srcLen, &props, outProps, outPropsSize, 0, 31 | NULL, &g_Alloc, &g_Alloc); 32 | } 33 | 34 | 35 | MY_STDAPI LzmaUncompress(unsigned char *dest, size_t *destLen, const unsigned char *src, size_t *srcLen, 36 | const unsigned char *props, size_t propsSize) 37 | { 38 | ELzmaStatus status; 39 | return LzmaDecode(dest, destLen, src, srcLen, props, (unsigned)propsSize, LZMA_FINISH_ANY, &status, &g_Alloc); 40 | } 41 | -------------------------------------------------------------------------------- /extensions/PHP5/ccegtbprobe/LZMA/Precomp.h: -------------------------------------------------------------------------------- 1 | /* Precomp.h -- StdAfx 2 | 2013-11-12 : Igor Pavlov : Public domain */ 3 | 4 | #ifndef __7Z_PRECOMP_H 5 | #define __7Z_PRECOMP_H 6 | 7 | #include "Compiler.h" 8 | /* #include "7zTypes.h" */ 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /extensions/PHP5/ccegtbprobe/config.m4: -------------------------------------------------------------------------------- 1 | PHP_ARG_ENABLE(ccegtbprobe, whether to enable CCEGTBProbe, 2 | [ --enable-ccegtbprobe Enable CCEGTBProbe extension]) 3 | 4 | if test "$PHP_CCEGTBPROBE" != "no"; then 5 | AC_DEFINE(HAVE_CCEGTBPROBE,1,[ ]) 6 | PHP_REQUIRE_CXX() 7 | PHP_ADD_LIBRARY(stdc++, "", EXTRA_LDFLAGS) 8 | PHP_NEW_EXTENSION(ccegtbprobe, ccegtbprobe.cpp piece_set.cpp LZMA/Alloc.c LZMA/CpuArch.c LZMA/LzFind.c LZMA/LzmaDec.c LZMA/LzmaEnc.c LZMA/LzmaLib.c, $ext_shared) 9 | fi 10 | -------------------------------------------------------------------------------- /extensions/PHP5/ccegtbprobe/config.w32: -------------------------------------------------------------------------------- 1 | ARG_ENABLE("ccegtbprobe", "CCEGTBProbe Support", "no"); 2 | 3 | if (PHP_CCEGTBPROBE == "yes") { 4 | EXTENSION("ccegtbprobe", "ccegtbprobe.cpp piece_set.cpp LZMA/Alloc.c LZMA/CpuArch.c LZMA/LzFind.c LZMA/LzmaDec.c LZMA/LzmaEnc.c LZMA/LzmaLib.c"); 5 | AC_DEFINE('HAVE_CCEGTBPROBE', 1, 'Have CCEGTBProbe support', false); 6 | } 7 | -------------------------------------------------------------------------------- /extensions/PHP5/ccegtbprobe/php_ccegtbprobe.h: -------------------------------------------------------------------------------- 1 | #ifndef PHP_CCEGTBPROBE_H 2 | #define PHP_CCEGTBPROBE_H 3 | 4 | extern zend_module_entry ccegtbprobe_module_entry; 5 | #define phpext_ccegtbprobe_ptr &ccegtbprobe_module_entry 6 | 7 | PHP_MINIT_FUNCTION(ccegtbprobe); 8 | PHP_FUNCTION(ccegtbprobe); 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /extensions/PHP5/ccegtbprobe/piece_set.cpp: -------------------------------------------------------------------------------- 1 | #include "xiangqi.h" 2 | #include "piece_set.h" 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | using namespace std; 10 | 11 | const U8* Piece_Set_ID[16] = { 12 | NULL, NULL, Rook_Set_ID[White], Knight_Set_ID[White], Cannon_Set_ID[White], NULL, NULL, Pawn_Set_ID[White], 13 | NULL, NULL, Rook_Set_ID[Black], Knight_Set_ID[Black], Cannon_Set_ID[Black], NULL, NULL, Pawn_Set_ID[Black], 14 | }; 15 | 16 | S8 Piece_Sq_Index[1440]; 17 | Group_Info Group_Table[40]; 18 | 19 | void piece_index_init() 20 | { 21 | int ix, data; 22 | memset(Piece_Sq_Index, 0, sizeof(Piece_Sq_Index)); 23 | for (int piece = 1; piece < 16; ++piece) 24 | { 25 | if (piece == 8) 26 | continue; 27 | for (int sq = 0; sq < 90; ++sq) 28 | { 29 | ix = (sq << 4) + piece; 30 | switch (piece) 31 | { 32 | case WhitePawn: 33 | data = White_Pawn_Pos[sq]; 34 | break; 35 | case BlackPawn: 36 | data = White_Pawn_Pos[sq_rank_mirror(sq)]; 37 | break; 38 | case WhiteKing: 39 | data = White_King_Pos[sq]; 40 | break; 41 | case BlackKing: 42 | data = White_King_Pos[sq_rank_mirror(sq)]; 43 | break; 44 | case WhiteAdvisor: 45 | data = White_Advisor_Pos[sq]; 46 | break; 47 | case BlackAdvisor: 48 | data = White_Advisor_Pos[sq_rank_mirror(sq)]; 49 | break; 50 | case WhiteBishop: 51 | data = White_Bishop_Pos[sq]; 52 | break; 53 | case BlackBishop: 54 | data = White_Bishop_Pos[sq_rank_mirror(sq)]; 55 | break; 56 | default: 57 | data = sq; 58 | } 59 | Piece_Sq_Index[ix] = data; 60 | } 61 | } 62 | } 63 | 64 | bool group_init() 65 | { 66 | int fd = open("/home/apache/GROUP.dat", O_RDONLY); 67 | if (fd == -1) 68 | { 69 | return false; 70 | } 71 | for(int i = 0; i < 40; ++i) 72 | { 73 | read(fd, &Group_Table[i], 28); 74 | if (Group_Table[i].piece_cnt) 75 | { 76 | Group_Table[i].index_tb = new uint32[Group_Table[i].index_size]; 77 | read(fd, Group_Table[i].index_tb, Group_Table[i].index_size * sizeof(uint32)); 78 | } 79 | } 80 | close(fd); 81 | return true; 82 | } 83 | -------------------------------------------------------------------------------- /extensions/PHP5/ccegtbprobe/piece_set.h: -------------------------------------------------------------------------------- 1 | #ifndef _PIECE_SET_H_ 2 | #define _PIECE_SET_H_ 3 | 4 | #include 5 | #include 6 | 7 | enum { 8 | W_K = 1, W_KA, W_KB, W_KAA, W_KAB, W_KBB, W_KAAB, W_KABB, W_KAABB, W_R, W_N, W_C, W_P, W_RR, W_NN, W_CC, W_PP, W_PPP, W_PPPP, 9 | B_K = 21, B_KA, B_KB, B_KAA, B_KAB, B_KBB, B_KAAB, B_KABB, B_KAABB, B_R, B_N, B_C, B_P, B_RR, B_NN, B_CC, B_PP, B_PPP, B_PPPP, 10 | }; 11 | enum{ 12 | WSet_Defend, WSet_Rook, WSet_Knight, WSet_Cannon, WSet_Pawn, 13 | BSet_Defend, BSet_Rook, BSet_Knight, BSet_Cannon, BSet_Pawn, 14 | }; 15 | const U8 Defend_Set_ID[2][3][3] = { 16 | {W_K, W_KB, W_KBB, 17 | W_KA, W_KAB, W_KABB, 18 | W_KAA, W_KAAB, W_KAABB}, 19 | {B_K, B_KB, B_KBB, 20 | B_KA, B_KAB, B_KABB, 21 | B_KAA, B_KAAB, B_KAABB}, 22 | }; 23 | const U8 Rook_Set_ID[2][3] = {{0, W_R, W_RR},{0, B_R, B_RR}}; 24 | const U8 Knight_Set_ID[2][3] = {{0, W_N, W_NN},{0, B_N, B_NN}}; 25 | const U8 Cannon_Set_ID[2][3] = {{0, W_C, W_CC},{0, B_C, B_CC}}; 26 | const U8 Pawn_Set_ID[2][4] = {{0, W_P, W_PP, W_PPP},{0, B_P, B_PP, B_PPP}}; 27 | extern const U8* Piece_Set_ID[16]; 28 | 29 | const int Piece_Order_Value[16] = { 30 | 0, 0, 4000, 600, 603, 11, 10, 80, 31 | 0, 0, 4000, 600, 603, 11, 10, 80, 32 | }; 33 | extern S8 Piece_Sq_Index[1440]; 34 | 35 | inline int piece_index(int piece, int sq) 36 | { 37 | return Piece_Sq_Index[(sq << 4) + piece]; 38 | } 39 | inline int defend_set(int a_nb, int b_nb, int color) 40 | { 41 | return Defend_Set_ID[color][a_nb][b_nb]; 42 | } 43 | inline int piece_set(int piece, int number) 44 | { 45 | return Piece_Set_ID[piece][number]; 46 | } 47 | #pragma pack(push, 4) 48 | struct Group_Info 49 | { 50 | S8 info_id; 51 | S8 piece_cnt; 52 | S8 pieces[6]; 53 | uint16 table_size; 54 | uint16 compress_size; 55 | uint16 weight[6]; 56 | uint32 index_size; 57 | uint32 * index_tb; 58 | 59 | Group_Info() 60 | { 61 | memset(this, 0, sizeof(*this)); 62 | } 63 | ~Group_Info() 64 | { 65 | if (piece_cnt) 66 | { 67 | delete[] index_tb; 68 | } 69 | } 70 | 71 | uint32 get_list_pos(const S8* sq_list)const 72 | { 73 | int index = 0; 74 | for (int i = 0; i < piece_cnt; ++i) 75 | { 76 | index += weight[i] * piece_index(pieces[i], sq_list[i]); 77 | } 78 | return index_tb[index]; 79 | } 80 | }; 81 | #pragma pack(pop) 82 | 83 | extern Group_Info Group_Table[40]; 84 | inline const Group_Info* get_set_info(int set_id) 85 | { 86 | return &Group_Table[set_id]; 87 | } 88 | 89 | extern void piece_index_init(); 90 | extern bool group_init(); 91 | 92 | #endif 93 | -------------------------------------------------------------------------------- /extensions/PHP5/xxhash/.gitignore: -------------------------------------------------------------------------------- 1 | .deps 2 | .libs 3 | Makefile 4 | Makefile.fragments 5 | Makefile.global 6 | Makefile.objects 7 | acinclude.m4 8 | aclocal.m4 9 | autom4te.cache 10 | build 11 | config.guess 12 | config.h 13 | config.h.in* 14 | config.log 15 | config.nice 16 | config.status 17 | config.sub 18 | configure 19 | configure.in 20 | *.la 21 | *.lo 22 | install-sh 23 | libtool 24 | ltmain.sh 25 | missing 26 | mkinstalldirs 27 | modules 28 | run-tests.php -------------------------------------------------------------------------------- /extensions/PHP5/xxhash/README.md: -------------------------------------------------------------------------------- 1 | # php-xxhash 2 | 3 | PHP extension to add support for the [xxhash - r42](https://github.com/Cyan4973/xxHash) extremely fast hashing algorithm. _xxhash_ is designed to be fast enough to use in real-time streaming applications. 4 | 5 | 6 | ## How To Install 7 | 8 | ``` 9 | phpize 10 | ./configure --enable-xxhash 11 | make 12 | sudo make install 13 | ``` 14 | 15 | ## How To Use 16 | 17 | This extension adds three new PHP functions: 18 | 19 | ``` 20 | // 32 bit version (all values are positive) 21 | int xxhash32(string $data); 22 | 23 | // 64 bit version (can return negative values since PHP doesn't support unsigned long values) 24 | long xxhash64(string $data); 25 | 26 | // 64 bit version (all values are positive but returned as strings) 27 | string xxhash64Unsigned(string $data); 28 | ``` 29 | 30 | They will checksum the string, and return the checksum. 31 | 32 | ## License 33 | 34 | BSD 2-clause license. -------------------------------------------------------------------------------- /extensions/PHP5/xxhash/config.m4: -------------------------------------------------------------------------------- 1 | dnl $Id$ 2 | dnl config.m4 for extension xxhash 3 | 4 | dnl Comments in this file start with the string 'dnl'. 5 | dnl Remove where necessary. This file will not work 6 | dnl without editing. 7 | 8 | dnl If your extension references something external, use with: 9 | 10 | dnl PHP_ARG_WITH(xxhash, for xxhash support, 11 | dnl Make sure that the comment is aligned: 12 | dnl [ --with-xxhash Include xxhash support]) 13 | 14 | dnl Otherwise use enable: 15 | 16 | PHP_ARG_ENABLE(xxhash, whether to enable xxhash support, 17 | dnl Make sure that the comment is aligned: 18 | [ --enable-xxhash Enable xxhash support]) 19 | 20 | if test "$PHP_XXHASH" != "no"; then 21 | dnl Write more examples of tests here... 22 | 23 | PHP_NEW_EXTENSION(xxhash, php_xxhash.c, $ext_shared) 24 | fi 25 | -------------------------------------------------------------------------------- /extensions/PHP5/xxhash/config.w32: -------------------------------------------------------------------------------- 1 | // $Id$ 2 | // vim:ft=javascript 3 | 4 | // If your extension references something external, use ARG_WITH 5 | // ARG_WITH("xxhash", "for xxhash support", "no"); 6 | 7 | // Otherwise, use ARG_ENABLE 8 | // ARG_ENABLE("xxhash", "enable xxhash support", "no"); 9 | 10 | if (PHP_XXHASH != "no") { 11 | EXTENSION("xxhash", "php_xxhash.c"); 12 | } 13 | 14 | -------------------------------------------------------------------------------- /extensions/PHP5/xxhash/php_xxhash.h: -------------------------------------------------------------------------------- 1 | #ifndef PHP_XXHASH_H 2 | #define PHP_XXHASH_H 3 | 4 | #define PHP_XXHASH_VERSION "1.0.1" 5 | 6 | extern zend_module_entry xxhash_module_entry; 7 | #define phpext_xxhash_ptr &xxhash_module_entry 8 | 9 | #if defined(PHP_WIN32) && defined(XXHASH_EXPORTS) 10 | #define PHP_XXHASH_API __declspec(dllexport) 11 | #else 12 | #define PHP_XXHASH_API PHPAPI 13 | #endif 14 | 15 | #ifdef ZTS 16 | #include "TSRM.h" 17 | #endif 18 | 19 | PHP_MINIT_FUNCTION(xxhash); 20 | PHP_MSHUTDOWN_FUNCTION(xxhash); 21 | PHP_RINIT_FUNCTION(xxhash); 22 | PHP_RSHUTDOWN_FUNCTION(xxhash); 23 | PHP_MINFO_FUNCTION(xxhash); 24 | 25 | PHP_FUNCTION(xxhash32); 26 | PHP_FUNCTION(xxhash64); 27 | PHP_FUNCTION(xxhash64Unsigned); 28 | 29 | #endif /* PHP_XXHASH_H */ 30 | 31 | -------------------------------------------------------------------------------- /extensions/PHP7/README.txt: -------------------------------------------------------------------------------- 1 | Note that the legacy mongo driver (https://www.php.net/manual/en/book.mongo.php) is discontinued and not available in PHP7. 2 | It is only used for task queue operations, someone needs to port the related code to use the new driver if needed. -------------------------------------------------------------------------------- /extensions/PHP7/cboard/calloc.c: -------------------------------------------------------------------------------- 1 | #include "calloc.h" 2 | 3 | #include 4 | 5 | static int alloc_count = 0; 6 | 7 | void* chess_alloc(size_t size) 8 | { 9 | alloc_count++; 10 | return malloc(size); 11 | } 12 | 13 | void* chess_realloc(void* ptr, size_t size) 14 | { 15 | return realloc(ptr, size); 16 | } 17 | 18 | void chess_free(void* ptr) 19 | { 20 | alloc_count--; 21 | free(ptr); 22 | } 23 | 24 | int chess_alloc_count(void) 25 | { 26 | return alloc_count; 27 | } 28 | -------------------------------------------------------------------------------- /extensions/PHP7/cboard/calloc.h: -------------------------------------------------------------------------------- 1 | #ifndef CHESSLIB_ALLOC_H_ 2 | #define CHESSLIB_ALLOC_H_ 3 | 4 | #include 5 | 6 | void* chess_alloc(size_t size); 7 | void* chess_realloc(void* ptr, size_t size); 8 | void chess_free(void* ptr); 9 | 10 | int chess_alloc_count(void); 11 | 12 | #endif /* CHESSLIB_ALLOC_H_ */ 13 | -------------------------------------------------------------------------------- /extensions/PHP7/cboard/carray.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "carray.h" 6 | #include "calloc.h" 7 | 8 | void chess_array_init(ChessArray* array, size_t elem_size) 9 | { 10 | array->elem_size = elem_size; 11 | array->size = 0; 12 | array->max_size = 0; 13 | } 14 | 15 | void chess_array_cleanup(ChessArray* array) 16 | { 17 | if (array->max_size > 0) 18 | chess_free(array->data); 19 | } 20 | 21 | size_t chess_array_size(const ChessArray* array) 22 | { 23 | return array->size; 24 | } 25 | 26 | const void* chess_array_data(const ChessArray* array) 27 | { 28 | assert(array->size > 0); 29 | return array->data; 30 | } 31 | 32 | const void* chess_array_elem(const ChessArray* array, size_t index) 33 | { 34 | assert(index < array->size); 35 | return (const char*)array->data + (index * array->elem_size); 36 | } 37 | 38 | void chess_array_clear(ChessArray* array) 39 | { 40 | if (array->max_size > 0) 41 | { 42 | chess_free(array->data); 43 | array->size = 0; 44 | array->max_size = 0; 45 | } 46 | } 47 | 48 | void chess_array_set_elem(ChessArray* array, size_t index, const void* value) 49 | { 50 | void* dest; 51 | assert(index < array->size); 52 | dest = (char*)array->data + (index * array->elem_size); 53 | memcpy(dest, value, array->elem_size); 54 | } 55 | 56 | static void expand(ChessArray* array) 57 | { 58 | size_t new_size = array->max_size ? array->max_size * 2 : 8; 59 | if (array->max_size > 0) 60 | array->data = chess_realloc(array->data, new_size * array->elem_size); 61 | else 62 | array->data = chess_alloc(new_size * array->elem_size); 63 | array->max_size = new_size; 64 | } 65 | 66 | void chess_array_push(ChessArray* array, const void* elem) 67 | { 68 | if (array->size == array->max_size) 69 | { 70 | expand(array); 71 | } 72 | assert(array->size < array->max_size); 73 | chess_array_set_elem(array, array->size++, elem); 74 | } 75 | 76 | void chess_array_pop(ChessArray* array, void* elem) 77 | { 78 | assert(array->size > 0); 79 | if (elem) 80 | { 81 | size_t index = array->size - 1; 82 | void* src = (char*)array->data + (index * array->elem_size); 83 | memcpy(elem, src, array->elem_size); 84 | } 85 | array->size--; 86 | } 87 | 88 | void chess_array_prune(ChessArray* array, size_t size) 89 | { 90 | assert(size <= array->size); 91 | array->size = size; 92 | } 93 | -------------------------------------------------------------------------------- /extensions/PHP7/cboard/carray.h: -------------------------------------------------------------------------------- 1 | #ifndef CHESSLIB_ARRAY_H_ 2 | #define CHESSLIB_ARRAY_H_ 3 | 4 | typedef struct ChessArray 5 | { 6 | size_t elem_size; 7 | size_t size; 8 | size_t max_size; 9 | void* data; 10 | } ChessArray; 11 | 12 | void chess_array_init(ChessArray*, size_t elem_size); 13 | void chess_array_cleanup(ChessArray*); 14 | 15 | size_t chess_array_size(const ChessArray*); 16 | const void* chess_array_data(const ChessArray*); 17 | const void* chess_array_elem(const ChessArray*, size_t index); 18 | 19 | void chess_array_clear(ChessArray*); 20 | void chess_array_set_elem(ChessArray*, size_t index, const void* elem); 21 | void chess_array_push(ChessArray*, const void* elem); 22 | void chess_array_pop(ChessArray*, void* elem); 23 | void chess_array_prune(ChessArray*, size_t size); 24 | 25 | #endif /* CHESSLIB_ARRAY_H_ */ 26 | -------------------------------------------------------------------------------- /extensions/PHP7/cboard/chess.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "chess.h" 6 | 7 | static const char piece_chars[] = "PpNnBbRrQqKk"; 8 | static const char rank_chars[] = "12345678"; 9 | static const char file_chars[] = "abcdefgh"; 10 | 11 | ChessColor chess_color_other(ChessColor color) 12 | { 13 | assert(color == CHESS_COLOR_WHITE || color == CHESS_COLOR_BLACK); 14 | return (color == CHESS_COLOR_WHITE) ? CHESS_COLOR_BLACK : CHESS_COLOR_WHITE; 15 | } 16 | 17 | ChessColor chess_piece_color(ChessPiece piece) 18 | { 19 | assert(piece >= CHESS_PIECE_WHITE_PAWN && piece <= CHESS_PIECE_BLACK_KING); 20 | return (piece % 2); 21 | } 22 | 23 | ChessPiece chess_piece_of_color(ChessPiece piece, ChessColor color) 24 | { 25 | assert(piece >= CHESS_PIECE_WHITE_PAWN && piece <= CHESS_PIECE_BLACK_KING); 26 | return (piece & ~1) + color; 27 | } 28 | 29 | char chess_piece_to_char(ChessPiece piece) 30 | { 31 | assert(piece >= CHESS_PIECE_WHITE_PAWN && piece <= CHESS_PIECE_BLACK_KING); 32 | return piece_chars[piece - CHESS_PIECE_WHITE_PAWN]; 33 | } 34 | 35 | ChessPiece chess_piece_from_char(char c) 36 | { 37 | char* s = strchr(piece_chars, c); 38 | return (s && *s) ? CHESS_PIECE_WHITE_PAWN + (s - piece_chars) : CHESS_PIECE_NONE; 39 | } 40 | 41 | ChessSquare chess_square_from_fr(ChessFile file, ChessRank rank) 42 | { 43 | assert(file >= CHESS_FILE_A && file <= CHESS_FILE_H); 44 | assert(rank >= CHESS_RANK_1 && rank <= CHESS_RANK_8); 45 | return rank * 8 + file; 46 | } 47 | 48 | ChessFile chess_square_file(ChessSquare square) 49 | { 50 | return (square % 8); 51 | } 52 | 53 | ChessRank chess_square_rank(ChessSquare square) 54 | { 55 | return (square / 8); 56 | } 57 | 58 | ChessFile chess_file_from_char(char c) 59 | { 60 | char *s = strchr(file_chars, c); 61 | return (s && *s) ? s - file_chars : CHESS_FILE_INVALID; 62 | } 63 | 64 | ChessRank chess_rank_from_char(char c) 65 | { 66 | char *s = strchr(rank_chars, c); 67 | return (s && *s) ? s - rank_chars : CHESS_RANK_INVALID; 68 | } 69 | 70 | char chess_file_to_char(ChessFile file) 71 | { 72 | assert(file >= CHESS_FILE_A && file <= CHESS_FILE_H); 73 | return file_chars[file]; 74 | } 75 | 76 | char chess_rank_to_char(ChessRank rank) 77 | { 78 | assert(rank >= CHESS_RANK_1 && rank <= CHESS_RANK_8); 79 | return rank_chars[rank]; 80 | } 81 | -------------------------------------------------------------------------------- /extensions/PHP7/cboard/config.m4: -------------------------------------------------------------------------------- 1 | PHP_ARG_ENABLE(cboard, whether to enable CBoard, 2 | [ --enable-cboard Enable CBoard extension]) 3 | 4 | if test "$PHP_CBOARD" != "no"; then 5 | AC_DEFINE(HAVE_CBOARD,1,[ ]) 6 | PHP_REQUIRE_CXX() 7 | PHP_ADD_LIBRARY(stdc++, "", EXTRA_LDFLAGS) 8 | PHP_NEW_EXTENSION(cboard, cboard.cpp calloc.c carray.c chess.c fen.c generate.c move.c parse.c position.c print.c unmove.c, $ext_shared) 9 | fi 10 | -------------------------------------------------------------------------------- /extensions/PHP7/cboard/config.w32: -------------------------------------------------------------------------------- 1 | ARG_ENABLE("cboard", "CBoard Support", "no"); 2 | 3 | if (PHP_CBOARD == "yes") { 4 | EXTENSION("cboard", "cboard.cpp calloc.c carray.c chess.c fen.c generate.c move.c parse.c position.c print.c unmove.c"); 5 | AC_DEFINE('HAVE_CBOARD', 1, 'Have CBoard support', false); 6 | } 7 | -------------------------------------------------------------------------------- /extensions/PHP7/cboard/fen.h: -------------------------------------------------------------------------------- 1 | #ifndef CHESSLIB_FEN_H_ 2 | #define CHESSLIB_FEN_H_ 3 | 4 | #include "chess.h" 5 | #include "position.h" 6 | 7 | /* Longest possible FEN string is about 102 characters */ 8 | #define CHESS_FEN_MAX_LENGTH 128 9 | 10 | extern const char* const CHESS_FEN_STARTING_POSITION; 11 | 12 | ChessBoolean chess_fen_load(const char* s, ChessPosition*); 13 | int chess_fen_save(const ChessPosition*, char* s); 14 | 15 | #endif /* CHESSLIB_FEN_H_ */ 16 | -------------------------------------------------------------------------------- /extensions/PHP7/cboard/generate.h: -------------------------------------------------------------------------------- 1 | #ifndef CHESSLIB_GENERATE_H_ 2 | #define CHESSLIB_GENERATE_H_ 3 | 4 | #include 5 | #include "chess.h" 6 | #include "position.h" 7 | #include "carray.h" 8 | 9 | typedef struct 10 | { 11 | const ChessPosition* position; 12 | ChessSquare sq; 13 | ChessSquare to; 14 | int d; 15 | ChessMovePromote promote; 16 | ChessCastleState castle; 17 | bool is_ep; 18 | } ChessMoveGenerator; 19 | 20 | void chess_generate_init(void); 21 | 22 | void chess_move_generator_init(ChessMoveGenerator*, const ChessPosition*); 23 | ChessMove chess_move_generator_next(ChessMoveGenerator*); 24 | 25 | void chess_generate_moves(const ChessPosition*, ChessArray*); 26 | ChessBoolean chess_generate_is_square_attacked(const ChessPosition*, ChessSquare, ChessColor); 27 | ChessBoolean chess_generate_check_impossible(const ChessPosition*, ChessSquare, ChessColor); 28 | bool chess_has_legal_ep(const ChessPosition* position); 29 | 30 | #endif /* CHESSLIB_GENERATE_H_ */ 31 | -------------------------------------------------------------------------------- /extensions/PHP7/cboard/move.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "chess.h" 5 | #include "move.h" 6 | 7 | static const char promote_chars[] = "qrbn"; 8 | 9 | ChessMove CHESS_MOVE_NULL = 0x80000000; 10 | 11 | ChessMovePromote chess_move_promote_from_char(char c) 12 | { 13 | char* s = strchr(promote_chars, c); 14 | return (s && *s) ? CHESS_MOVE_PROMOTE_QUEEN + (s - promote_chars) : CHESS_MOVE_PROMOTE_NONE; 15 | } 16 | 17 | char chess_move_promote_to_char(ChessMovePromote promote) 18 | { 19 | assert(promote >= CHESS_MOVE_PROMOTE_QUEEN && promote <= CHESS_MOVE_PROMOTE_KNIGHT); 20 | return promote_chars[promote - CHESS_MOVE_PROMOTE_QUEEN]; 21 | } 22 | 23 | ChessSquare chess_move_from(ChessMove move) 24 | { 25 | return move & 077; 26 | } 27 | 28 | ChessSquare chess_move_to(ChessMove move) 29 | { 30 | return (move >> 6) & 077; 31 | } 32 | 33 | ChessMovePromote chess_move_promotes(ChessMove move) 34 | { 35 | return (move >> 12) & 017; 36 | } 37 | 38 | ChessMove chess_move_make(ChessSquare from, ChessSquare to) 39 | { 40 | return from | (to << 6); 41 | } 42 | 43 | ChessMove chess_move_make_promote(ChessSquare from, ChessSquare to, ChessMovePromote promote) 44 | { 45 | return from | (to << 6) | (promote << 12); 46 | } 47 | -------------------------------------------------------------------------------- /extensions/PHP7/cboard/move.h: -------------------------------------------------------------------------------- 1 | #ifndef CHESSLIB_MOVE_H_ 2 | #define CHESSLIB_MOVE_H_ 3 | 4 | #include "chess.h" 5 | 6 | typedef int ChessMove; 7 | 8 | typedef enum 9 | { 10 | CHESS_MOVE_PROMOTE_NONE = 0, 11 | CHESS_MOVE_PROMOTE_QUEEN = 1, 12 | CHESS_MOVE_PROMOTE_ROOK = 2, 13 | CHESS_MOVE_PROMOTE_BISHOP = 3, 14 | CHESS_MOVE_PROMOTE_KNIGHT = 4 15 | } ChessMovePromote; 16 | 17 | extern ChessMove CHESS_MOVE_NULL; 18 | 19 | ChessMovePromote chess_move_promote_from_char(char); 20 | char chess_move_promote_to_char(ChessMovePromote); 21 | 22 | ChessSquare chess_move_from(ChessMove); 23 | ChessSquare chess_move_to(ChessMove); 24 | ChessMovePromote chess_move_promotes(ChessMove); 25 | 26 | ChessMove chess_move_make(ChessSquare from, ChessSquare to); 27 | ChessMove chess_move_make_promote(ChessSquare from, ChessSquare to, ChessMovePromote); 28 | 29 | #endif /* CHESSLIB_MOVE_H_ */ 30 | -------------------------------------------------------------------------------- /extensions/PHP7/cboard/parse.h: -------------------------------------------------------------------------------- 1 | #ifndef CHESSLIB_PARSE_H_ 2 | #define CHESSLIB_PARSE_H_ 3 | 4 | #include "move.h" 5 | #include "position.h" 6 | 7 | typedef enum { 8 | CHESS_PARSE_MOVE_OK = 0, 9 | CHESS_PARSE_MOVE_ERROR, 10 | CHESS_PARSE_MOVE_ILLEGAL, 11 | CHESS_PARSE_MOVE_AMBIGUOUS 12 | } ChessParseMoveResult; 13 | 14 | ChessParseMoveResult chess_parse_move(const char* s, const ChessPosition*, ChessMove*); 15 | 16 | #endif /* CHESSLIB_PARSE_H_ */ 17 | -------------------------------------------------------------------------------- /extensions/PHP7/cboard/php_cboard.h: -------------------------------------------------------------------------------- 1 | #ifndef PHP_CBOARD_H 2 | #define PHP_CBOARD_H 3 | 4 | extern zend_module_entry cboard_module_entry; 5 | #define phpext_cboard_ptr &cboard_module_entry 6 | 7 | PHP_MINIT_FUNCTION(cboard); 8 | PHP_FUNCTION(cbgetfen); 9 | PHP_FUNCTION(cbmovegen); 10 | PHP_FUNCTION(cbmovemake); 11 | PHP_FUNCTION(cbmovesan); 12 | PHP_FUNCTION(cbincheck); 13 | 14 | PHP_FUNCTION(cbgetBWfen); 15 | PHP_FUNCTION(cbgetBWmove); 16 | 17 | PHP_FUNCTION(cbfen2hexfen); 18 | PHP_FUNCTION(cbhexfen2fen); 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /extensions/PHP7/cboard/position.h: -------------------------------------------------------------------------------- 1 | #ifndef CHESSLIB_POSITION_H_ 2 | #define CHESSLIB_POSITION_H_ 3 | 4 | #include "chess.h" 5 | #include "move.h" 6 | #include "unmove.h" 7 | 8 | typedef struct 9 | { 10 | /* Variables that store the current state of the board. */ 11 | ChessPiece piece[64]; 12 | ChessColor to_move; 13 | ChessCastleState castle; 14 | ChessFile ep; 15 | int fifty; 16 | int move_num; 17 | /* The remaining members are private and should not be used. */ 18 | ChessSquare wking, bking; 19 | } ChessPosition; 20 | 21 | void chess_position_copy(const ChessPosition* from, ChessPosition* to); 22 | 23 | /* Validates the given position by checking some simple invariants, and if 24 | * valid, sets up any extra internal state. This method MUST be called after 25 | * setting up a new position. If position is invalid, returns CHESS_FALSE. 26 | * 27 | * The following invariants are checked: 28 | * 1. Both sides have one king each. 29 | * 2. There are no pawns on the first or last rank. 30 | * 3. The opponent's king can not immediately be captured. 31 | * 32 | * In addition, any castle or en-passant states are cleared if they are 33 | * impossible (e.g. if the king is not on its starting square). 34 | */ 35 | ChessBoolean chess_position_validate(ChessPosition*); 36 | 37 | ChessBoolean chess_position_is_check(const ChessPosition*); 38 | ChessBoolean chess_position_move_is_legal(const ChessPosition*, ChessMove); 39 | ChessBoolean chess_position_move_is_capture(const ChessPosition*, ChessMove); 40 | ChessResult chess_position_check_result(const ChessPosition*); 41 | 42 | ChessUnmove chess_position_make_move(ChessPosition*, ChessMove); 43 | void chess_position_undo_move(ChessPosition*, ChessUnmove); 44 | 45 | #endif /* CHESSLIB_POSITION_H_ */ 46 | -------------------------------------------------------------------------------- /extensions/PHP7/cboard/print.h: -------------------------------------------------------------------------------- 1 | #ifndef CHESSLIB_PRINT_H_ 2 | #define CHESSLIB_PRINT_H_ 3 | 4 | #include "move.h" 5 | #include "position.h" 6 | 7 | int chess_print_move(ChessMove, char* s); 8 | int chess_print_move_san(ChessMove, const ChessPosition*, char* s); 9 | int chess_print_position(const ChessPosition*, char* s); 10 | int chess_print_result(ChessResult, char* s); 11 | 12 | #endif /* CHESSLIB_PRINT_H_ */ 13 | -------------------------------------------------------------------------------- /extensions/PHP7/cboard/unmove.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "unmove.h" 4 | 5 | ChessUnmove chess_unmove_make( 6 | ChessSquare from, ChessSquare to, ChessUnmoveCaptured captured, 7 | ChessBoolean promotion, ChessUnmoveEp ep, 8 | ChessCastleState castle, int fifty) 9 | { 10 | /* When capturing ep, captured piece must be NONE */ 11 | assert(ep != CHESS_UNMOVE_EP_CAPTURE || captured == CHESS_UNMOVE_CAPTURED_NONE); 12 | assert(ep >= CHESS_UNMOVE_EP_NONE); 13 | assert((int)ep <= CHESS_UNMOVE_EP_AVAILABLE + CHESS_FILE_H); 14 | 15 | return from /* 6 bits */ 16 | | (to << 6) /* 6 bits */ 17 | | (captured << 12) /* 3 bits */ 18 | | (promotion << 15) /* 1 bit */ 19 | | (ep << 16) /* 4 bits */ 20 | | (castle << 20) /* 4 bits */ 21 | | (fifty << 24); /* remaining 8 bits */ 22 | } 23 | 24 | ChessSquare chess_unmove_from(ChessUnmove unmove) 25 | { 26 | return unmove & 077; 27 | } 28 | 29 | ChessSquare chess_unmove_to(ChessUnmove unmove) 30 | { 31 | return (unmove >> 6) & 077; 32 | } 33 | 34 | ChessUnmoveCaptured chess_unmove_captured(ChessUnmove unmove) 35 | { 36 | return (unmove >> 12) & 07; 37 | } 38 | 39 | ChessBoolean chess_unmove_promotion(ChessUnmove unmove) 40 | { 41 | return (unmove >> 15) & 1; 42 | } 43 | 44 | ChessUnmoveEp chess_unmove_ep(ChessUnmove unmove) 45 | { 46 | return (unmove >> 16) & 0xf; 47 | } 48 | 49 | ChessCastleState chess_unmove_castle(ChessUnmove unmove) 50 | { 51 | return (unmove >> 20) & 0xf; 52 | } 53 | 54 | int chess_unmove_fifty(ChessUnmove unmove) 55 | { 56 | return (unmove >> 24); 57 | } 58 | -------------------------------------------------------------------------------- /extensions/PHP7/cboard/unmove.h: -------------------------------------------------------------------------------- 1 | #ifndef CHESSLIB_UNMOVE_H_ 2 | #define CHESSLIB_UNMOVE_H_ 3 | 4 | #include "chess.h" 5 | 6 | typedef unsigned int ChessUnmove; 7 | 8 | typedef enum 9 | { 10 | CHESS_UNMOVE_CAPTURED_NONE = 0, 11 | CHESS_UNMOVE_CAPTURED_PAWN = 1, 12 | CHESS_UNMOVE_CAPTURED_KNIGHT = 2, 13 | CHESS_UNMOVE_CAPTURED_BISHOP = 3, 14 | CHESS_UNMOVE_CAPTURED_ROOK = 4, 15 | CHESS_UNMOVE_CAPTURED_QUEEN = 5 16 | } ChessUnmoveCaptured; 17 | 18 | typedef enum 19 | { 20 | CHESS_UNMOVE_EP_NONE = 0, 21 | CHESS_UNMOVE_EP_CAPTURE = 1, 22 | CHESS_UNMOVE_EP_AVAILABLE = 2 23 | /* values 2->9 correspond to the file if you subtract 2 */ 24 | } ChessUnmoveEp; 25 | 26 | /* Constructor */ 27 | ChessUnmove chess_unmove_make( 28 | ChessSquare from, ChessSquare to, ChessUnmoveCaptured captured, 29 | ChessBoolean promotion, ChessUnmoveEp ep, 30 | ChessCastleState castle, int fifty); 31 | 32 | /* Accessors */ 33 | ChessSquare chess_unmove_from(ChessUnmove); 34 | ChessSquare chess_unmove_to(ChessUnmove); 35 | ChessUnmoveCaptured chess_unmove_captured(ChessUnmove); 36 | ChessBoolean chess_unmove_promotion(ChessUnmove); 37 | ChessUnmoveEp chess_unmove_ep(ChessUnmove); 38 | ChessCastleState chess_unmove_castle(ChessUnmove); 39 | int chess_unmove_fifty(ChessUnmove); 40 | 41 | #endif /* CHESSLIB_UNMOVE_H_ */ 42 | -------------------------------------------------------------------------------- /extensions/PHP7/ccboard/config.m4: -------------------------------------------------------------------------------- 1 | PHP_ARG_ENABLE(ccboard, whether to enable CCBoard, 2 | [ --enable-ccboard Enable CCBoard extension]) 3 | 4 | if test "$PHP_CCBOARD" != "no"; then 5 | AC_DEFINE(HAVE_CCBOARD,1,[ ]) 6 | PHP_REQUIRE_CXX() 7 | PHP_ADD_LIBRARY(stdc++, "", EXTRA_LDFLAGS) 8 | PHP_NEW_EXTENSION(ccboard, ccboard.cpp xiangqi.cpp, $ext_shared) 9 | fi 10 | -------------------------------------------------------------------------------- /extensions/PHP7/ccboard/config.w32: -------------------------------------------------------------------------------- 1 | ARG_ENABLE("ccboard", "CCBoard Support", "no"); 2 | 3 | if (PHP_CCBOARD == "yes") { 4 | EXTENSION("ccboard", "ccboard.cpp xiangqi.cpp"); 5 | AC_DEFINE('HAVE_CCBOARD', 1, 'Have CCBoard support', false); 6 | } 7 | -------------------------------------------------------------------------------- /extensions/PHP7/ccboard/php_ccboard.h: -------------------------------------------------------------------------------- 1 | #ifndef PHP_CCBOARD_H 2 | #define PHP_CCBOARD_H 3 | 4 | extern zend_module_entry ccboard_module_entry; 5 | #define phpext_ccboard_ptr &ccboard_module_entry 6 | 7 | PHP_MINIT_FUNCTION(ccboard); 8 | PHP_FUNCTION(ccbgetfen); 9 | PHP_FUNCTION(ccbmovegen); 10 | PHP_FUNCTION(ccbmovemake); 11 | PHP_FUNCTION(ccbincheck); 12 | 13 | PHP_FUNCTION(ccbgetLRfen); 14 | PHP_FUNCTION(ccbgetBWfen); 15 | PHP_FUNCTION(ccbgetLRBWfen); 16 | 17 | PHP_FUNCTION(ccbgetLRmove); 18 | PHP_FUNCTION(ccbgetBWmove); 19 | PHP_FUNCTION(ccbgetLRBWmove); 20 | 21 | PHP_FUNCTION(ccbfen2hexfen); 22 | PHP_FUNCTION(ccbhexfen2fen); 23 | 24 | PHP_FUNCTION(ccbrulecheck); 25 | PHP_FUNCTION(ccbruleischase); 26 | #endif 27 | -------------------------------------------------------------------------------- /extensions/PHP7/ccegtbprobe/GROUP.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/noobpwnftw/chessdb/0dbd2296097104694a0277027a45752a9f9a7999/extensions/PHP7/ccegtbprobe/GROUP.dat -------------------------------------------------------------------------------- /extensions/PHP7/ccegtbprobe/LZMA/Alloc.h: -------------------------------------------------------------------------------- 1 | /* Alloc.h -- Memory allocation functions 2 | 2021-07-13 : Igor Pavlov : Public domain */ 3 | 4 | #ifndef __COMMON_ALLOC_H 5 | #define __COMMON_ALLOC_H 6 | 7 | #include "7zTypes.h" 8 | 9 | EXTERN_C_BEGIN 10 | 11 | void *MyAlloc(size_t size); 12 | void MyFree(void *address); 13 | 14 | #ifdef _WIN32 15 | 16 | void SetLargePageSize(void); 17 | 18 | void *MidAlloc(size_t size); 19 | void MidFree(void *address); 20 | void *BigAlloc(size_t size); 21 | void BigFree(void *address); 22 | 23 | #else 24 | 25 | #define MidAlloc(size) MyAlloc(size) 26 | #define MidFree(address) MyFree(address) 27 | #define BigAlloc(size) MyAlloc(size) 28 | #define BigFree(address) MyFree(address) 29 | 30 | #endif 31 | 32 | extern const ISzAlloc g_Alloc; 33 | 34 | #ifdef _WIN32 35 | extern const ISzAlloc g_BigAlloc; 36 | extern const ISzAlloc g_MidAlloc; 37 | #else 38 | #define g_BigAlloc g_AlignedAlloc 39 | #define g_MidAlloc g_AlignedAlloc 40 | #endif 41 | 42 | extern const ISzAlloc g_AlignedAlloc; 43 | 44 | 45 | typedef struct 46 | { 47 | ISzAlloc vt; 48 | ISzAllocPtr baseAlloc; 49 | unsigned numAlignBits; /* ((1 << numAlignBits) >= sizeof(void *)) */ 50 | size_t offset; /* (offset == (k * sizeof(void *)) && offset < (1 << numAlignBits) */ 51 | } CAlignOffsetAlloc; 52 | 53 | void AlignOffsetAlloc_CreateVTable(CAlignOffsetAlloc *p); 54 | 55 | 56 | EXTERN_C_END 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /extensions/PHP7/ccegtbprobe/LZMA/Compiler.h: -------------------------------------------------------------------------------- 1 | /* Compiler.h 2 | 2021-01-05 : Igor Pavlov : Public domain */ 3 | 4 | #ifndef __7Z_COMPILER_H 5 | #define __7Z_COMPILER_H 6 | 7 | #ifdef __clang__ 8 | #pragma clang diagnostic ignored "-Wunused-private-field" 9 | #endif 10 | 11 | #ifdef _MSC_VER 12 | 13 | #ifdef UNDER_CE 14 | #define RPC_NO_WINDOWS_H 15 | /* #pragma warning(disable : 4115) // '_RPC_ASYNC_STATE' : named type definition in parentheses */ 16 | #pragma warning(disable : 4201) // nonstandard extension used : nameless struct/union 17 | #pragma warning(disable : 4214) // nonstandard extension used : bit field types other than int 18 | #endif 19 | 20 | #if _MSC_VER >= 1300 21 | #pragma warning(disable : 4996) // This function or variable may be unsafe 22 | #else 23 | #pragma warning(disable : 4511) // copy constructor could not be generated 24 | #pragma warning(disable : 4512) // assignment operator could not be generated 25 | #pragma warning(disable : 4514) // unreferenced inline function has been removed 26 | #pragma warning(disable : 4702) // unreachable code 27 | #pragma warning(disable : 4710) // not inlined 28 | #pragma warning(disable : 4714) // function marked as __forceinline not inlined 29 | #pragma warning(disable : 4786) // identifier was truncated to '255' characters in the debug information 30 | #endif 31 | 32 | #ifdef __clang__ 33 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 34 | #pragma clang diagnostic ignored "-Wmicrosoft-exception-spec" 35 | // #pragma clang diagnostic ignored "-Wreserved-id-macro" 36 | #endif 37 | 38 | #endif 39 | 40 | #define UNUSED_VAR(x) (void)x; 41 | /* #define UNUSED_VAR(x) x=x; */ 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /extensions/PHP7/ccegtbprobe/LZMA/LzHash.h: -------------------------------------------------------------------------------- 1 | /* LzHash.h -- HASH functions for LZ algorithms 2 | 2019-10-30 : Igor Pavlov : Public domain */ 3 | 4 | #ifndef __LZ_HASH_H 5 | #define __LZ_HASH_H 6 | 7 | /* 8 | (kHash2Size >= (1 << 8)) : Required 9 | (kHash3Size >= (1 << 16)) : Required 10 | */ 11 | 12 | #define kHash2Size (1 << 10) 13 | #define kHash3Size (1 << 16) 14 | // #define kHash4Size (1 << 20) 15 | 16 | #define kFix3HashSize (kHash2Size) 17 | #define kFix4HashSize (kHash2Size + kHash3Size) 18 | // #define kFix5HashSize (kHash2Size + kHash3Size + kHash4Size) 19 | 20 | /* 21 | We use up to 3 crc values for hash: 22 | crc0 23 | crc1 << Shift_1 24 | crc2 << Shift_2 25 | (Shift_1 = 5) and (Shift_2 = 10) is good tradeoff. 26 | Small values for Shift are not good for collision rate. 27 | Big value for Shift_2 increases the minimum size 28 | of hash table, that will be slow for small files. 29 | */ 30 | 31 | #define kLzHash_CrcShift_1 5 32 | #define kLzHash_CrcShift_2 10 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /extensions/PHP7/ccegtbprobe/LZMA/LzmaLib.c: -------------------------------------------------------------------------------- 1 | /* LzmaLib.c -- LZMA library wrapper 2 | 2015-06-13 : Igor Pavlov : Public domain */ 3 | 4 | #include "Alloc.h" 5 | #include "LzmaDec.h" 6 | #include "LzmaEnc.h" 7 | #include "LzmaLib.h" 8 | 9 | MY_STDAPI LzmaCompress(unsigned char *dest, size_t *destLen, const unsigned char *src, size_t srcLen, 10 | unsigned char *outProps, size_t *outPropsSize, 11 | int level, /* 0 <= level <= 9, default = 5 */ 12 | unsigned dictSize, /* use (1 << N) or (3 << N). 4 KB < dictSize <= 128 MB */ 13 | int lc, /* 0 <= lc <= 8, default = 3 */ 14 | int lp, /* 0 <= lp <= 4, default = 0 */ 15 | int pb, /* 0 <= pb <= 4, default = 2 */ 16 | int fb, /* 5 <= fb <= 273, default = 32 */ 17 | int numThreads /* 1 or 2, default = 2 */ 18 | ) 19 | { 20 | CLzmaEncProps props; 21 | LzmaEncProps_Init(&props); 22 | props.level = level; 23 | props.dictSize = dictSize; 24 | props.lc = lc; 25 | props.lp = lp; 26 | props.pb = pb; 27 | props.fb = fb; 28 | props.numThreads = numThreads; 29 | 30 | return LzmaEncode(dest, destLen, src, srcLen, &props, outProps, outPropsSize, 0, 31 | NULL, &g_Alloc, &g_Alloc); 32 | } 33 | 34 | 35 | MY_STDAPI LzmaUncompress(unsigned char *dest, size_t *destLen, const unsigned char *src, size_t *srcLen, 36 | const unsigned char *props, size_t propsSize) 37 | { 38 | ELzmaStatus status; 39 | return LzmaDecode(dest, destLen, src, srcLen, props, (unsigned)propsSize, LZMA_FINISH_ANY, &status, &g_Alloc); 40 | } 41 | -------------------------------------------------------------------------------- /extensions/PHP7/ccegtbprobe/LZMA/Precomp.h: -------------------------------------------------------------------------------- 1 | /* Precomp.h -- StdAfx 2 | 2013-11-12 : Igor Pavlov : Public domain */ 3 | 4 | #ifndef __7Z_PRECOMP_H 5 | #define __7Z_PRECOMP_H 6 | 7 | #include "Compiler.h" 8 | /* #include "7zTypes.h" */ 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /extensions/PHP7/ccegtbprobe/config.m4: -------------------------------------------------------------------------------- 1 | PHP_ARG_ENABLE(ccegtbprobe, whether to enable CCEGTBProbe, 2 | [ --enable-ccegtbprobe Enable CCEGTBProbe extension]) 3 | 4 | if test "$PHP_CCEGTBPROBE" != "no"; then 5 | AC_DEFINE(HAVE_CCEGTBPROBE,1,[ ]) 6 | PHP_REQUIRE_CXX() 7 | PHP_ADD_LIBRARY(stdc++, "", EXTRA_LDFLAGS) 8 | PHP_NEW_EXTENSION(ccegtbprobe, ccegtbprobe.cpp piece_set.cpp LZMA/Alloc.c LZMA/CpuArch.c LZMA/LzFind.c LZMA/LzmaDec.c LZMA/LzmaEnc.c LZMA/LzmaLib.c, $ext_shared) 9 | fi 10 | -------------------------------------------------------------------------------- /extensions/PHP7/ccegtbprobe/config.w32: -------------------------------------------------------------------------------- 1 | ARG_ENABLE("ccegtbprobe", "CCEGTBProbe Support", "no"); 2 | 3 | if (PHP_CCEGTBPROBE == "yes") { 4 | EXTENSION("ccegtbprobe", "ccegtbprobe.cpp piece_set.cpp LZMA/Alloc.c LZMA/CpuArch.c LZMA/LzFind.c LZMA/LzmaDec.c LZMA/LzmaEnc.c LZMA/LzmaLib.c"); 5 | AC_DEFINE('HAVE_CCEGTBPROBE', 1, 'Have CCEGTBProbe support', false); 6 | } 7 | -------------------------------------------------------------------------------- /extensions/PHP7/ccegtbprobe/php_ccegtbprobe.h: -------------------------------------------------------------------------------- 1 | #ifndef PHP_CCEGTBPROBE_H 2 | #define PHP_CCEGTBPROBE_H 3 | 4 | extern zend_module_entry ccegtbprobe_module_entry; 5 | #define phpext_ccegtbprobe_ptr &ccegtbprobe_module_entry 6 | 7 | PHP_MINIT_FUNCTION(ccegtbprobe); 8 | PHP_FUNCTION(ccegtbprobe); 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /extensions/PHP7/ccegtbprobe/piece_set.cpp: -------------------------------------------------------------------------------- 1 | #include "xiangqi.h" 2 | #include "piece_set.h" 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | using namespace std; 10 | 11 | const U8* Piece_Set_ID[16] = { 12 | NULL, NULL, Rook_Set_ID[White], Knight_Set_ID[White], Cannon_Set_ID[White], NULL, NULL, Pawn_Set_ID[White], 13 | NULL, NULL, Rook_Set_ID[Black], Knight_Set_ID[Black], Cannon_Set_ID[Black], NULL, NULL, Pawn_Set_ID[Black], 14 | }; 15 | 16 | S8 Piece_Sq_Index[1440]; 17 | Group_Info Group_Table[40]; 18 | 19 | void piece_index_init() 20 | { 21 | int ix, data; 22 | memset(Piece_Sq_Index, 0, sizeof(Piece_Sq_Index)); 23 | for (int piece = 1; piece < 16; ++piece) 24 | { 25 | if (piece == 8) 26 | continue; 27 | for (int sq = 0; sq < 90; ++sq) 28 | { 29 | ix = (sq << 4) + piece; 30 | switch (piece) 31 | { 32 | case WhitePawn: 33 | data = White_Pawn_Pos[sq]; 34 | break; 35 | case BlackPawn: 36 | data = White_Pawn_Pos[sq_rank_mirror(sq)]; 37 | break; 38 | case WhiteKing: 39 | data = White_King_Pos[sq]; 40 | break; 41 | case BlackKing: 42 | data = White_King_Pos[sq_rank_mirror(sq)]; 43 | break; 44 | case WhiteAdvisor: 45 | data = White_Advisor_Pos[sq]; 46 | break; 47 | case BlackAdvisor: 48 | data = White_Advisor_Pos[sq_rank_mirror(sq)]; 49 | break; 50 | case WhiteBishop: 51 | data = White_Bishop_Pos[sq]; 52 | break; 53 | case BlackBishop: 54 | data = White_Bishop_Pos[sq_rank_mirror(sq)]; 55 | break; 56 | default: 57 | data = sq; 58 | } 59 | Piece_Sq_Index[ix] = data; 60 | } 61 | } 62 | } 63 | 64 | bool group_init() 65 | { 66 | int fd = open("/home/apache/GROUP.dat", O_RDONLY); 67 | if (fd == -1) 68 | { 69 | return false; 70 | } 71 | for(int i = 0; i < 40; ++i) 72 | { 73 | read(fd, &Group_Table[i], 28); 74 | if (Group_Table[i].piece_cnt) 75 | { 76 | Group_Table[i].index_tb = new uint32[Group_Table[i].index_size]; 77 | read(fd, Group_Table[i].index_tb, Group_Table[i].index_size * sizeof(uint32)); 78 | } 79 | } 80 | close(fd); 81 | return true; 82 | } 83 | -------------------------------------------------------------------------------- /extensions/PHP7/ccegtbprobe/piece_set.h: -------------------------------------------------------------------------------- 1 | #ifndef _PIECE_SET_H_ 2 | #define _PIECE_SET_H_ 3 | 4 | #include 5 | #include 6 | 7 | enum { 8 | W_K = 1, W_KA, W_KB, W_KAA, W_KAB, W_KBB, W_KAAB, W_KABB, W_KAABB, W_R, W_N, W_C, W_P, W_RR, W_NN, W_CC, W_PP, W_PPP, W_PPPP, 9 | B_K = 21, B_KA, B_KB, B_KAA, B_KAB, B_KBB, B_KAAB, B_KABB, B_KAABB, B_R, B_N, B_C, B_P, B_RR, B_NN, B_CC, B_PP, B_PPP, B_PPPP, 10 | }; 11 | enum{ 12 | WSet_Defend, WSet_Rook, WSet_Knight, WSet_Cannon, WSet_Pawn, 13 | BSet_Defend, BSet_Rook, BSet_Knight, BSet_Cannon, BSet_Pawn, 14 | }; 15 | const U8 Defend_Set_ID[2][3][3] = { 16 | {W_K, W_KB, W_KBB, 17 | W_KA, W_KAB, W_KABB, 18 | W_KAA, W_KAAB, W_KAABB}, 19 | {B_K, B_KB, B_KBB, 20 | B_KA, B_KAB, B_KABB, 21 | B_KAA, B_KAAB, B_KAABB}, 22 | }; 23 | const U8 Rook_Set_ID[2][3] = {{0, W_R, W_RR},{0, B_R, B_RR}}; 24 | const U8 Knight_Set_ID[2][3] = {{0, W_N, W_NN},{0, B_N, B_NN}}; 25 | const U8 Cannon_Set_ID[2][3] = {{0, W_C, W_CC},{0, B_C, B_CC}}; 26 | const U8 Pawn_Set_ID[2][4] = {{0, W_P, W_PP, W_PPP},{0, B_P, B_PP, B_PPP}}; 27 | extern const U8* Piece_Set_ID[16]; 28 | 29 | const int Piece_Order_Value[16] = { 30 | 0, 0, 4000, 600, 603, 11, 10, 80, 31 | 0, 0, 4000, 600, 603, 11, 10, 80, 32 | }; 33 | extern S8 Piece_Sq_Index[1440]; 34 | 35 | inline int piece_index(int piece, int sq) 36 | { 37 | return Piece_Sq_Index[(sq << 4) + piece]; 38 | } 39 | inline int defend_set(int a_nb, int b_nb, int color) 40 | { 41 | return Defend_Set_ID[color][a_nb][b_nb]; 42 | } 43 | inline int piece_set(int piece, int number) 44 | { 45 | return Piece_Set_ID[piece][number]; 46 | } 47 | #pragma pack(push, 4) 48 | struct Group_Info 49 | { 50 | S8 info_id; 51 | S8 piece_cnt; 52 | S8 pieces[6]; 53 | uint16 table_size; 54 | uint16 compress_size; 55 | uint16 weight[6]; 56 | uint32 index_size; 57 | uint32 * index_tb; 58 | 59 | Group_Info() 60 | { 61 | memset(this, 0, sizeof(*this)); 62 | } 63 | ~Group_Info() 64 | { 65 | if (piece_cnt) 66 | { 67 | delete[] index_tb; 68 | } 69 | } 70 | 71 | uint32 get_list_pos(const S8* sq_list)const 72 | { 73 | int index = 0; 74 | for (int i = 0; i < piece_cnt; ++i) 75 | { 76 | index += weight[i] * piece_index(pieces[i], sq_list[i]); 77 | } 78 | return index_tb[index]; 79 | } 80 | }; 81 | #pragma pack(pop) 82 | 83 | extern Group_Info Group_Table[40]; 84 | inline const Group_Info* get_set_info(int set_id) 85 | { 86 | return &Group_Table[set_id]; 87 | } 88 | 89 | extern void piece_index_init(); 90 | extern bool group_init(); 91 | 92 | #endif 93 | -------------------------------------------------------------------------------- /extensions/PHP7/judy/.gitignore: -------------------------------------------------------------------------------- 1 | .deps 2 | .libs 3 | *.lo 4 | tests/*.diff 5 | tests/*.exp 6 | tests/*.log 7 | tests/*.out 8 | tests/*.sh 9 | tests/*.php 10 | # Files generated by phpize, configure and make 11 | autom4te.cache 12 | build 13 | modules 14 | acinclude.m4 15 | aclocal.m4 16 | config.guess 17 | config.h 18 | config.h.in 19 | config.log 20 | config.nice 21 | config.status 22 | config.sub 23 | configure 24 | configure.in 25 | install-sh 26 | judy.la 27 | ltmain.sh 28 | libtool 29 | Makefile 30 | Makefile.fragments 31 | Makefile.global 32 | Makefile.objects 33 | missing 34 | mkinstalldirs 35 | run-tests.php 36 | -------------------------------------------------------------------------------- /extensions/PHP7/judy/.travis.yml: -------------------------------------------------------------------------------- 1 | language: php 2 | php: 3 | - "5.5" 4 | - "5.4" 5 | - "5.3" 6 | before_install: 7 | - sudo apt-get update -qq 8 | - sudo apt-get install -qq libjudydebian1 libjudy-dev php5-dev 9 | install: phpize 10 | script: ./configure --with-judy=/usr && make && sudo make install && TEST_PHP_ARGS=-q make test 11 | -------------------------------------------------------------------------------- /extensions/PHP7/judy/CREDITS: -------------------------------------------------------------------------------- 1 | judy 2 | Nicolas Brousse 3 | -------------------------------------------------------------------------------- /extensions/PHP7/judy/EXPERIMENTAL: -------------------------------------------------------------------------------- 1 | This package is EXPERIMENTAL and should be used at your OWN risk. 2 | 3 | The current API (Methods, Constants and Functions names) may change at anytime. 4 | -------------------------------------------------------------------------------- /extensions/PHP7/judy/config.m4: -------------------------------------------------------------------------------- 1 | dnl 2 | dnl $Id$ 3 | dnl 4 | 5 | PHP_ARG_WITH(judy, for Judy support, 6 | [ --with-judy[=DIR] Include Judy support. 7 | DIR is the Judy install prefix [default=BUNDLED]]) 8 | 9 | judy_sources="judy_handlers.c judy_arrayaccess.c judy_iterator.c" 10 | 11 | if test "$PHP_JUDY" != "no"; then 12 | 13 | dnl # --with-judy -> check with-path 14 | SEARCH_PATH="/usr/local /usr" 15 | SEARCH_FOR="/include/Judy.h" 16 | AC_MSG_CHECKING([for Judy library to use]) 17 | if test -r $PHP_JUDY/$SEARCH_FOR; then 18 | JUDY_DIR=$PHP_JUDY 19 | else 20 | for i in $SEARCH_PATH ; do 21 | if test -r $i/$SEARCH_FOR; then 22 | JUDY_DIR=$i 23 | fi 24 | done 25 | fi 26 | 27 | if test -z "$JUDY_DIR"; then 28 | AC_MSG_RESULT([not found]) 29 | AC_MSG_ERROR([Please install the Judy libraries]) 30 | else 31 | AC_MSG_RESULT([found in $JUDY_DIR]) 32 | fi 33 | 34 | PHP_ADD_INCLUDE($JUDY_DIR/include) 35 | 36 | dnl # --with-judy -> check for lib and symbol presence 37 | LIBNAME=Judy 38 | LIBSYMBOL=Judy1Set 39 | 40 | PHP_CHECK_LIBRARY($LIBNAME, $LIBSYMBOL, 41 | [ 42 | PHP_ADD_LIBRARY_WITH_PATH($LIBNAME, $JUDY_DIR/$PHP_LIBDIR, JUDY_SHARED_LIBADD) 43 | AC_DEFINE(HAVE_JUDYLIB,1,[ ]) 44 | ],[ 45 | AC_MSG_ERROR([wrong Judy lib version or lib not found using -L$JUDY_DIR/$PHP_LIBDIR -lJudy]) 46 | ],[ 47 | -L$JUDY_DIR/$PHP_LIBDIR -lJudy 48 | ]) 49 | 50 | PHP_INSTALL_HEADERS([ext/judy], [php_judy.h judy_handlers.h judy_arrayaccess.h judy_iterator.h]) 51 | PHP_NEW_EXTENSION(judy, php_judy.c $judy_sources, $ext_shared) 52 | PHP_ADD_BUILD_DIR($ext_builddir/lib, 1) 53 | PHP_SUBST(JUDY_SHARED_LIBADD) 54 | 55 | fi 56 | -------------------------------------------------------------------------------- /extensions/PHP7/judy/config.w32: -------------------------------------------------------------------------------- 1 | // $Id$ 2 | // vim:ft=javascript 3 | 4 | ARG_WITH("judy", "Judy support", "no"); 5 | 6 | if (PHP_JUDY != "no") { 7 | if (CHECK_LIB("libJudy_a.lib;libJudy.lib", "judy", PHP_JUDY) && CHECK_HEADER_ADD_INCLUDE("Judy.h", "CFLAGS_JUDY")) { 8 | EXTENSION("judy", "php_judy.c judy_arrayaccess.c judy_handlers.c judy_iterator.c"); 9 | AC_DEFINE('HAVE_JUDY', 1, 'Have Judy library'); 10 | 11 | ADD_FLAG("CFLAGS_JUDY", "/D JU_WIN"); 12 | 13 | if (PHP_JUDY_SHARED) { 14 | ADD_FLAG("CFLAGS_JUDY", "/D PHP_JUDY_EXPORTS "); 15 | } 16 | } else { 17 | WARNING("judy not enabled; libraries and headers not found"); 18 | } 19 | } 20 | 21 | -------------------------------------------------------------------------------- /extensions/PHP7/judy/examples/judy-bench-int_to_int.php: -------------------------------------------------------------------------------- 1 | memoryUsage())."\n"; 47 | $e=microtime(true); 48 | echo "Elapsed time: ".($e - $s)." sec.\n"; 49 | echo "Mem usage: ". __convert(memory_get_usage()) . "\n"; 50 | echo "Mem real: ". __convert(memory_get_usage(true)) . "\n"; 51 | echo "\n"; 52 | 53 | unset($judy); 54 | } 55 | -------------------------------------------------------------------------------- /extensions/PHP7/judy/examples/judy-bench-string_to_int.php: -------------------------------------------------------------------------------- 1 | size()."\n"; 46 | $e=microtime(true); 47 | echo "Elapsed time: ".($e - $s)." sec.\n"; 48 | echo "Mem usage: ". __convert(memory_get_usage()) . "\n"; 49 | echo "Mem real: ". __convert(memory_get_usage(true)) . "\n"; 50 | echo "\n"; 51 | 52 | unset($judy); 53 | } 54 | -------------------------------------------------------------------------------- /extensions/PHP7/judy/examples/judy.php: -------------------------------------------------------------------------------- 1 | "; 3 | 4 | if(!extension_loaded('judy')) { 5 | dl('judy.' . PHP_SHLIB_SUFFIX); 6 | } 7 | 8 | judy_version(); 9 | echo "$br\n"; 10 | 11 | $module = 'judy'; 12 | $functions = get_extension_funcs($module); 13 | echo "Functions available in the $module extension:$br\n"; 14 | foreach($functions as $func) { 15 | echo "\t$func()$br\n"; 16 | } 17 | echo "$br\n"; 18 | $constants = get_defined_constants(true); 19 | echo "Constants available in $module extension:$br\n"; 20 | if (in_array($module, $constants)) { 21 | foreach ($constants[$module] as $const => $v) { 22 | echo "\t$const => $v$br\n"; 23 | } 24 | } 25 | 26 | $class=array('Judy'); 27 | foreach ($class as $c) { 28 | echo "$br\n"; 29 | $class_methods = get_class_methods($c); 30 | echo "$c class methods:$br\n"; 31 | foreach ($class_methods as $method_name) { 32 | echo "\t$c::$method_name()$br\n"; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /extensions/PHP7/judy/judy_arrayaccess.h: -------------------------------------------------------------------------------- 1 | /* 2 | +----------------------------------------------------------------------+ 3 | | PHP Judy | 4 | +----------------------------------------------------------------------+ 5 | | Copyright (c) 1997-2010 The PHP Group | 6 | +----------------------------------------------------------------------+ 7 | | This source file is subject to version 3.01 of the PHP license, | 8 | | that is bundled with this package in the file LICENSE, and is | 9 | | available through the world-wide-web at the following url: | 10 | | http://www.php.net/license/3_01.txt | 11 | | If you did not receive a copy of the PHP license and are unable to | 12 | | obtain it through the world-wide-web, please send a note to | 13 | | license@php.net so we can mail you a copy immediately. | 14 | +----------------------------------------------------------------------+ 15 | | Author: Nicolas Brousse | 16 | +----------------------------------------------------------------------+ 17 | */ 18 | 19 | #ifndef JUDY_ARRAYACCESS_H 20 | #define JUDY_ARRAYACCESS_H 21 | 22 | #include "php_judy.h" 23 | 24 | #endif /* JUDY_ARRAYACCESS_H */ 25 | 26 | /* 27 | * Local variables: 28 | * tab-width: 4 29 | * c-basic-offset: 4 30 | * End: 31 | * vim600: noet sw=4 ts=4 fdm=marker 32 | * vim<600: noet sw=4 ts=4 33 | */ 34 | -------------------------------------------------------------------------------- /extensions/PHP7/judy/judy_handlers.h: -------------------------------------------------------------------------------- 1 | /* 2 | +----------------------------------------------------------------------+ 3 | | PHP Judy | 4 | +----------------------------------------------------------------------+ 5 | | Copyright (c) 1997-2010 The PHP Group | 6 | +----------------------------------------------------------------------+ 7 | | This source file is subject to version 3.01 of the PHP license, | 8 | | that is bundled with this package in the file LICENSE, and is | 9 | | available through the world-wide-web at the following url: | 10 | | http://www.php.net/license/3_01.txt | 11 | | If you did not receive a copy of the PHP license and are unable to | 12 | | obtain it through the world-wide-web, please send a note to | 13 | | license@php.net so we can mail you a copy immediately. | 14 | +----------------------------------------------------------------------+ 15 | | Author: Nicolas Brousse | 16 | +----------------------------------------------------------------------+ 17 | */ 18 | 19 | #ifndef JUDY_HANDLERS_H 20 | #define JUDY_HANDLERS_H 21 | 22 | #include "php.h" 23 | #include "zend_exceptions.h" 24 | #include "zend_interfaces.h" 25 | 26 | zend_object *judy_object_clone(zval *this_ptr); 27 | int judy_object_count(zval *object, long *count); 28 | 29 | #endif /* JUDY_HANDLERS_H */ 30 | 31 | /* 32 | * Local variables: 33 | * tab-width: 4 34 | * c-basic-offset: 4 35 | * End: 36 | * vim600: noet sw=4 ts=4 fdm=marker 37 | * vim<600: noet sw=4 ts=4 38 | */ 39 | -------------------------------------------------------------------------------- /extensions/PHP7/judy/tests/001.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Check for Judy presence 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | 21 | --EXPECT-- 22 | judy extension is available 23 | 1.0.2 24 | -------------------------------------------------------------------------------- /extensions/PHP7/judy/tests/bitset_001.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Check for Judy BITSET set/unset/test methods 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | 45 | --EXPECT-- 46 | Set 100 index 47 | Test 100 index are set 48 | Unset 100 index 49 | Test 100 index are not set 50 | Done 51 | -------------------------------------------------------------------------------- /extensions/PHP7/judy/tests/bitset_002.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Check for Judy BITSET free/count/byCount methods 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | count(0, 49)."\n"; 21 | echo "Count Method: ".$judy->count()."\n"; 22 | echo "Count Function: ".count($judy)."\n"; 23 | 24 | unset($judy[50]); 25 | if (!$judy[50]) 26 | echo "Unset index 50\n"; 27 | 28 | echo "First half count: ".$judy->count(0, 49)."\n"; 29 | echo "Second half count: ".$judy->count(50, 100)."\n"; 30 | echo "Count Method: ".$judy->count()."\n"; 31 | echo "Count Function: ".count($judy)."\n"; 32 | 33 | // By count 34 | 35 | if (($index = $judy->byCount(50)) !== null) 36 | echo "By count (50th): $index\n"; 37 | else 38 | echo "By count (50th set index) failed\n"; 39 | 40 | if (($index = $judy->byCount(51)) !== null) 41 | echo "By count (51th): $index\n"; 42 | else 43 | echo "By count (51th set index) failed\n"; 44 | 45 | // Free 46 | 47 | if (!$judy->free()) 48 | echo "Failed to free Judy array\n"; 49 | else 50 | echo "Freeing Judy array\n"; 51 | 52 | echo "Count: ".$judy->count()."\n"; 53 | 54 | echo "Done\n"; 55 | ?> 56 | --EXPECT-- 57 | Set 100 index 58 | Half count: 50 59 | Count Method: 100 60 | Count Function: 100 61 | Unset index 50 62 | First half count: 50 63 | Second half count: 49 64 | Count Method: 99 65 | Count Function: 99 66 | By count (50th): 49 67 | By count (51th): 51 68 | Freeing Judy array 69 | Count: 0 70 | Done 71 | -------------------------------------------------------------------------------- /extensions/PHP7/judy/tests/bitset_003.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Check for Judy BITSET first/next/last/prev methods 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | first(); 21 | echo "First index set: $firstIndexDefault\n"; 22 | 23 | $firstIndex50 = $judy->first(50); 24 | echo "First index set from index 50: $firstIndex50\n"; 25 | 26 | // Last 27 | 28 | $lastIndexDefault = $judy->last(); 29 | echo "Last index set: $lastIndexDefault\n"; 30 | 31 | $lastIndex1000 = $judy->last(1000); 32 | echo "Last index set from index 1000: $lastIndex1000\n"; 33 | 34 | // Next 35 | 36 | echo "Testing next()\n"; 37 | $index = $firstIndexDefault; 38 | while ($index < $lastIndexDefault) { 39 | $parent_index = $index; 40 | $index = $judy->next($parent_index); 41 | if (empty($index) || $index < $firstIndexDefault) { 42 | echo "Failed to get next index from parent index ($parent_index)\n"; 43 | break; 44 | } 45 | } 46 | 47 | // Prev 48 | 49 | echo "Testing prev()\n"; 50 | $index = $lastIndexDefault; 51 | while ($index > $firstIndexDefault) { 52 | $parent_index = $index; 53 | $index = $judy->prev($parent_index); 54 | if (empty($index) || $index < $firstIndexDefault) { 55 | echo "Failed to get previous index from parent index ($parent_index)\n"; 56 | break; 57 | } 58 | } 59 | 60 | echo "Done\n"; 61 | ?> 62 | --EXPECT-- 63 | Set 500 index 64 | First index set: 100 65 | First index set from index 50: 100 66 | Last index set: 599 67 | Last index set from index 1000: 599 68 | Testing next() 69 | Testing prev() 70 | Done 71 | -------------------------------------------------------------------------------- /extensions/PHP7/judy/tests/bitset_005.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Check for Judy BITSET __clone() method 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | 22 | --EXPECT-- 23 | bool(true) 24 | bool(true) 25 | Clone OK 26 | Done 27 | -------------------------------------------------------------------------------- /extensions/PHP7/judy/tests/bitset_006.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Check if Judy BITSET works with $a[] = $b 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | $v) { 16 | print "k: $k, v: $v\n"; 17 | } 18 | echo "Done\n"; 19 | ?> 20 | --EXPECT-- 21 | Insert 5 values 22 | Loop on Judy array 23 | k: 0, v: 1 24 | k: 1, v: 1 25 | k: 2, v: 1 26 | k: 3, v: 1 27 | k: 4, v: 1 28 | Done 29 | -------------------------------------------------------------------------------- /extensions/PHP7/judy/tests/bitset_007.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Check if Judy BITSET works with $a[] = $b (2) 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | $v) { 18 | print "k: $k, v: $v\n"; 19 | } 20 | echo "Done\n"; 21 | ?> 22 | --EXPECT-- 23 | Insert 5 values 24 | Loop on Judy array 25 | k: 0, v: 1 26 | k: 10, v: 1 27 | k: 100, v: 1 28 | k: 101, v: 1 29 | k: 102, v: 1 30 | k: 103, v: 1 31 | k: 104, v: 1 32 | Done 33 | -------------------------------------------------------------------------------- /extensions/PHP7/judy/tests/github_issue15_001.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Check for Judy count() method when using INT_TO_INT in a loop 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | count(): ". $judy1->size()."\n"; 19 | 20 | echo "Assign a value while in a loop of 1000\n"; 21 | for ($i = 0;$i < 1000;$i++) { 22 | $judy1[5] = 100; 23 | } 24 | echo "\$judy1->count(): ". $judy1->size()."\n"; 25 | 26 | foreach ($judy1 as $k => $v) { 27 | echo "\$judy1[".$k."] = ".$v."\n"; 28 | } 29 | 30 | unset($judy1); 31 | 32 | ?> 33 | --EXPECT-- 34 | Instantiate first object: $judy1 35 | Assign a value while in a loop of 1 36 | $judy1->count(): 1 37 | Assign a value while in a loop of 1000 38 | $judy1->count(): 1 39 | $judy1[5] = 100 40 | -------------------------------------------------------------------------------- /extensions/PHP7/judy/tests/github_issue15_002.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Check for Judy count() method when using STRING_TO_MIXED in a loop 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | count(): ". $judy1->size()."\n"; 19 | 20 | echo "Assign a value while in a loop of 1000\n"; 21 | for ($i = 0;$i < 1000;$i++) { 22 | $judy1["a"] = 100; 23 | } 24 | echo "\$judy1->count(): ". $judy1->size()."\n"; 25 | 26 | foreach ($judy1 as $k => $v) { 27 | echo "\$judy1[".$k."] = ".$v."\n"; 28 | } 29 | 30 | unset($judy1); 31 | 32 | ?> 33 | --EXPECT-- 34 | Instantiate first object: $judy1 35 | Assign a value while in a loop of 1 36 | $judy1->count(): 1 37 | Assign a value while in a loop of 1000 38 | $judy1->count(): 1 39 | $judy1[a] = 100 40 | -------------------------------------------------------------------------------- /extensions/PHP7/judy/tests/github_issue1_001.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Check for Judy count() method when two instances INT_TO_INT are declared 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | count(): ". $judy1->count()."\n"; 18 | echo "\$judy2->count(): ". $judy2->count()."\n"; 19 | 20 | echo "Test Size Consistent\n"; 21 | $judy1[0] = 1; 22 | $judy1[1] = 2; 23 | 24 | echo "\$judy1->count(): ". $judy1->count()."\n"; 25 | echo "\$judy2->count(): ". $judy2->count()."\n"; 26 | 27 | echo "Test Size Sum\n"; 28 | $judy2[0] = 3; 29 | echo "\$judy1->count(): ". $judy1->count()."\n"; 30 | echo "\$judy2->count(): ". $judy2->count()."\n"; 31 | 32 | unset($judy1); 33 | unset($judy2); 34 | 35 | ?> 36 | --EXPECT-- 37 | Instantiate first object: $judy1 38 | Instantiate second object: $judy2 39 | Test Size Zero 40 | $judy1->count(): 0 41 | $judy2->count(): 0 42 | Test Size Consistent 43 | $judy1->count(): 2 44 | $judy2->count(): 0 45 | Test Size Sum 46 | $judy1->count(): 2 47 | $judy2->count(): 1 48 | -------------------------------------------------------------------------------- /extensions/PHP7/judy/tests/github_issue1_002.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Check for Judy count() method when two instances STRING_TO_MIXED are declared 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | count(): ". $judy1->count()."\n"; 18 | echo "\$judy2->count(): ". $judy2->count()."\n"; 19 | 20 | echo "Test Size Consistent\n"; 21 | $judy1->offsetSet("foo", "bar"); 22 | $judy1->offsetSet("another", "value"); 23 | 24 | echo "\$judy1->count(): ". $judy1->count()."\n"; 25 | echo "\$judy2->count(): ". $judy2->count()."\n"; 26 | 27 | echo "Test Size Sum\n"; 28 | $judy2->offsetSet("third", ".."); 29 | echo "\$judy1->count(): ". $judy1->count()."\n"; 30 | echo "\$judy2->count(): ". $judy2->count()."\n"; 31 | 32 | unset($judy1); 33 | unset($judy2); 34 | 35 | ?> 36 | --EXPECT-- 37 | Instantiate first object: $judy1 38 | Instantiate second object: $judy2 39 | Test Size Zero 40 | $judy1->count(): 0 41 | $judy2->count(): 0 42 | Test Size Consistent 43 | $judy1->count(): 2 44 | $judy2->count(): 0 45 | Test Size Sum 46 | $judy1->count(): 2 47 | $judy2->count(): 1 48 | -------------------------------------------------------------------------------- /extensions/PHP7/judy/tests/github_issue2_001.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Check for Judy with foreach() and vardump() method with one instance INT_TO_INT 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | $v) { 28 | echo "$k => $v\n"; 29 | var_dump($v); 30 | } 31 | 32 | unset($judy); 33 | ?> 34 | --EXPECT-- 35 | Instantiate object: $judy 36 | echo values 37 | 17 38 | 71 39 | var_dump($judy) 40 | object(Judy)#1 (0) { 41 | } 42 | var_dump($judy[125]) 43 | int(17) 44 | foreach loop with var_dump() 45 | 125 => 17 46 | int(17) 47 | 521 => 71 48 | int(71) 49 | -------------------------------------------------------------------------------- /extensions/PHP7/judy/tests/github_issue2_002.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Check for Judy ITERATOR using foreach() and INT_TO_INT 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | $v) 16 | print "k: $k, v: $v\n"; 17 | 18 | unset($judy); 19 | ?> 20 | --EXPECT-- 21 | Set INT_TO_INT Judy object 22 | k: 125, v: 17 23 | k: 521, v: 71 24 | -------------------------------------------------------------------------------- /extensions/PHP7/judy/tests/github_issue2_003.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Check for Judy ITERATOR using foreach() and INT_TO_MIXED 3 | --SKIPIF-- 4 | 5 | --INI-- 6 | date.timezone=UTC 7 | --FILE-- 8 | $v) 18 | print "k: $k, v: ".$v->format('Y')."\n"; 19 | 20 | unset($judy); 21 | ?> 22 | --EXPECT-- 23 | Set INT_TO_MIXED Judy object 24 | k: 125, v: 2012 25 | k: 521, v: 1983 26 | -------------------------------------------------------------------------------- /extensions/PHP7/judy/tests/github_issue3_001.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Check for Judy infinite loop when using foreach() and INT_TO_INT with index 0 and -1 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | $v) 18 | print "k: $k, v: $v\n"; 19 | 20 | unset($judy); 21 | ?> 22 | --EXPECT-- 23 | Set INT_TO_INT Judy object 24 | k: 0, v: 456 25 | k: 1, v: 457 26 | k: 2, v: 123 27 | k: 3, v: 122 28 | -------------------------------------------------------------------------------- /extensions/PHP7/judy/tests/int_to_int_001.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Check for Judy INT_TO_INT set/unset/get methods 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | 52 | --EXPECT-- 53 | Insert 100 index with a rand value 54 | Get 100 index 55 | Remove 100 index 56 | Get 100 index (should be empty) 57 | Testing values are properly inserted and returned 58 | Done 59 | -------------------------------------------------------------------------------- /extensions/PHP7/judy/tests/int_to_int_002.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Check for Judy INT_TO_INT free/count/byCount methods 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | count(0, 49)."\n"; 22 | echo "Count Method: ".$judy->count()."\n"; 23 | echo "Count Function: ".count($judy)."\n"; 24 | 25 | unset($judy[50]); 26 | if (!$judy[50]) 27 | echo "Unset index 50\n"; 28 | 29 | echo "First half count: ".$judy->count(0, 49)."\n"; 30 | echo "Second half count: ".$judy->count(50, 100)."\n"; 31 | echo "Count Method: ".$judy->count()."\n"; 32 | echo "Count Function: ".count($judy)."\n"; 33 | 34 | // By count 35 | 36 | if (($index = $judy->byCount(50)) !== null) 37 | echo "By count (50th): $index\n"; 38 | else 39 | echo "By count (50th set index) failed\n"; 40 | 41 | if (($index = $judy->byCount(51)) !== null) 42 | echo "By count (51th): $index\n"; 43 | else 44 | echo "By count (51th set index) failed\n"; 45 | 46 | // Free 47 | 48 | if (!$judy->free()) 49 | echo "Failed to free Judy array\n"; 50 | else 51 | echo "Freeing Judy array\n"; 52 | 53 | echo "Count: ".$judy->count()."\n"; 54 | 55 | echo "Done\n"; 56 | ?> 57 | --EXPECT-- 58 | Insert 100 index with a rand value 59 | Half count: 50 60 | Count Method: 100 61 | Count Function: 100 62 | Unset index 50 63 | First half count: 50 64 | Second half count: 49 65 | Count Method: 99 66 | Count Function: 99 67 | By count (50th): 49 68 | By count (51th): 51 69 | Freeing Judy array 70 | Count: 0 71 | Done 72 | -------------------------------------------------------------------------------- /extensions/PHP7/judy/tests/int_to_int_003.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Check for Judy INT_TO_INT first/next/last/prev methods 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | first(); 22 | echo "First index set: $firstIndexDefault\n"; 23 | 24 | $firstIndex50 = $judy->first(50); 25 | echo "First index set from index 50: $firstIndex50\n"; 26 | 27 | // Last 28 | 29 | $lastIndexDefault = $judy->last(); 30 | echo "Last index set: $lastIndexDefault\n"; 31 | 32 | $lastIndex1000 = $judy->last(1000); 33 | echo "Last index set from index 1000: $lastIndex1000\n"; 34 | 35 | // Next 36 | 37 | echo "Testing next()\n"; 38 | $index = $firstIndexDefault; 39 | while ($index < $lastIndexDefault) { 40 | $parent_index = $index; 41 | $index = $judy->next($parent_index); 42 | if (empty($index) || $index < $firstIndexDefault) { 43 | echo "Failed to get next index from parent index ($parent_index)\n"; 44 | break; 45 | } 46 | } 47 | 48 | // Prev 49 | 50 | echo "Testing prev()\n"; 51 | $index = $lastIndexDefault; 52 | while ($index > $firstIndexDefault) { 53 | $parent_index = $index; 54 | $index = $judy->prev($parent_index); 55 | if (empty($index) || $index < $firstIndexDefault) { 56 | echo "Failed to get previous index from parent index ($parent_index)\n"; 57 | break; 58 | } 59 | } 60 | 61 | echo "Done\n"; 62 | ?> 63 | --EXPECT-- 64 | Insert 500 index with a rand value 65 | First index set: 100 66 | First index set from index 50: 100 67 | Last index set: 599 68 | Last index set from index 1000: 599 69 | Testing next() 70 | Testing prev() 71 | Done 72 | -------------------------------------------------------------------------------- /extensions/PHP7/judy/tests/int_to_int_005.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Check for Judy INT_TO_INT __clone() method 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | 22 | --EXPECT-- 23 | int(127) 24 | int(127) 25 | Clone OK 26 | Done 27 | -------------------------------------------------------------------------------- /extensions/PHP7/judy/tests/int_to_int_006.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Check for Judy INT_TO_INT with unsigned and signed INT 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | $v) 32 | print "k: $k, v: $v\n"; 33 | echo "Done\n"; 34 | ?> 35 | --EXPECT-- 36 | $judy[-1] set value for latest index, ie $judy[2] 37 | $judy[2] has been reset to -12 38 | Loop on Judy array with uint/int 39 | k: 0, v: 0 40 | k: 1, v: 17 41 | k: 2, v: -12 42 | k: 3, v: 8 43 | k: 4, v: -19 44 | k: 5, v: 6 45 | k: 6, v: 7 46 | Done 47 | -------------------------------------------------------------------------------- /extensions/PHP7/judy/tests/int_to_int_007.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Check for Judy INT_TO_INT works with $a[] = $b 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | $v) { 16 | print "k: $k, v: $v\n"; 17 | } 18 | echo "Done\n"; 19 | ?> 20 | --EXPECT-- 21 | Insert 5 values 22 | Loop on Judy array 23 | k: 0, v: 0 24 | k: 1, v: 1 25 | k: 2, v: 2 26 | k: 3, v: 3 27 | k: 4, v: 4 28 | Done 29 | -------------------------------------------------------------------------------- /extensions/PHP7/judy/tests/int_to_int_008.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Check for Judy INT_TO_INT works with $a[] = $b (2) 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | $v) { 18 | print "k: $k, v: $v\n"; 19 | } 20 | echo "Done\n"; 21 | ?> 22 | --EXPECT-- 23 | Insert 5 values 24 | Loop on Judy array 25 | k: 0, v: 0 26 | k: 10, v: 4 27 | k: 100, v: 4 28 | k: 101, v: 1 29 | k: 102, v: 2 30 | k: 103, v: 3 31 | k: 104, v: 4 32 | Done 33 | -------------------------------------------------------------------------------- /extensions/PHP7/judy/tests/int_to_mixed_001.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Check for Judy INT_TO_MIXED set/unset/get methods 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | 52 | --EXPECT-- 53 | Insert 100 index with a rand value 54 | Get 100 index 55 | Remove 100 index 56 | Get 100 index (should be empty) 57 | Testing values are properly inserted and returned 58 | Done 59 | -------------------------------------------------------------------------------- /extensions/PHP7/judy/tests/int_to_mixed_002.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Check for Judy INT_TO_MIXED free/count/byCount methods 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | count(0, 49)."\n"; 22 | echo "Count Method: ".$judy->count()."\n"; 23 | echo "Count Function: ".count($judy)."\n"; 24 | 25 | unset($judy[50]); 26 | if (!$judy[50]) 27 | echo "Unset index 50\n"; 28 | 29 | echo "First half count: ".$judy->count(0, 49)."\n"; 30 | echo "Second half count: ".$judy->count(50, 100)."\n"; 31 | echo "Count Method: ".$judy->count()."\n"; 32 | echo "Count Function: ".count($judy)."\n"; 33 | 34 | // By count 35 | 36 | if (($index = $judy->byCount(50)) !== null) 37 | echo "By count (50th): $index\n"; 38 | else 39 | echo "By count (50th set index) failed\n"; 40 | 41 | if (($index = $judy->byCount(51)) !== null) 42 | echo "By count (51th): $index\n"; 43 | else 44 | echo "By count (51th set index) failed\n"; 45 | 46 | // Free 47 | 48 | if (!$judy->free()) 49 | echo "Failed to free Judy array\n"; 50 | else 51 | echo "Freeing Judy array\n"; 52 | 53 | echo "Count: ".$judy->count()."\n"; 54 | 55 | echo "Done\n"; 56 | ?> 57 | --EXPECT-- 58 | Insert 100 index with a rand value 59 | Half count: 50 60 | Count Method: 100 61 | Count Function: 100 62 | Unset index 50 63 | First half count: 50 64 | Second half count: 49 65 | Count Method: 99 66 | Count Function: 99 67 | By count (50th): 49 68 | By count (51th): 51 69 | Freeing Judy array 70 | Count: 0 71 | Done 72 | -------------------------------------------------------------------------------- /extensions/PHP7/judy/tests/int_to_mixed_003.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Check for Judy INT_TO_MIXED first/next/last/prev methods 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | first(); 22 | echo "First index set: $firstIndexDefault\n"; 23 | 24 | $firstIndex50 = $judy->first(50); 25 | echo "First index set from index 50: $firstIndex50\n"; 26 | 27 | // Last 28 | 29 | $lastIndexDefault = $judy->last(); 30 | echo "Last index set: $lastIndexDefault\n"; 31 | 32 | $lastIndex1000 = $judy->last(1000); 33 | echo "Last index set from index 1000: $lastIndex1000\n"; 34 | 35 | // Next 36 | 37 | echo "Testing next()\n"; 38 | $index = $firstIndexDefault; 39 | while ($index < $lastIndexDefault) { 40 | $parent_index = $index; 41 | $index = $judy->next($parent_index); 42 | if (empty($index) || $index < $firstIndexDefault) { 43 | echo "Failed to get next index from parent index ($parent_index)\n"; 44 | break; 45 | } 46 | } 47 | 48 | // Prev 49 | 50 | echo "Testing prev()\n"; 51 | $index = $lastIndexDefault; 52 | while ($index > $firstIndexDefault) { 53 | $parent_index = $index; 54 | $index = $judy->prev($parent_index); 55 | if (empty($index) || $index < $firstIndexDefault) { 56 | echo "Failed to get previous index from parent index ($parent_index)\n"; 57 | break; 58 | } 59 | } 60 | 61 | echo "Done\n"; 62 | ?> 63 | --EXPECT-- 64 | Insert 500 index with a rand value 65 | First index set: 100 66 | First index set from index 50: 100 67 | Last index set: 599 68 | Last index set from index 1000: 599 69 | Testing next() 70 | Testing prev() 71 | Done 72 | -------------------------------------------------------------------------------- /extensions/PHP7/judy/tests/int_to_mixed_005.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Check for Judy INT_TO_MIXED __clone() method 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | 22 | --EXPECT-- 23 | string(11) "hello world" 24 | string(11) "hello world" 25 | Clone OK 26 | Done 27 | -------------------------------------------------------------------------------- /extensions/PHP7/judy/tests/int_to_mixed_006.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Check for Judy INT_TO_MIXED works with $a[] = $b 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | $v) { 16 | print "k: $k, v: $v\n"; 17 | } 18 | echo "Done\n"; 19 | ?> 20 | --EXPECT-- 21 | Insert 5 values 22 | Loop on Judy array 23 | k: 0, v: mix0 24 | k: 1, v: mix1 25 | k: 2, v: mix2 26 | k: 3, v: mix3 27 | k: 4, v: mix4 28 | Done 29 | -------------------------------------------------------------------------------- /extensions/PHP7/judy/tests/int_to_mixed_007.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Check for Judy INT_TO_MIXED works with $a[] = $b (2) 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | $v) { 18 | print "k: $k, v: $v\n"; 19 | } 20 | echo "Done\n"; 21 | ?> 22 | --EXPECT-- 23 | Insert 5 values 24 | Loop on Judy array 25 | k: 0, v: mix0 26 | k: 10, v: mix4 27 | k: 100, v: mix4 28 | k: 101, v: mix1 29 | k: 102, v: mix2 30 | k: 103, v: mix3 31 | k: 104, v: mix4 32 | Done 33 | -------------------------------------------------------------------------------- /extensions/PHP7/judy/tests/judy_error.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Check for Error with Judy::__construct() when object has been already instantiated 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | __construct(Judy::INT_TO_INT); 9 | ?> 10 | --EXPECTF-- 11 | Fatal error: Judy::__construct(): Judy Array already instantiated in %s 12 | -------------------------------------------------------------------------------- /extensions/PHP7/judy/tests/judy_foreach_bitset.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Check for Judy ITERATOR using foreach() and BITSET 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | $v) 23 | print "k: $k, v: $v\n"; 24 | 25 | unset($judy); 26 | 27 | ?> 28 | --EXPECT-- 29 | Set 10 index 30 | Unset index 5 31 | Append TRUE to the array using last index + 1 32 | k: 0, v: 1 33 | k: 1, v: 1 34 | k: 2, v: 1 35 | k: 3, v: 1 36 | k: 4, v: 1 37 | k: 6, v: 1 38 | k: 7, v: 1 39 | k: 8, v: 1 40 | k: 9, v: 1 41 | k: 10, v: 1 42 | -------------------------------------------------------------------------------- /extensions/PHP7/judy/tests/judy_foreach_int_to_int.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Check for Judy ITERATOR using foreach() and INT_TO_INT 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | $v) 15 | print "k: $k, v: $v\n"; 16 | 17 | unset($judy); 18 | 19 | ?> 20 | --EXPECT-- 21 | Set 3 index 22 | k: 1, v: 100 23 | k: 2, v: 101 24 | k: 3, v: 102 25 | -------------------------------------------------------------------------------- /extensions/PHP7/judy/tests/judy_foreach_int_to_mixed.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Check for Judy ITERATOR using foreach() and INT_TO_MIXED 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | $v) 15 | print "k: $k, v: $v\n"; 16 | 17 | unset($judy); 18 | 19 | ?> 20 | --EXPECT-- 21 | Set 3 index 22 | k: 1, v: 100 23 | k: 2, v: AAA 24 | k: 3, v: 103 25 | -------------------------------------------------------------------------------- /extensions/PHP7/judy/tests/judy_foreach_string_to_int.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Check for Judy ITERATOR using foreach() and STRING_TO_INT 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | $v) 15 | print "k: $k, v: $v\n"; 16 | 17 | unset($judy); 18 | 19 | ?> 20 | --EXPECT-- 21 | Set 3 index 22 | k: one, v: 100 23 | k: three, v: 102 24 | k: two, v: 101 25 | -------------------------------------------------------------------------------- /extensions/PHP7/judy/tests/judy_foreach_string_to_mixed.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Check for Judy ITERATOR using foreach() and STRING_TO_MIXED 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | $v) 15 | print "k: $k, v: $v\n"; 16 | 17 | unset($judy); 18 | 19 | ?> 20 | --EXPECT-- 21 | Set 3 index 22 | k: one, v: 100 23 | k: three, v: 102 24 | k: two, v: AAA 25 | -------------------------------------------------------------------------------- /extensions/PHP7/judy/tests/judy_type.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Check for Judy TYPES using Judy::getType and judy_type() 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | getType() === judy_type($judy) && 9 | $judy->getType() === Judy::BITSET) { 10 | echo "Judy BITSET type OK\n"; 11 | } else { 12 | echo "Judy BITSET type check fail\n"; 13 | } 14 | unset($judy); 15 | 16 | $judy = new Judy(Judy::INT_TO_INT); 17 | if ($judy->getType() === judy_type($judy) && 18 | $judy->getType() === Judy::INT_TO_INT) { 19 | echo "Judy INT_TO_INT type OK\n"; 20 | } else { 21 | echo "Judy INT_TO_INT type check fail\n"; 22 | } 23 | unset($judy); 24 | 25 | $judy = new Judy(Judy::INT_TO_MIXED); 26 | if ($judy->getType() === judy_type($judy) && 27 | $judy->getType() === Judy::INT_TO_MIXED) { 28 | echo "Judy INT_TO_MIXED type OK\n"; 29 | } else { 30 | echo "Judy INT_TO_MIXED type check fail\n"; 31 | } 32 | unset($judy); 33 | 34 | $judy = new Judy(Judy::STRING_TO_INT); 35 | if ($judy->getType() === judy_type($judy) && 36 | $judy->getType() === Judy::STRING_TO_INT) { 37 | echo "Judy STRING_TO_INT type OK\n"; 38 | } else { 39 | echo "Judy STRING_TO_INT type check fail\n"; 40 | } 41 | unset($judy); 42 | 43 | $judy = new Judy(Judy::STRING_TO_MIXED); 44 | if ($judy->getType() === judy_type($judy) && 45 | $judy->getType() === Judy::STRING_TO_MIXED) { 46 | echo "Judy STRING_TO_MIXED type OK\n"; 47 | } else { 48 | echo "Judy STRING_TO_MIXED type check fail\n"; 49 | } 50 | unset($judy); 51 | 52 | ?> 53 | --EXPECT-- 54 | Judy BITSET type OK 55 | Judy INT_TO_INT type OK 56 | Judy INT_TO_MIXED type OK 57 | Judy STRING_TO_INT type OK 58 | Judy STRING_TO_MIXED type OK 59 | -------------------------------------------------------------------------------- /extensions/PHP7/judy/tests/string_to_int_001.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Check for Judy STRING_TO_INT set/unset/get methods 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | 52 | --EXPECT-- 53 | Insert 100 index with a rand value 54 | Get 100 index 55 | Remove 100 index 56 | Get 100 index (should be empty) 57 | Testing values are properly inserted and returned 58 | Done 59 | -------------------------------------------------------------------------------- /extensions/PHP7/judy/tests/string_to_int_002.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Check for Judy STRING_TO_INT free/size methods 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | size()."\n"; 22 | echo "Count Method: ".$judy->count()."\n"; 23 | echo "Count Function: ".count($judy)."\n"; 24 | 25 | unset($judy["50"]); 26 | if (!$judy["50"]) 27 | echo "Delete index 50\n"; 28 | 29 | echo "Size: ".$judy->size()."\n"; 30 | echo "Count Method: ".$judy->count()."\n"; 31 | echo "Count Function: ".count($judy)."\n"; 32 | 33 | // Free 34 | 35 | if (!$judy->free()) 36 | echo "Failed to free Judy array\n"; 37 | else 38 | echo "Freeing Judy array\n"; 39 | 40 | echo "Size: ".$judy->size()."\n"; 41 | 42 | echo "Done\n"; 43 | ?> 44 | --EXPECT-- 45 | Insert 100 index with a rand value 46 | Size: 100 47 | Count Method: 100 48 | Count Function: 100 49 | Delete index 50 50 | Size: 99 51 | Count Method: 99 52 | Count Function: 99 53 | Freeing Judy array 54 | Size: 0 55 | Done 56 | -------------------------------------------------------------------------------- /extensions/PHP7/judy/tests/string_to_int_003.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Check for Judy STRING_TO_INT first/next/last/prev methods 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | first(); 22 | echo "First index set: $firstIndexDefault\n"; 23 | 24 | $firstIndex50 = $judy->first("50"); 25 | echo "First index set from index 50: $firstIndex50\n"; 26 | 27 | // Last 28 | 29 | $lastIndexDefault = $judy->last(); 30 | echo "Last index set: $lastIndexDefault\n"; 31 | 32 | $lastIndex1000 = $judy->last("1000"); 33 | echo "Last index set from index 1000: $lastIndex1000\n"; 34 | 35 | // Next 36 | 37 | echo "Testing next()\n"; 38 | $index = $firstIndexDefault; 39 | while ($index < $lastIndexDefault) { 40 | $parent_index = $index; 41 | $index = $judy->next($parent_index); 42 | if ($index === null) { 43 | echo "Failed to get next index from parent index ($parent_index)\n"; 44 | break; 45 | } 46 | } 47 | 48 | // Prev 49 | 50 | echo "Testing prev()\n"; 51 | $index = $lastIndexDefault; 52 | while ($index > $firstIndexDefault) { 53 | $parent_index = $index; 54 | $index = $judy->prev($parent_index); 55 | if ($index === null) { 56 | echo "Failed to get previous index from parent index ($parent_index)\n"; 57 | break; 58 | } 59 | } 60 | 61 | echo "Done\n"; 62 | ?> 63 | --EXPECT-- 64 | Insert 100 index with a rand value 65 | First index set: 0 66 | First index set from index 50: 50 67 | Last index set: 99 68 | Last index set from index 1000: 10 69 | Testing next() 70 | Testing prev() 71 | Done 72 | -------------------------------------------------------------------------------- /extensions/PHP7/judy/tests/string_to_int_004.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Check for Judy STRING_TO_INT __clone() method 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | 22 | --EXPECT-- 23 | int(1) 24 | int(1) 25 | Clone OK 26 | Done 27 | -------------------------------------------------------------------------------- /extensions/PHP7/judy/tests/string_to_int_005.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Check for Judy STRING_TO_INT works with $a[] = $b (expect fatal error) 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | 12 | --EXPECTF-- 13 | Fatal error: main(): Judy STRING_TO_INT and STRING_TO_MIXED values cannot be set without key specifying in %s 14 | -------------------------------------------------------------------------------- /extensions/PHP7/judy/tests/string_to_mixed_001.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Check for Judy STRING_TO_MIXED set/unset/get methods 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | 52 | --EXPECT-- 53 | Insert 100 index with a rand value 54 | Get 100 index 55 | Remove 100 index 56 | Get 100 index (should be empty) 57 | Testing values are properly inserted and returned 58 | Done 59 | -------------------------------------------------------------------------------- /extensions/PHP7/judy/tests/string_to_mixed_002.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Check for Judy STRING_TO_MIXED free/size methods 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | size()."\n"; 22 | echo "Count Method: ".$judy->count()."\n"; 23 | echo "Count Function: ".count($judy)."\n"; 24 | 25 | unset($judy["50"]); 26 | if (!$judy["50"]) 27 | echo "Delete index 50\n"; 28 | 29 | echo "Size: ".$judy->size()."\n"; 30 | echo "Count Method: ".$judy->count()."\n"; 31 | echo "Count Function: ".count($judy)."\n"; 32 | 33 | // Free 34 | 35 | if (!$judy->free()) 36 | echo "Failed to free Judy array\n"; 37 | else 38 | echo "Freeing Judy array\n"; 39 | 40 | echo "Size: ".$judy->size()."\n"; 41 | 42 | echo "Done\n"; 43 | ?> 44 | --EXPECT-- 45 | Insert 100 index with a rand value 46 | Size: 100 47 | Count Method: 100 48 | Count Function: 100 49 | Delete index 50 50 | Size: 99 51 | Count Method: 99 52 | Count Function: 99 53 | Freeing Judy array 54 | Size: 0 55 | Done 56 | -------------------------------------------------------------------------------- /extensions/PHP7/judy/tests/string_to_mixed_003.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Check for Judy STRING_TO_MIXED first/next/last/prev methods 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | first(); 22 | echo "First index set: $firstIndexDefault\n"; 23 | 24 | $firstIndex50 = $judy->first("50"); 25 | echo "First index set from index 50: $firstIndex50\n"; 26 | 27 | // Last 28 | 29 | $lastIndexDefault = $judy->last(); 30 | echo "Last index set: $lastIndexDefault\n"; 31 | 32 | $lastIndex1000 = $judy->last("1000"); 33 | echo "Last index set from index 1000: $lastIndex1000\n"; 34 | 35 | // Next 36 | 37 | echo "Testing next()\n"; 38 | $index = $firstIndexDefault; 39 | while ($index < $lastIndexDefault) { 40 | $parent_index = $index; 41 | $index = $judy->next($parent_index); 42 | if ($index === null) { 43 | echo "Failed to get next index from parent index ($parent_index)\n"; 44 | break; 45 | } 46 | } 47 | 48 | // Prev 49 | 50 | echo "Testing prev()\n"; 51 | $index = $lastIndexDefault; 52 | while ($index > $firstIndexDefault) { 53 | $parent_index = $index; 54 | $index = $judy->prev($parent_index); 55 | if ($index === null) { 56 | echo "Failed to get previous index from parent index ($parent_index)\n"; 57 | break; 58 | } 59 | } 60 | 61 | echo "Done\n"; 62 | ?> 63 | --EXPECT-- 64 | Insert 100 index with a rand value 65 | First index set: 0 66 | First index set from index 50: 50 67 | Last index set: 99 68 | Last index set from index 1000: 10 69 | Testing next() 70 | Testing prev() 71 | Done 72 | -------------------------------------------------------------------------------- /extensions/PHP7/judy/tests/string_to_mixed_004.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Check for Judy STRING_TO_MIXED __clone() method 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | 22 | --EXPECT-- 23 | string(7) "myvalue" 24 | string(7) "myvalue" 25 | Clone OK 26 | Done 27 | -------------------------------------------------------------------------------- /extensions/PHP7/judy/tests/string_to_mixed_005.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Check for Judy STRING_TO_MIXED works with $a[] = $b (expect fatal error) 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | 12 | --EXPECTF-- 13 | Fatal error: main(): Judy STRING_TO_INT and STRING_TO_MIXED values cannot be set without key specifying in %s 14 | -------------------------------------------------------------------------------- /extensions/PHP7/judy/tests/strings_as_keys.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | strings as keys in Judy 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | $val) { 18 | var_dump($key, $val); 19 | } 20 | 21 | echo "INT_TO_INT\n"; 22 | $a = new Judy(Judy::INT_TO_INT); 23 | $a[""] = 1; 24 | $a["test"] = 1; 25 | $a["012"] = 1; 26 | $a["789"] = 1; 27 | $a["-1"] = 1; 28 | 29 | foreach($a as $key=>$val) { 30 | var_dump($key, $val); 31 | } 32 | 33 | echo "INT_TO_MIXED\n"; 34 | $a = new Judy(Judy::INT_TO_MIXED); 35 | $a[""] = 1; 36 | $a["test"] = 1; 37 | $a["012"] = 1; 38 | $a["789"] = 1; 39 | $a["-1"] = 1; 40 | 41 | foreach($a as $key=>$val) { 42 | var_dump($key, $val); 43 | } 44 | 45 | echo "STRING_TO_MIXED\n"; 46 | $a = new Judy(Judy::STRING_TO_MIXED); 47 | $a[""] = 1; 48 | $a["test"] = 1; 49 | $a["012"] = 1; 50 | $a["789"] = 1; 51 | $a["-1"] = 1; 52 | 53 | foreach($a as $key=>$val) { 54 | var_dump($key, $val); 55 | } 56 | 57 | ?> 58 | --EXPECTF-- 59 | BITSET 60 | int(0) 61 | bool(true) 62 | int(12) 63 | bool(true) 64 | int(789) 65 | bool(true) 66 | int(790) 67 | bool(true) 68 | INT_TO_INT 69 | int(0) 70 | int(1) 71 | int(12) 72 | int(1) 73 | int(789) 74 | int(1) 75 | int(790) 76 | int(1) 77 | INT_TO_MIXED 78 | int(0) 79 | int(1) 80 | int(12) 81 | int(1) 82 | int(789) 83 | int(1) 84 | int(790) 85 | int(1) 86 | STRING_TO_MIXED 87 | string(0) "" 88 | int(1) 89 | string(2) "-1" 90 | int(1) 91 | string(3) "012" 92 | int(1) 93 | string(3) "789" 94 | int(1) 95 | string(4) "test" 96 | int(1) 97 | -------------------------------------------------------------------------------- /extensions/PHP7/judy/tests/strings_as_values.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | strings as values in Judy 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | $val) { 15 | var_dump($key, $val); 16 | } 17 | 18 | echo "INT_TO_INT\n"; 19 | $a = new Judy(Judy::INT_TO_INT); 20 | $a[0] = "1"; 21 | $a[1] = "0"; 22 | $a[2] = "012"; 23 | $a[3] = "789"; 24 | $a[4] = "-5"; 25 | 26 | foreach($a as $key=>$val) { 27 | var_dump($key, $val); 28 | } 29 | 30 | echo "INT_TO_MIXED\n"; 31 | $a = new Judy(Judy::INT_TO_MIXED); 32 | $a[0] = "1"; 33 | $a[1] = "0"; 34 | $a[2] = "012"; 35 | $a[3] = "789"; 36 | $a[4] = "-5"; 37 | 38 | foreach($a as $key=>$val) { 39 | var_dump($key, $val); 40 | } 41 | 42 | echo "STRING_TO_MIXED\n"; 43 | $a = new Judy(Judy::STRING_TO_MIXED); 44 | $a[0] = "1"; 45 | $a[1] = "0"; 46 | $a[2] = "012"; 47 | $a[3] = "789"; 48 | $a[4] = "-5"; 49 | 50 | foreach($a as $key=>$val) { 51 | var_dump($key, $val); 52 | } 53 | 54 | ?> 55 | --EXPECTF-- 56 | BITSET 57 | int(1) 58 | bool(true) 59 | INT_TO_INT 60 | int(0) 61 | int(1) 62 | int(1) 63 | int(0) 64 | int(2) 65 | int(12) 66 | int(3) 67 | int(789) 68 | int(4) 69 | int(-5) 70 | INT_TO_MIXED 71 | int(0) 72 | string(1) "1" 73 | int(1) 74 | string(1) "0" 75 | int(2) 76 | string(3) "012" 77 | int(3) 78 | string(3) "789" 79 | int(4) 80 | string(2) "-5" 81 | STRING_TO_MIXED 82 | string(1) "0" 83 | string(1) "1" 84 | string(1) "1" 85 | string(1) "0" 86 | string(1) "2" 87 | string(3) "012" 88 | string(1) "3" 89 | string(3) "789" 90 | string(1) "4" 91 | string(2) "-5" 92 | -------------------------------------------------------------------------------- /extensions/PHP7/xxhash/.gitignore: -------------------------------------------------------------------------------- 1 | .deps 2 | .libs 3 | Makefile 4 | Makefile.fragments 5 | Makefile.global 6 | Makefile.objects 7 | acinclude.m4 8 | aclocal.m4 9 | autom4te.cache 10 | build 11 | config.guess 12 | config.h 13 | config.h.in* 14 | config.log 15 | config.nice 16 | config.status 17 | config.sub 18 | configure 19 | configure.in 20 | *.la 21 | *.lo 22 | install-sh 23 | libtool 24 | ltmain.sh 25 | missing 26 | mkinstalldirs 27 | modules 28 | run-tests.php -------------------------------------------------------------------------------- /extensions/PHP7/xxhash/README.md: -------------------------------------------------------------------------------- 1 | # php-xxhash 2 | 3 | PHP extension to add support for the [xxhash - r42](https://github.com/Cyan4973/xxHash) extremely fast hashing algorithm. _xxhash_ is designed to be fast enough to use in real-time streaming applications. 4 | 5 | 6 | ## How To Install 7 | 8 | ``` 9 | phpize 10 | ./configure --enable-xxhash 11 | make 12 | sudo make install 13 | ``` 14 | 15 | ## How To Use 16 | 17 | This extension adds three new PHP functions: 18 | 19 | ``` 20 | // 32 bit version (all values are positive) 21 | int xxhash32(string $data); 22 | 23 | // 64 bit version (can return negative values since PHP doesn't support unsigned long values) 24 | long xxhash64(string $data); 25 | 26 | // 64 bit version (all values are positive but returned as strings) 27 | string xxhash64Unsigned(string $data); 28 | ``` 29 | 30 | They will checksum the string, and return the checksum. 31 | 32 | ## License 33 | 34 | BSD 2-clause license. -------------------------------------------------------------------------------- /extensions/PHP7/xxhash/config.m4: -------------------------------------------------------------------------------- 1 | dnl $Id$ 2 | dnl config.m4 for extension xxhash 3 | 4 | dnl Comments in this file start with the string 'dnl'. 5 | dnl Remove where necessary. This file will not work 6 | dnl without editing. 7 | 8 | dnl If your extension references something external, use with: 9 | 10 | dnl PHP_ARG_WITH(xxhash, for xxhash support, 11 | dnl Make sure that the comment is aligned: 12 | dnl [ --with-xxhash Include xxhash support]) 13 | 14 | dnl Otherwise use enable: 15 | 16 | PHP_ARG_ENABLE(xxhash, whether to enable xxhash support, 17 | dnl Make sure that the comment is aligned: 18 | [ --enable-xxhash Enable xxhash support]) 19 | 20 | if test "$PHP_XXHASH" != "no"; then 21 | dnl Write more examples of tests here... 22 | 23 | PHP_NEW_EXTENSION(xxhash, php_xxhash.c, $ext_shared) 24 | fi 25 | -------------------------------------------------------------------------------- /extensions/PHP7/xxhash/config.w32: -------------------------------------------------------------------------------- 1 | // $Id$ 2 | // vim:ft=javascript 3 | 4 | // If your extension references something external, use ARG_WITH 5 | // ARG_WITH("xxhash", "for xxhash support", "no"); 6 | 7 | // Otherwise, use ARG_ENABLE 8 | // ARG_ENABLE("xxhash", "enable xxhash support", "no"); 9 | 10 | if (PHP_XXHASH != "no") { 11 | EXTENSION("xxhash", "php_xxhash.c"); 12 | } 13 | 14 | -------------------------------------------------------------------------------- /extensions/PHP7/xxhash/php_xxhash.h: -------------------------------------------------------------------------------- 1 | #ifndef PHP_XXHASH_H 2 | #define PHP_XXHASH_H 3 | 4 | #define PHP_XXHASH_VERSION "1.0.1" 5 | 6 | extern zend_module_entry xxhash_module_entry; 7 | #define phpext_xxhash_ptr &xxhash_module_entry 8 | 9 | #if defined(PHP_WIN32) && defined(XXHASH_EXPORTS) 10 | #define PHP_XXHASH_API __declspec(dllexport) 11 | #else 12 | #define PHP_XXHASH_API PHPAPI 13 | #endif 14 | 15 | #ifdef ZTS 16 | #include "TSRM.h" 17 | #endif 18 | 19 | PHP_MINIT_FUNCTION(xxhash); 20 | PHP_MSHUTDOWN_FUNCTION(xxhash); 21 | PHP_RINIT_FUNCTION(xxhash); 22 | PHP_RSHUTDOWN_FUNCTION(xxhash); 23 | PHP_MINFO_FUNCTION(xxhash); 24 | 25 | PHP_FUNCTION(xxhash32); 26 | PHP_FUNCTION(xxhash64); 27 | PHP_FUNCTION(xxhash64Unsigned); 28 | 29 | #endif /* PHP_XXHASH_H */ 30 | 31 | -------------------------------------------------------------------------------- /scripts/book.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | 3 | import chess 4 | import chess.polyglot 5 | 6 | def move_to_polyglot_int(board, move): 7 | to_square = move.to_square 8 | from_square = move.from_square 9 | # Polyglot encodes castling moves with the from_square being where the king started 10 | # and the to_square being where the rook started, instead of the UCI standard of the 11 | # to_square being where the king ends up. Patch up this encoding. 12 | if board.is_castling(move): 13 | to_square = { 14 | chess.G1: chess.H1, 15 | chess.C1: chess.A1, 16 | chess.G8: chess.H8, 17 | chess.C8: chess.A8, 18 | }[to_square] 19 | promotion = { 20 | None: 0, 21 | chess.KNIGHT: 1, 22 | chess.BISHOP: 2, 23 | chess.ROOK: 3, 24 | chess.QUEEN: 4, 25 | }[move.promotion] 26 | return to_square | (from_square << 6) | (promotion << 12) 27 | 28 | 29 | def make_entry(board, move, weight=1, learn=0): 30 | key = chess.polyglot.zobrist_hash(board) 31 | raw_move = move_to_polyglot_int(board, move) 32 | return chess.polyglot.Entry(key=key, raw_move=raw_move, weight=weight, learn=learn) 33 | 34 | 35 | def write_polyglot_bin(f, entries): 36 | entries = sorted(entries, key=lambda entry: entry.key) 37 | for entry in entries: 38 | f.write(chess.polyglot.ENTRY_STRUCT.pack(*entry)) 39 | 40 | if __name__ == "__main__": 41 | entries = [] 42 | with open("dump.txt", "rb") as f: 43 | while True: 44 | line = f.readline() 45 | if line is None or len(line) <= 2: 46 | break 47 | entry = line.decode("utf-8").split() 48 | board = chess.Board(entry[0] + " " + entry[1] + " " + entry[2] + " " + entry[3] + " 0 1") 49 | move = chess.Move.from_uci(entry[4]) 50 | weight = entry[5] 51 | entries.append(make_entry(board, move, int(weight))) 52 | with open("book.bin", "wb") as f: 53 | write_polyglot_bin(f, entries) 54 | -------------------------------------------------------------------------------- /web/file/auto.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/noobpwnftw/chessdb/0dbd2296097104694a0277027a45752a9f9a7999/web/file/auto.png -------------------------------------------------------------------------------- /web/file/ba.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/noobpwnftw/chessdb/0dbd2296097104694a0277027a45752a9f9a7999/web/file/ba.png -------------------------------------------------------------------------------- /web/file/bb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/noobpwnftw/chessdb/0dbd2296097104694a0277027a45752a9f9a7999/web/file/bb.png -------------------------------------------------------------------------------- /web/file/bc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/noobpwnftw/chessdb/0dbd2296097104694a0277027a45752a9f9a7999/web/file/bc.png -------------------------------------------------------------------------------- /web/file/bk.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/noobpwnftw/chessdb/0dbd2296097104694a0277027a45752a9f9a7999/web/file/bk.png -------------------------------------------------------------------------------- /web/file/bn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/noobpwnftw/chessdb/0dbd2296097104694a0277027a45752a9f9a7999/web/file/bn.png -------------------------------------------------------------------------------- /web/file/bp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/noobpwnftw/chessdb/0dbd2296097104694a0277027a45752a9f9a7999/web/file/bp.png -------------------------------------------------------------------------------- /web/file/br.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/noobpwnftw/chessdb/0dbd2296097104694a0277027a45752a9f9a7999/web/file/br.png -------------------------------------------------------------------------------- /web/file/bturn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/noobpwnftw/chessdb/0dbd2296097104694a0277027a45752a9f9a7999/web/file/bturn.png -------------------------------------------------------------------------------- /web/file/camera.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/noobpwnftw/chessdb/0dbd2296097104694a0277027a45752a9f9a7999/web/file/camera.png -------------------------------------------------------------------------------- /web/file/cap.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/noobpwnftw/chessdb/0dbd2296097104694a0277027a45752a9f9a7999/web/file/cap.gif -------------------------------------------------------------------------------- /web/file/chess/bb.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 8 | 10 | 12 | 13 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /web/file/chess/bk.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | 12 | 15 | 18 | 21 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /web/file/chess/bn.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8 | 11 | 14 | 18 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /web/file/chess/bp.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | -------------------------------------------------------------------------------- /web/file/chess/bq.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 15 | 18 | 21 | 24 | 27 | 30 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /web/file/chess/br.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8 | 11 | 14 | 17 | 20 | 23 | 26 | 29 | 32 | 35 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /web/file/chess/bturn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/noobpwnftw/chessdb/0dbd2296097104694a0277027a45752a9f9a7999/web/file/chess/bturn.png -------------------------------------------------------------------------------- /web/file/chess/cap.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/noobpwnftw/chessdb/0dbd2296097104694a0277027a45752a9f9a7999/web/file/chess/cap.gif -------------------------------------------------------------------------------- /web/file/chess/chess.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /web/file/chess/point.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/noobpwnftw/chessdb/0dbd2296097104694a0277027a45752a9f9a7999/web/file/chess/point.gif -------------------------------------------------------------------------------- /web/file/chess/select.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/noobpwnftw/chessdb/0dbd2296097104694a0277027a45752a9f9a7999/web/file/chess/select.gif -------------------------------------------------------------------------------- /web/file/chess/waypoint.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/noobpwnftw/chessdb/0dbd2296097104694a0277027a45752a9f9a7999/web/file/chess/waypoint.gif -------------------------------------------------------------------------------- /web/file/chess/wb.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 8 | 10 | 12 | 13 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /web/file/chess/wk.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8 | 11 | 14 | 17 | 20 | 23 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /web/file/chess/wn.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8 | 11 | 14 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /web/file/chess/wp.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | -------------------------------------------------------------------------------- /web/file/chess/wq.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8 | 11 | 14 | 17 | 20 | 23 | 26 | 29 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /web/file/chess/wr.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8 | 11 | 14 | 16 | 19 | 21 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /web/file/chess/wturn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/noobpwnftw/chessdb/0dbd2296097104694a0277027a45752a9f9a7999/web/file/chess/wturn.png -------------------------------------------------------------------------------- /web/file/del.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/noobpwnftw/chessdb/0dbd2296097104694a0277027a45752a9f9a7999/web/file/del.gif -------------------------------------------------------------------------------- /web/file/move.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/noobpwnftw/chessdb/0dbd2296097104694a0277027a45752a9f9a7999/web/file/move.gif -------------------------------------------------------------------------------- /web/file/oo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/noobpwnftw/chessdb/0dbd2296097104694a0277027a45752a9f9a7999/web/file/oo.gif -------------------------------------------------------------------------------- /web/file/ooo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/noobpwnftw/chessdb/0dbd2296097104694a0277027a45752a9f9a7999/web/file/ooo.gif -------------------------------------------------------------------------------- /web/file/point.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/noobpwnftw/chessdb/0dbd2296097104694a0277027a45752a9f9a7999/web/file/point.gif -------------------------------------------------------------------------------- /web/file/queue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/noobpwnftw/chessdb/0dbd2296097104694a0277027a45752a9f9a7999/web/file/queue.png -------------------------------------------------------------------------------- /web/file/refresh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/noobpwnftw/chessdb/0dbd2296097104694a0277027a45752a9f9a7999/web/file/refresh.png -------------------------------------------------------------------------------- /web/file/select.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/noobpwnftw/chessdb/0dbd2296097104694a0277027a45752a9f9a7999/web/file/select.gif -------------------------------------------------------------------------------- /web/file/sorttable.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/noobpwnftw/chessdb/0dbd2296097104694a0277027a45752a9f9a7999/web/file/sorttable.js -------------------------------------------------------------------------------- /web/file/wa.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/noobpwnftw/chessdb/0dbd2296097104694a0277027a45752a9f9a7999/web/file/wa.png -------------------------------------------------------------------------------- /web/file/waypoint.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/noobpwnftw/chessdb/0dbd2296097104694a0277027a45752a9f9a7999/web/file/waypoint.gif -------------------------------------------------------------------------------- /web/file/wb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/noobpwnftw/chessdb/0dbd2296097104694a0277027a45752a9f9a7999/web/file/wb.png -------------------------------------------------------------------------------- /web/file/wc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/noobpwnftw/chessdb/0dbd2296097104694a0277027a45752a9f9a7999/web/file/wc.png -------------------------------------------------------------------------------- /web/file/wk.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/noobpwnftw/chessdb/0dbd2296097104694a0277027a45752a9f9a7999/web/file/wk.png -------------------------------------------------------------------------------- /web/file/wn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/noobpwnftw/chessdb/0dbd2296097104694a0277027a45752a9f9a7999/web/file/wn.png -------------------------------------------------------------------------------- /web/file/wp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/noobpwnftw/chessdb/0dbd2296097104694a0277027a45752a9f9a7999/web/file/wp.png -------------------------------------------------------------------------------- /web/file/wr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/noobpwnftw/chessdb/0dbd2296097104694a0277027a45752a9f9a7999/web/file/wr.png -------------------------------------------------------------------------------- /web/file/wturn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/noobpwnftw/chessdb/0dbd2296097104694a0277027a45752a9f9a7999/web/file/wturn.png -------------------------------------------------------------------------------- /web/file/xiangqi.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/noobpwnftw/chessdb/0dbd2296097104694a0277027a45752a9f9a7999/web/file/xiangqi.gif -------------------------------------------------------------------------------- /web/index.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /workers/Client_Chess/ChessDBClient.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | VisualStudioVersion = 12.0.31101.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ChessDBClient", "ChessDBClient.csproj", "{5BE05F92-CE32-407C-A7CE-B6FC10A755B3}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {5BE05F92-CE32-407C-A7CE-B6FC10A755B3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {5BE05F92-CE32-407C-A7CE-B6FC10A755B3}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {5BE05F92-CE32-407C-A7CE-B6FC10A755B3}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {5BE05F92-CE32-407C-A7CE-B6FC10A755B3}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /workers/Client_Chess/ChessDotNet/CastlingType.cs: -------------------------------------------------------------------------------- 1 | namespace ChessDotNet 2 | { 3 | public enum CastlingType 4 | { 5 | None, 6 | KingSide, 7 | QueenSide 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /workers/Client_Chess/ChessDotNet/DetailedMove.cs: -------------------------------------------------------------------------------- 1 | namespace ChessDotNet 2 | { 3 | public class DetailedMove : Move 4 | { 5 | public Piece Piece 6 | { 7 | get; 8 | set; 9 | } 10 | 11 | public bool IsCapture 12 | { 13 | get; 14 | set; 15 | } 16 | 17 | public CastlingType Castling 18 | { 19 | get; 20 | set; 21 | } 22 | 23 | public string SAN 24 | { 25 | get; 26 | set; 27 | } 28 | 29 | protected DetailedMove() { } 30 | 31 | public DetailedMove(Position originalPosition, Position newPosition, Player player, char? promotion, Piece piece, bool isCapture, CastlingType castling, string san) : 32 | base(originalPosition, newPosition, player, promotion) 33 | { 34 | Piece = piece; 35 | IsCapture = isCapture; 36 | Castling = castling; 37 | SAN = san; 38 | } 39 | 40 | public DetailedMove(Move move, Piece piece, bool isCapture, CastlingType castling, string san) 41 | : this(move.OriginalPosition, move.NewPosition, move.Player, move.Promotion, piece, isCapture, castling, san) 42 | { 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /workers/Client_Chess/ChessDotNet/GameCreationData.cs: -------------------------------------------------------------------------------- 1 | namespace ChessDotNet 2 | { 3 | public class GameCreationData 4 | { 5 | public GameCreationData() 6 | { 7 | Moves = new DetailedMove[] {}; 8 | Resigned = Player.None; 9 | FullMoveNumber = 1; 10 | } 11 | public Piece[][] Board 12 | { 13 | get; 14 | set; 15 | } 16 | 17 | public DetailedMove[] Moves 18 | { 19 | get; 20 | set; 21 | } 22 | 23 | public bool DrawClaimed 24 | { 25 | get; 26 | set; 27 | } 28 | 29 | public string DrawReason 30 | { 31 | get; 32 | set; 33 | } 34 | 35 | public Player Resigned 36 | { 37 | get; 38 | set; 39 | } 40 | 41 | public Player WhoseTurn 42 | { 43 | get; 44 | set; 45 | } 46 | 47 | public bool CanWhiteCastleKingSide 48 | { 49 | get; 50 | set; 51 | } 52 | 53 | public bool CanWhiteCastleQueenSide 54 | { 55 | get; 56 | set; 57 | } 58 | 59 | public bool CanBlackCastleKingSide 60 | { 61 | get; 62 | set; 63 | } 64 | 65 | public bool CanBlackCastleQueenSide 66 | { 67 | get; 68 | set; 69 | } 70 | 71 | public Position EnPassant 72 | { 73 | get; 74 | set; 75 | } 76 | 77 | public int HalfMoveClock 78 | { 79 | get; 80 | set; 81 | } 82 | 83 | public int FullMoveNumber 84 | { 85 | get; 86 | set; 87 | } 88 | 89 | public int ThreeCheck_ChecksByWhite 90 | { 91 | get; 92 | set; 93 | } 94 | 95 | public int ThreeCheck_ChecksByBlack 96 | { 97 | get; 98 | set; 99 | } 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /workers/Client_Chess/ChessDotNet/MoveType.cs: -------------------------------------------------------------------------------- 1 | namespace ChessDotNet 2 | { 3 | [System.Flags] 4 | public enum MoveType 5 | { 6 | Invalid = 1, 7 | Move = 2, 8 | Capture = 4, 9 | Castling = 8, 10 | Promotion = 16 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /workers/Client_Chess/ChessDotNet/PgnException.cs: -------------------------------------------------------------------------------- 1 | namespace ChessDotNet 2 | { 3 | public class PgnException : System.Exception 4 | { 5 | public PgnException() { } 6 | public PgnException(string message) : base(message) { } 7 | public PgnException(string message, System.Exception inner) : base(message, inner) { } 8 | } 9 | } -------------------------------------------------------------------------------- /workers/Client_Chess/ChessDotNet/Piece.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.ObjectModel; 3 | 4 | namespace ChessDotNet 5 | { 6 | public abstract class Piece 7 | { 8 | public abstract Player Owner 9 | { 10 | get; 11 | set; 12 | } 13 | 14 | public abstract bool IsPromotionResult 15 | { 16 | get; 17 | set; 18 | } 19 | 20 | public abstract Piece GetWithInvertedOwner(); 21 | 22 | public abstract Piece AsPromotion(); 23 | 24 | public override bool Equals(object obj) 25 | { 26 | if (ReferenceEquals(this, obj)) 27 | return true; 28 | if (obj == null || GetType() != obj.GetType()) 29 | return false; 30 | Piece piece1 = this; 31 | Piece piece2 = (Piece)obj; 32 | return piece1.Owner == piece2.Owner; 33 | } 34 | 35 | public override int GetHashCode() 36 | { 37 | return new { Piece = GetFenCharacter(), Owner }.GetHashCode(); 38 | } 39 | 40 | public static bool operator ==(Piece piece1, Piece piece2) 41 | { 42 | if (ReferenceEquals(piece1, piece2)) 43 | return true; 44 | if ((object)piece1 == null || (object)piece2 == null) 45 | return false; 46 | return piece1.Equals(piece2); 47 | } 48 | 49 | public static bool operator !=(Piece piece1, Piece piece2) 50 | { 51 | if (ReferenceEquals(piece1, piece2)) 52 | return false; 53 | if ((object)piece1 == null || (object)piece2 == null) 54 | return true; 55 | return !piece1.Equals(piece2); 56 | } 57 | 58 | public abstract char GetFenCharacter(); 59 | public abstract bool IsValidMove(Move move, ChessGame game); 60 | public abstract ReadOnlyCollection GetValidMoves(Position from, bool returnIfAny, ChessGame game, Func gameMoveValidator); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /workers/Client_Chess/ChessDotNet/Pieces/Queen.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using System.Collections.ObjectModel; 4 | 5 | namespace ChessDotNet.Pieces 6 | { 7 | public class Queen : Piece 8 | { 9 | public override Player Owner 10 | { 11 | get; 12 | set; 13 | } 14 | 15 | public override bool IsPromotionResult 16 | { 17 | get; 18 | set; 19 | } 20 | 21 | public Queen() : this(Player.None) {} 22 | 23 | public Queen(Player owner) 24 | { 25 | Owner = owner; 26 | IsPromotionResult = false; 27 | } 28 | 29 | public override Piece AsPromotion() 30 | { 31 | Queen copy = new Queen(Owner); 32 | copy.IsPromotionResult = true; 33 | return copy; 34 | } 35 | 36 | public override Piece GetWithInvertedOwner() 37 | { 38 | return new Queen(ChessUtilities.GetOpponentOf(Owner)); 39 | } 40 | 41 | public override char GetFenCharacter() 42 | { 43 | return Owner == Player.White ? 'Q' : 'q'; 44 | } 45 | 46 | public override bool IsValidMove(Move move, ChessGame game) 47 | { 48 | ChessUtilities.ThrowIfNull(move, "move"); 49 | ChessUtilities.ThrowIfNull(game, "game"); 50 | return new Bishop(Owner).IsValidMove(move, game) || new Rook(Owner).IsValidMove(move, game); 51 | } 52 | 53 | public override ReadOnlyCollection GetValidMoves(Position from, bool returnIfAny, ChessGame game, Func gameMoveValidator) 54 | { 55 | ChessUtilities.ThrowIfNull(from, "from"); 56 | ReadOnlyCollection horizontalVerticalMoves = new Rook(Owner).GetValidMoves(from, returnIfAny, game, gameMoveValidator); 57 | if (returnIfAny && horizontalVerticalMoves.Count > 0) 58 | return horizontalVerticalMoves; 59 | ReadOnlyCollection diagonalMoves = new Bishop(Owner).GetValidMoves(from, returnIfAny, game, gameMoveValidator); 60 | return new ReadOnlyCollection(horizontalVerticalMoves.Concat(diagonalMoves).ToList()); 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /workers/Client_Chess/ChessDotNet/Players.cs: -------------------------------------------------------------------------------- 1 | namespace ChessDotNet 2 | { 3 | public enum Player 4 | { 5 | Black, 6 | White, 7 | None 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /workers/Client_Chess/ChessDotNet/PositionDistance.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ChessDotNet 4 | { 5 | public struct PositionDistance 6 | { 7 | int _distanceX; 8 | public int DistanceX 9 | { 10 | get 11 | { 12 | return _distanceX; 13 | } 14 | } 15 | 16 | int _distanceY; 17 | public int DistanceY 18 | { 19 | get 20 | { 21 | return _distanceY; 22 | } 23 | } 24 | public PositionDistance(Position position1, Position position2) 25 | { 26 | if (position1 == null) 27 | throw new ArgumentNullException("position1"); 28 | if (position2 == null) 29 | throw new ArgumentNullException("position2"); 30 | _distanceX = Math.Abs((int)position1.File - (int)position2.File); 31 | _distanceY = Math.Abs((int)position1.Rank - (int)position2.Rank); 32 | } 33 | 34 | public override bool Equals(object obj) 35 | { 36 | if (obj == null || GetType() != obj.GetType()) 37 | return false; 38 | PositionDistance distance2 = (PositionDistance)obj; 39 | return DistanceX == distance2.DistanceX && DistanceY == distance2.DistanceY; 40 | } 41 | 42 | public override int GetHashCode() 43 | { 44 | return new { DistanceX, DistanceY }.GetHashCode(); 45 | } 46 | 47 | public static bool operator ==(PositionDistance distance1, PositionDistance distance2) 48 | { 49 | return distance1.Equals(distance2); 50 | } 51 | 52 | public static bool operator !=(PositionDistance distance1, PositionDistance distance2) 53 | { 54 | return !distance1.Equals(distance2); 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /workers/Client_Chess/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的常规信息通过以下 6 | // 特性集控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("ChessDBClient")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("ChessDBClient")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 使此程序集中的类型 18 | // 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, 19 | // 则将该类型上的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("80042e2d-893b-4bdf-86ac-7e68a9192606")] 24 | 25 | // 程序集的版本信息由下面四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 生成号 30 | // 修订号 31 | // 32 | // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 33 | // 方法是按如下所示使用“*”: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /workers/Client_Chess/app.manifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /workers/Client_Xiangqi/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /workers/Client_Xiangqi/ChessDBClient.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | VisualStudioVersion = 12.0.31101.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ChessDBClient", "ChessDBClient.csproj", "{5BE05F92-CE32-407C-A7CE-B6FC10A755B3}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {5BE05F92-CE32-407C-A7CE-B6FC10A755B3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {5BE05F92-CE32-407C-A7CE-B6FC10A755B3}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {5BE05F92-CE32-407C-A7CE-B6FC10A755B3}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {5BE05F92-CE32-407C-A7CE-B6FC10A755B3}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /workers/Client_Xiangqi/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的常规信息通过以下 6 | // 特性集控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("ChessDBClient")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("ChessDBClient")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 使此程序集中的类型 18 | // 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, 19 | // 则将该类型上的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("80042e2d-893b-4bdf-86ac-7e68a9192606")] 24 | 25 | // 程序集的版本信息由下面四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 生成号 30 | // 修订号 31 | // 32 | // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 33 | // 方法是按如下所示使用“*”: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /workers/Client_Xiangqi/app.manifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /workers/Discover_Chess/ChessDBDiscover.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | VisualStudioVersion = 12.0.40629.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ChessDBDiscover", "ChessDBDiscover\ChessDBDiscover.csproj", "{FB4041DF-2662-4CC2-8410-018FDE293B3D}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {FB4041DF-2662-4CC2-8410-018FDE293B3D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {FB4041DF-2662-4CC2-8410-018FDE293B3D}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {FB4041DF-2662-4CC2-8410-018FDE293B3D}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {FB4041DF-2662-4CC2-8410-018FDE293B3D}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /workers/Discover_Chess/ChessDBDiscover/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /workers/Discover_Chess/ChessDBDiscover/ChessDotNet/CastlingType.cs: -------------------------------------------------------------------------------- 1 | namespace ChessDotNet 2 | { 3 | public enum CastlingType 4 | { 5 | None, 6 | KingSide, 7 | QueenSide 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /workers/Discover_Chess/ChessDBDiscover/ChessDotNet/DetailedMove.cs: -------------------------------------------------------------------------------- 1 | namespace ChessDotNet 2 | { 3 | public class DetailedMove : Move 4 | { 5 | public Piece Piece 6 | { 7 | get; 8 | set; 9 | } 10 | 11 | public bool IsCapture 12 | { 13 | get; 14 | set; 15 | } 16 | 17 | public CastlingType Castling 18 | { 19 | get; 20 | set; 21 | } 22 | 23 | public string SAN 24 | { 25 | get; 26 | set; 27 | } 28 | 29 | protected DetailedMove() { } 30 | 31 | public DetailedMove(Position originalPosition, Position newPosition, Player player, char? promotion, Piece piece, bool isCapture, CastlingType castling, string san) : 32 | base(originalPosition, newPosition, player, promotion) 33 | { 34 | Piece = piece; 35 | IsCapture = isCapture; 36 | Castling = castling; 37 | SAN = san; 38 | } 39 | 40 | public DetailedMove(Move move, Piece piece, bool isCapture, CastlingType castling, string san) 41 | : this(move.OriginalPosition, move.NewPosition, move.Player, move.Promotion, piece, isCapture, castling, san) 42 | { 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /workers/Discover_Chess/ChessDBDiscover/ChessDotNet/GameCreationData.cs: -------------------------------------------------------------------------------- 1 | namespace ChessDotNet 2 | { 3 | public class GameCreationData 4 | { 5 | public GameCreationData() 6 | { 7 | Moves = new DetailedMove[] {}; 8 | Resigned = Player.None; 9 | FullMoveNumber = 1; 10 | } 11 | public Piece[][] Board 12 | { 13 | get; 14 | set; 15 | } 16 | 17 | public DetailedMove[] Moves 18 | { 19 | get; 20 | set; 21 | } 22 | 23 | public bool DrawClaimed 24 | { 25 | get; 26 | set; 27 | } 28 | 29 | public string DrawReason 30 | { 31 | get; 32 | set; 33 | } 34 | 35 | public Player Resigned 36 | { 37 | get; 38 | set; 39 | } 40 | 41 | public Player WhoseTurn 42 | { 43 | get; 44 | set; 45 | } 46 | 47 | public bool CanWhiteCastleKingSide 48 | { 49 | get; 50 | set; 51 | } 52 | 53 | public bool CanWhiteCastleQueenSide 54 | { 55 | get; 56 | set; 57 | } 58 | 59 | public bool CanBlackCastleKingSide 60 | { 61 | get; 62 | set; 63 | } 64 | 65 | public bool CanBlackCastleQueenSide 66 | { 67 | get; 68 | set; 69 | } 70 | 71 | public Position EnPassant 72 | { 73 | get; 74 | set; 75 | } 76 | 77 | public int HalfMoveClock 78 | { 79 | get; 80 | set; 81 | } 82 | 83 | public int FullMoveNumber 84 | { 85 | get; 86 | set; 87 | } 88 | 89 | public int ThreeCheck_ChecksByWhite 90 | { 91 | get; 92 | set; 93 | } 94 | 95 | public int ThreeCheck_ChecksByBlack 96 | { 97 | get; 98 | set; 99 | } 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /workers/Discover_Chess/ChessDBDiscover/ChessDotNet/MoveType.cs: -------------------------------------------------------------------------------- 1 | namespace ChessDotNet 2 | { 3 | [System.Flags] 4 | public enum MoveType 5 | { 6 | Invalid = 1, 7 | Move = 2, 8 | Capture = 4, 9 | Castling = 8, 10 | Promotion = 16 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /workers/Discover_Chess/ChessDBDiscover/ChessDotNet/PgnException.cs: -------------------------------------------------------------------------------- 1 | namespace ChessDotNet 2 | { 3 | public class PgnException : System.Exception 4 | { 5 | public PgnException() { } 6 | public PgnException(string message) : base(message) { } 7 | public PgnException(string message, System.Exception inner) : base(message, inner) { } 8 | } 9 | } -------------------------------------------------------------------------------- /workers/Discover_Chess/ChessDBDiscover/ChessDotNet/Piece.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.ObjectModel; 3 | 4 | namespace ChessDotNet 5 | { 6 | public abstract class Piece 7 | { 8 | public abstract Player Owner 9 | { 10 | get; 11 | set; 12 | } 13 | 14 | public abstract bool IsPromotionResult 15 | { 16 | get; 17 | set; 18 | } 19 | 20 | public abstract Piece GetWithInvertedOwner(); 21 | 22 | public abstract Piece AsPromotion(); 23 | 24 | public override bool Equals(object obj) 25 | { 26 | if (ReferenceEquals(this, obj)) 27 | return true; 28 | if (obj == null || GetType() != obj.GetType()) 29 | return false; 30 | Piece piece1 = this; 31 | Piece piece2 = (Piece)obj; 32 | return piece1.Owner == piece2.Owner; 33 | } 34 | 35 | public override int GetHashCode() 36 | { 37 | return new { Piece = GetFenCharacter(), Owner }.GetHashCode(); 38 | } 39 | 40 | public static bool operator ==(Piece piece1, Piece piece2) 41 | { 42 | if (ReferenceEquals(piece1, piece2)) 43 | return true; 44 | if ((object)piece1 == null || (object)piece2 == null) 45 | return false; 46 | return piece1.Equals(piece2); 47 | } 48 | 49 | public static bool operator !=(Piece piece1, Piece piece2) 50 | { 51 | if (ReferenceEquals(piece1, piece2)) 52 | return false; 53 | if ((object)piece1 == null || (object)piece2 == null) 54 | return true; 55 | return !piece1.Equals(piece2); 56 | } 57 | 58 | public abstract char GetFenCharacter(); 59 | public abstract bool IsValidMove(Move move, ChessGame game); 60 | public abstract ReadOnlyCollection GetValidMoves(Position from, bool returnIfAny, ChessGame game, Func gameMoveValidator); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /workers/Discover_Chess/ChessDBDiscover/ChessDotNet/Pieces/Queen.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using System.Collections.ObjectModel; 4 | 5 | namespace ChessDotNet.Pieces 6 | { 7 | public class Queen : Piece 8 | { 9 | public override Player Owner 10 | { 11 | get; 12 | set; 13 | } 14 | 15 | public override bool IsPromotionResult 16 | { 17 | get; 18 | set; 19 | } 20 | 21 | public Queen() : this(Player.None) {} 22 | 23 | public Queen(Player owner) 24 | { 25 | Owner = owner; 26 | IsPromotionResult = false; 27 | } 28 | 29 | public override Piece AsPromotion() 30 | { 31 | Queen copy = new Queen(Owner); 32 | copy.IsPromotionResult = true; 33 | return copy; 34 | } 35 | 36 | public override Piece GetWithInvertedOwner() 37 | { 38 | return new Queen(ChessUtilities.GetOpponentOf(Owner)); 39 | } 40 | 41 | public override char GetFenCharacter() 42 | { 43 | return Owner == Player.White ? 'Q' : 'q'; 44 | } 45 | 46 | public override bool IsValidMove(Move move, ChessGame game) 47 | { 48 | ChessUtilities.ThrowIfNull(move, "move"); 49 | ChessUtilities.ThrowIfNull(game, "game"); 50 | return new Bishop(Owner).IsValidMove(move, game) || new Rook(Owner).IsValidMove(move, game); 51 | } 52 | 53 | public override ReadOnlyCollection GetValidMoves(Position from, bool returnIfAny, ChessGame game, Func gameMoveValidator) 54 | { 55 | ChessUtilities.ThrowIfNull(from, "from"); 56 | ReadOnlyCollection horizontalVerticalMoves = new Rook(Owner).GetValidMoves(from, returnIfAny, game, gameMoveValidator); 57 | if (returnIfAny && horizontalVerticalMoves.Count > 0) 58 | return horizontalVerticalMoves; 59 | ReadOnlyCollection diagonalMoves = new Bishop(Owner).GetValidMoves(from, returnIfAny, game, gameMoveValidator); 60 | return new ReadOnlyCollection(horizontalVerticalMoves.Concat(diagonalMoves).ToList()); 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /workers/Discover_Chess/ChessDBDiscover/ChessDotNet/Players.cs: -------------------------------------------------------------------------------- 1 | namespace ChessDotNet 2 | { 3 | public enum Player 4 | { 5 | Black, 6 | White, 7 | None 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /workers/Discover_Chess/ChessDBDiscover/ChessDotNet/PositionDistance.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ChessDotNet 4 | { 5 | public struct PositionDistance 6 | { 7 | int _distanceX; 8 | public int DistanceX 9 | { 10 | get 11 | { 12 | return _distanceX; 13 | } 14 | } 15 | 16 | int _distanceY; 17 | public int DistanceY 18 | { 19 | get 20 | { 21 | return _distanceY; 22 | } 23 | } 24 | public PositionDistance(Position position1, Position position2) 25 | { 26 | if (position1 == null) 27 | throw new ArgumentNullException("position1"); 28 | if (position2 == null) 29 | throw new ArgumentNullException("position2"); 30 | _distanceX = Math.Abs((int)position1.File - (int)position2.File); 31 | _distanceY = Math.Abs((int)position1.Rank - (int)position2.Rank); 32 | } 33 | 34 | public override bool Equals(object obj) 35 | { 36 | if (obj == null || GetType() != obj.GetType()) 37 | return false; 38 | PositionDistance distance2 = (PositionDistance)obj; 39 | return DistanceX == distance2.DistanceX && DistanceY == distance2.DistanceY; 40 | } 41 | 42 | public override int GetHashCode() 43 | { 44 | return new { DistanceX, DistanceY }.GetHashCode(); 45 | } 46 | 47 | public static bool operator ==(PositionDistance distance1, PositionDistance distance2) 48 | { 49 | return distance1.Equals(distance2); 50 | } 51 | 52 | public static bool operator !=(PositionDistance distance1, PositionDistance distance2) 53 | { 54 | return !distance1.Equals(distance2); 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /workers/Discover_Chess/ChessDBDiscover/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的常规信息通过以下 6 | // 特性集控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("ChessDBDiscover")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("ChessDBDiscover")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 使此程序集中的类型 18 | // 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, 19 | // 则将该类型上的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("6bcec192-3522-4d14-b6b9-882aea8ee763")] 24 | 25 | // 程序集的版本信息由下面四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 生成号 30 | // 修订号 31 | // 32 | // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 33 | // 方法是按如下所示使用“*”: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /workers/Discover_Xiangqi/ChessDBDiscover.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | VisualStudioVersion = 12.0.40629.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ChessDBDiscover", "ChessDBDiscover\ChessDBDiscover.csproj", "{FB4041DF-2662-4CC2-8410-018FDE293B3D}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {FB4041DF-2662-4CC2-8410-018FDE293B3D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {FB4041DF-2662-4CC2-8410-018FDE293B3D}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {FB4041DF-2662-4CC2-8410-018FDE293B3D}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {FB4041DF-2662-4CC2-8410-018FDE293B3D}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /workers/Discover_Xiangqi/ChessDBDiscover/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /workers/Discover_Xiangqi/ChessDBDiscover/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的常规信息通过以下 6 | // 特性集控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("ChessDBDiscover")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("ChessDBDiscover")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 使此程序集中的类型 18 | // 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, 19 | // 则将该类型上的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("6bcec192-3522-4d14-b6b9-882aea8ee763")] 24 | 25 | // 程序集的版本信息由下面四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 生成号 30 | // 修订号 31 | // 32 | // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 33 | // 方法是按如下所示使用“*”: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /workers/Sel_Chess/ChessDBSel.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | VisualStudioVersion = 12.0.40629.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ChessDBSel", "ChessDBSel\ChessDBSel.csproj", "{D45299A1-963B-444F-8E30-DCC7EAC6DC5E}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {D45299A1-963B-444F-8E30-DCC7EAC6DC5E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {D45299A1-963B-444F-8E30-DCC7EAC6DC5E}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {D45299A1-963B-444F-8E30-DCC7EAC6DC5E}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {D45299A1-963B-444F-8E30-DCC7EAC6DC5E}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /workers/Sel_Chess/ChessDBSel/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /workers/Sel_Chess/ChessDBSel/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的常规信息通过以下 6 | // 特性集控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("ChessDBSel")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("ChessDBSel")] 13 | [assembly: AssemblyCopyright("Copyright © 2017")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 使此程序集中的类型 18 | // 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, 19 | // 则将该类型上的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("a2c916f0-4472-46a9-bf4d-d1737d39d3ed")] 24 | 25 | // 程序集的版本信息由下面四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 生成号 30 | // 修订号 31 | // 32 | // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 33 | // 方法是按如下所示使用“*”: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /workers/Sel_Xiangqi/ChessDBSel.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | VisualStudioVersion = 12.0.40629.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ChessDBSel", "ChessDBSel\ChessDBSel.csproj", "{D45299A1-963B-444F-8E30-DCC7EAC6DC5E}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {D45299A1-963B-444F-8E30-DCC7EAC6DC5E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {D45299A1-963B-444F-8E30-DCC7EAC6DC5E}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {D45299A1-963B-444F-8E30-DCC7EAC6DC5E}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {D45299A1-963B-444F-8E30-DCC7EAC6DC5E}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /workers/Sel_Xiangqi/ChessDBSel/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /workers/Sel_Xiangqi/ChessDBSel/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的常规信息通过以下 6 | // 特性集控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("ChessDBSel")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("ChessDBSel")] 13 | [assembly: AssemblyCopyright("Copyright © 2017")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 使此程序集中的类型 18 | // 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, 19 | // 则将该类型上的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("a2c916f0-4472-46a9-bf4d-d1737d39d3ed")] 24 | 25 | // 程序集的版本信息由下面四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 生成号 30 | // 修订号 31 | // 32 | // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 33 | // 方法是按如下所示使用“*”: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | --------------------------------------------------------------------------------