diff --git a/Scripts/game.pgn b/Scripts/game.pgn index d73d958..a3409e7 100644 --- a/Scripts/game.pgn +++ b/Scripts/game.pgn @@ -1,45 +1,59 @@ [Event "?"] [Site "?"] -[Date "2025.04.01"] +[Date "2025.09.04"] [Round "1"] [White "Eleanor-base"] [Black "Eleanor-dev"] [Result "1-0"] -[FEN "2r5/1k6/2p4p/4p3/3b1p1B/5B1P/2R5/7K b - - 0 1"] -[GameDuration "00:00:05"] -[GameEndTime "2025-04-01T18:10:20.331 Central Europe Daylight Time"] -[GameStartTime "2025-04-01T18:10:14.365 Central Europe Daylight Time"] -[PlyCount "58"] +[FEN "rn1qk1nr/ppp2pRp/3bp3/3p4/3P4/2P2P1P/PP2PP2/RNBQKB2 b Qkq - 0 1"] +[GameDuration "00:01:31"] +[GameEndTime "2025-09-04T22:39:24.808 CEST"] +[GameStartTime "2025-09-04T22:37:53.089 CEST"] +[PlyCount "84"] [SetUp "1"] [Termination "abandoned"] -[TimeControl "2.53+0.03"] +[TimeControl "37.56+0.38"] -1... Kb6 {-0.43 11/0 127 176492} 2. Kg2 {+0.45 10/0 117 182773} -Kb5 {-0.43 10/0 139 43190} 3. Bf2 {+0.48 10/0 94 154681} -Rg8+ {-0.41 10/0 104 181006} 4. Kf1 {+0.43 11/0 137 107880} -c5 {-0.42 11/0 114 186919} 5. Ke2 {+0.42 10/0 131 26558} -Rd8 {-0.31 11/0 126 178073} 6. Rd2 {+0.36 8/0 129 64726} -c4 {+0.11 11/0 124 101858} 7. Bxd4 {-0.11 11/0 86 135900} -Rxd4 {+0.10 11/0 124 121262} 8. Rxd4 {-0.01 13/0 117 207646} -exd4 {0.00 14/0 95 197856} 9. h4 {0.00 13/0 105 197264} -Kb4 {0.00 14/0 91 195163} 10. Kd2 {0.00 13/0 111 105382} -Kc5 {0.00 13/0 109 62420} 11. h5 {0.00 14/0 78 150612} Kb4 {0.00 16/0 79 181784} -12. Bd1 {0.00 15/0 86 193192} Kc5 {0.00 16/0 97 111839} -13. Kc2 {0.00 17/0 90 192373} Kb4 {0.00 17/0 95 120438} -14. Bf3 {0.00 17/0 76 176571} Kc5 {0.00 17/0 101 66844} -15. Ba8 {0.00 18/0 75 165249} Kb4 {0.00 18/0 86 198233} -16. Bf3 {0.00 18/0 77 183908} d3+ {+0.01 16/0 69 164278} -17. Kd2 {-0.03 16/0 81 145118} Kb3 {0.00 17/0 84 107987} -18. Be4 {0.00 16/0 61 125373} f3 {+0.09 17/0 75 163654} -19. Bxd3 {-0.01 16/0 86 109653} cxd3 {+0.57 18/0 55 140500} -20. Kxd3 {-0.97 22/0 73 227257} f2 {+0.98 22/0 71 204108} -21. Ke2 {-0.99 20/0 81 29772} Kc4 {+1.48 22/0 62 180691} -22. Kxf2 {-2.11 23/0 59 175088} Kd4 {+2.51 27/0 52 189697} -23. Kf3 {-3.34 26/0 62 187791} Ke5 {+2.50 32/0 48 167062} -24. Ke3 {-2.24 28/0 54 178563} Kf5 {+2.15 31/0 72 166014} -25. Kf3 {-2.22 32/0 52 188757} Kg5 {0.00 35/0 49 143292} -26. Ke4 {-2.09 32/0 62 209505} Kxh5 {0.00 39/0 48 159744} -27. Kf5 {-2.09 33/0 70 226933} Kh4 {0.00 52/0 46 161548} -28. Kf4 {0.00 37/0 51 178144} h5 {0.00 64/0 29 95868} -29. Kf3 {0.00 51/0 46 165319} Kh3 {0.00 64/0 15 14259} -30. Kf4 {0.00 52/0 64 186059, Black disconnects} 1-0 \ No newline at end of file +1... Ne7 {-1.65 14/26 1861 1544983} 2. Rg1 {+1.64 12/23 2087 934687} +c5 {-1.74 15/32 1565 1167061} 3. f4 {+1.61 13/27 2002 772197} +Nd7 {-1.59 15/31 1455 1090717} 4. e3 {+1.84 14/31 1753 1387350} +Qb6 {-1.65 14/31 1385 1273463} 5. a4 {+1.98 14/28 1505 1375155} +Qc7 {-2.11 14/29 1849 830961} 6. dxc5 {+1.98 15/30 1571 1101192} +Nxc5 {-2.16 15/34 1778 545375} 7. a5 {+1.90 14/29 1555 1021903} +a6 {-2.22 15/33 1706 667700} 8. Nd2 {+2.38 14/29 1267 922229} +O-O-O {-2.34 14/31 1641 580655} 9. b4 {+2.62 14/31 1463 975771} +Ne4 {-2.37 15/39 1336 932258} 10. Nxe4 {+2.55 13/31 1579 228776} +dxe4 {-2.85 15/31 1004 694847} 11. Bd2 {+3.02 13/30 1247 753167} +Ng6 {-2.40 14/35 1118 862794} 12. Qb1 {+2.40 12/26 1475 339681} +f5 {-1.97 13/31 1465 304169} 13. Qb3 {+2.25 12/34 957 597544} +Nh4 {-2.21 14/38 1409 432849} 14. Be2 {+2.30 13/35 1343 843064} +Nf3+ {-2.18 14/40 1355 318067} 15. Bxf3 {+2.49 14/39 1346 645681} +exf3 {-2.59 15/30 1115 864898} 16. O-O-O {+2.85 14/35 1297 425564} +Rhe8 {-2.11 13/34 1269 275858} 17. c4 {+2.35 13/30 1249 86929} +e5 {-1.53 14/40 1188 1007892} 18. Bc3 {+2.71 12/37 1207 154226} +exf4 {-0.71 13/45 1186 280646} 19. c5 {+0.71 13/34 883 618110} +Be5 {-0.52 13/65 1145 440206} 20. Rxd8+ {+0.56 13/36 861 757974} +Qxd8 {-0.55 15/56 1106 373775} 21. Bxe5 {+0.98 14/49 845 689690} +Rxe5 {-0.87 14/83 799 511973} 22. exf4 {+0.98 13/36 1092 370730} +Re2 {-0.87 13/89 751 367978} 23. Rg8 {+1.05 13/43 1056 334030} +Re8 {-0.87 13/79 1030 242199} 24. Rxe8 {+1.13 12/34 1023 141620} +Qxe8 {-0.87 13/41 998 22345} 25. Qd1 {+1.46 11/36 991 227470} +Qe4 {-0.89 12/59 968 192246} 26. Qd2 {+1.17 13/42 856 592181} +Qc4+ {-0.90 11/95 891 510827} 27. Kb2 {+1.46 12/38 937 154015} +h5 {-1.01 11/66 913 404234} 28. Qc3 {+1.38 13/37 909 437481} +Qe2+ {-0.73 10/76 886 55851} 29. Qc2 {+1.42 14/34 882 272787} +Qe4 {-1.19 10/49 860 32225} 30. Kb3 {+1.27 12/37 824 598253} +Qxf4 {-1.13 10/98 838 184366} 31. c6 {+1.24 12/51 734 627843} +Qe4 {-0.96 10/103 814 271816} 32. cxb7+ {+1.24 13/50 817 324130} +Kxb7 {-0.96 9/16 792 1604} 33. Qc3 {+1.24 14/30 796 171391} +Qd5+ {-1.20 8/35 772 15385} 34. Ka3 {+1.23 11/40 525 374116} +Qe4 {-1.25 8/85 752 9999} 35. Qd2 {+1.19 12/37 767 281732} +Kc7 {-1.09 10/65 733 175302} 36. Qb2 {+1.21 12/40 748 316739} +h4 {-1.09 7/48 715 39908} 37. Qc1+ {+1.19 11/38 529 523703} +Kd8 {-0.65 10/83 700 298167} 38. Qc3 {+1.26 12/49 723 322911} +Kd7 {-0.64 9/44 684 18906} 39. Qg7+ {+1.23 11/37 537 395773} +Kc8 {-1.04 8/14 667 847} 40. Qf7 {+1.23 11/45 572 501521} +Qd3+ {-1.04 7/81 653 28141} 41. Qb3 {+1.23 11/36 689 130089} +Qe2 {-1.28 8/54 639 10579} 42. Qc3+ {+1.08 11/38 581 477548} +Kd7 {-0.67 8/40 627 10552} 43. Qb2 {+1.08 11/33 663 104343, Black disconnects} +1-0 diff --git a/source/uci.cpp b/source/uci.cpp index 4704b2b..7945de5 100644 --- a/source/uci.cpp +++ b/source/uci.cpp @@ -48,35 +48,44 @@ static void ParsePosition(Board &board, std::string_view command, SEARCH::Search MOVEGEN::GenerateMoves(board); } -static int ReadParam(std::string param, std::string &command) { +static double ReadParam(const std::string& param, const std::string &command) { size_t pos = command.find(param); - if (pos != std::string::npos) { - pos += param.length() + 1; - bool isNegative = false; - std::string result = ""; + if (pos == std::string::npos) + return 0.0; - // Check for negative sign - if (pos < command.length() && command[pos] == '-') { - isNegative = true; - pos++; + pos += param.length() + 1; // skip "param " + std::string result; + + // optional sign + if (pos < command.length() && (command[pos] == '-' || command[pos] == '+')) { + result += command[pos]; + pos++; + } + + // digits and optional decimal point + bool decimalSeen = false; + while (pos < command.length() && (std::isdigit(command[pos]) || command[pos] == '.')) { + if (command[pos] == '.') { + if (decimalSeen) break; // only one decimal point + decimalSeen = true; } + result += command[pos++]; + } - // Extract digits - while (pos < command.length() && std::isdigit(command[pos])) { - result += command[pos]; - pos++; - } - - // Ensure result is not empty before calling stoi - if (!result.empty()) { - int value = std::stoi(result); - return isNegative ? -value : value; + if (!result.empty()) { + try { + return std::stod(result); + } catch (const std::out_of_range&) { + return (result[0] == '-') ? -1e308 : 1e308; // clamp to double range + } catch (const std::invalid_argument&) { + return 0.0; } } - return 0; + return 0.0; } + #ifdef _WIN32 // Windows implementation using std::thread template @@ -169,7 +178,9 @@ static void SetOption(std::string& command, SEARCH::SearchContext* ctx) { name.erase(0, name.find_first_not_of(' ')); name.erase(name.find_last_not_of(' ') + 1); - int rawValue = ReadParam("value", command); + double rawValue = ReadParam("value", command); + + std::cout << rawValue << std::endl; #define X_DOUBLE(paramName, default_val, min_val, max_val, step_val) \ if (name == #paramName) { \