From 33b8150958c5012d7c2a6998259c54232590db1e Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 18 Nov 2025 22:04:41 +0000 Subject: [PATCH] Docs: Update Gemini benchmark results --- results.json | 381 ++++++++++++------ .../gemini-3-pro-preview TEMP_0.1.js | 2 +- .../gemini-3-pro-preview TEMP_0.2.js | 10 +- .../gemini-3-pro-preview TEMP_0.3.js | 2 +- .../gemini-3-pro-preview TEMP_0.4.js | 10 +- .../gemini-3-pro-preview TEMP_0.5.js | 4 +- .../gemini-3-pro-preview TEMP_0.6.js | 10 +- .../gemini-3-pro-preview TEMP_0.7.js | 12 +- .../gemini-3-pro-preview TEMP_0.8.js | 6 +- .../gemini-3-pro-preview TEMP_0.9.js | 10 +- .../gemini-3-pro-preview TEMP_1.1.js | 6 +- .../gemini-3-pro-preview TEMP_1.2.js | 7 + .../gemini-3-pro-preview TEMP_1.3.js | 7 + .../gemini-3-pro-preview TEMP_1.4.js | 9 + .../gemini-3-pro-preview TEMP_1.5.js | 7 + .../gemini-3-pro-preview TEMP_1.6.js | 7 + .../gemini-3-pro-preview TEMP_1.7.js | 7 + .../gemini-3-pro-preview TEMP_1.8.js | 11 + .../gemini-3-pro-preview TEMP_1.9.js | 7 + .../gemini-3-pro-preview TEMP_1.js | 4 +- .../gemini-3-pro-preview TEMP_2.js | 7 + .../gemini-3-pro-preview TEMP_0.1.js | 14 +- .../gemini-3-pro-preview TEMP_0.2.js | 19 +- .../gemini-3-pro-preview TEMP_0.3.js | 14 +- .../gemini-3-pro-preview TEMP_0.4.js | 3 +- .../gemini-3-pro-preview TEMP_0.5.js | 13 +- .../gemini-3-pro-preview TEMP_0.6.js | 14 +- .../gemini-3-pro-preview TEMP_0.7.js | 13 +- .../gemini-3-pro-preview TEMP_0.8.js | 13 +- .../gemini-3-pro-preview TEMP_0.9.js | 12 +- .../gemini-3-pro-preview TEMP_1.1.js | 17 +- .../gemini-3-pro-preview TEMP_1.2.js | 12 + .../gemini-3-pro-preview TEMP_1.3.js | 11 + .../gemini-3-pro-preview TEMP_1.4.js | 13 + .../gemini-3-pro-preview TEMP_1.5.js | 13 + .../gemini-3-pro-preview TEMP_1.6.js | 9 + .../gemini-3-pro-preview TEMP_1.7.js | 11 + .../gemini-3-pro-preview TEMP_1.8.js | 11 + .../gemini-3-pro-preview TEMP_1.9.js | 12 + .../gemini-3-pro-preview TEMP_1.js | 17 +- .../gemini-3-pro-preview TEMP_2.js | 9 + .../gemini-3-pro-preview TEMP_0.1.js | 16 +- .../gemini-3-pro-preview TEMP_0.2.js | 28 +- .../gemini-3-pro-preview TEMP_0.3.js | 39 +- .../gemini-3-pro-preview TEMP_0.4.js | 19 +- .../gemini-3-pro-preview TEMP_0.5.js | 15 +- .../gemini-3-pro-preview TEMP_0.6.js | 23 +- .../gemini-3-pro-preview TEMP_0.7.js | 24 +- .../gemini-3-pro-preview TEMP_0.8.js | 29 +- .../gemini-3-pro-preview TEMP_0.9.js | 13 +- .../gemini-3-pro-preview TEMP_1.1.js | 30 +- .../gemini-3-pro-preview TEMP_1.2.js | 19 + .../gemini-3-pro-preview TEMP_1.3.js | 22 + .../gemini-3-pro-preview TEMP_1.4.js | 25 ++ .../gemini-3-pro-preview TEMP_1.5.js | 23 ++ .../gemini-3-pro-preview TEMP_1.6.js | 21 + .../gemini-3-pro-preview TEMP_1.7.js | 27 ++ .../gemini-3-pro-preview TEMP_1.8.js | 24 ++ .../gemini-3-pro-preview TEMP_1.9.js | 25 ++ .../gemini-3-pro-preview TEMP_1.js | 33 +- .../gemini-3-pro-preview TEMP_2.js | 25 ++ .../gemini-3-pro-preview TEMP_0.1.js | 38 +- .../gemini-3-pro-preview TEMP_0.2.js | 28 +- .../gemini-3-pro-preview TEMP_0.3.js | 33 +- .../gemini-3-pro-preview TEMP_0.4.js | 39 +- .../gemini-3-pro-preview TEMP_0.5.js | 38 +- .../gemini-3-pro-preview TEMP_0.6.js | 32 +- .../gemini-3-pro-preview TEMP_0.7.js | 39 +- .../gemini-3-pro-preview TEMP_0.8.js | 31 +- .../gemini-3-pro-preview TEMP_0.9.js | 31 +- .../gemini-3-pro-preview TEMP_1.1.js | 27 +- .../gemini-3-pro-preview TEMP_1.2.js | 17 + .../gemini-3-pro-preview TEMP_1.3.js | 28 ++ .../gemini-3-pro-preview TEMP_1.4.js | 22 + .../gemini-3-pro-preview TEMP_1.5.js | 23 ++ .../gemini-3-pro-preview TEMP_1.6.js | 23 ++ .../gemini-3-pro-preview TEMP_1.7.js | 19 + .../gemini-3-pro-preview TEMP_1.8.js | 18 + .../gemini-3-pro-preview TEMP_1.9.js | 17 + .../gemini-3-pro-preview TEMP_1.js | 42 +- .../gemini-3-pro-preview TEMP_2.js | 18 + .../gemini-3-pro-preview TEMP_0.1.js | 8 +- .../gemini-3-pro-preview TEMP_0.2.js | 10 +- .../gemini-3-pro-preview TEMP_0.3.js | 10 +- .../gemini-3-pro-preview TEMP_0.4.js | 2 +- .../gemini-3-pro-preview TEMP_0.5.js | 10 +- .../gemini-3-pro-preview TEMP_0.6.js | 8 +- .../gemini-3-pro-preview TEMP_0.7.js | 12 +- .../gemini-3-pro-preview TEMP_0.8.js | 10 +- .../gemini-3-pro-preview TEMP_0.9.js | 10 +- .../gemini-3-pro-preview TEMP_1.1.js | 9 +- .../gemini-3-pro-preview TEMP_1.2.js | 7 + .../gemini-3-pro-preview TEMP_1.3.js | 10 + .../gemini-3-pro-preview TEMP_1.4.js | 10 + .../gemini-3-pro-preview TEMP_1.5.js | 7 + .../gemini-3-pro-preview TEMP_1.6.js | 9 + .../gemini-3-pro-preview TEMP_1.7.js | 7 + .../gemini-3-pro-preview TEMP_1.8.js | 7 + .../gemini-3-pro-preview TEMP_1.9.js | 9 + .../gemini-3-pro-preview TEMP_1.js | 12 +- .../gemini-3-pro-preview TEMP_2.js | 9 + .../gemini-3-pro-preview TEMP_0.1.js | 7 +- .../gemini-3-pro-preview TEMP_0.2.js | 4 +- .../gemini-3-pro-preview TEMP_0.3.js | 7 +- .../gemini-3-pro-preview TEMP_0.4.js | 7 +- .../gemini-3-pro-preview TEMP_0.6.js | 2 +- .../gemini-3-pro-preview TEMP_0.7.js | 2 +- .../gemini-3-pro-preview TEMP_0.8.js | 2 +- .../gemini-3-pro-preview TEMP_0.9.js | 2 +- .../gemini-3-pro-preview TEMP_1.1.js | 2 +- .../gemini-3-pro-preview TEMP_1.2.js | 5 + .../gemini-3-pro-preview TEMP_1.3.js | 5 + .../gemini-3-pro-preview TEMP_1.4.js | 5 + .../gemini-3-pro-preview TEMP_1.5.js | 5 + .../gemini-3-pro-preview TEMP_1.6.js | 5 + .../gemini-3-pro-preview TEMP_1.7.js | 5 + .../gemini-3-pro-preview TEMP_1.8.js | 4 + .../gemini-3-pro-preview TEMP_1.9.js | 5 + .../gemini-3-pro-preview TEMP_1.js | 2 +- .../gemini-3-pro-preview TEMP_2.js | 5 + .../gemini-3-pro-preview TEMP_0.1.js | 9 +- .../gemini-3-pro-preview TEMP_0.2.js | 8 +- .../gemini-3-pro-preview TEMP_0.3.js | 6 +- .../gemini-3-pro-preview TEMP_0.4.js | 8 +- .../gemini-3-pro-preview TEMP_0.5.js | 12 +- .../gemini-3-pro-preview TEMP_0.6.js | 8 +- .../gemini-3-pro-preview TEMP_0.7.js | 6 +- .../gemini-3-pro-preview TEMP_0.8.js | 8 +- .../gemini-3-pro-preview TEMP_0.9.js | 6 +- .../gemini-3-pro-preview TEMP_1.1.js | 12 +- .../gemini-3-pro-preview TEMP_1.2.js | 5 + .../gemini-3-pro-preview TEMP_1.3.js | 5 + .../gemini-3-pro-preview TEMP_1.4.js | 10 + .../gemini-3-pro-preview TEMP_1.5.js | 5 + .../gemini-3-pro-preview TEMP_1.6.js | 5 + .../gemini-3-pro-preview TEMP_1.7.js | 5 + .../gemini-3-pro-preview TEMP_1.8.js | 4 + .../gemini-3-pro-preview TEMP_1.9.js | 5 + .../gemini-3-pro-preview TEMP_1.js | 7 +- .../gemini-3-pro-preview TEMP_2.js | 5 + .../gemini-3-pro-preview TEMP_0.1.js | 34 +- .../gemini-3-pro-preview TEMP_0.2.js | 35 +- .../gemini-3-pro-preview TEMP_0.3.js | 33 +- .../gemini-3-pro-preview TEMP_0.4.js | 19 +- .../gemini-3-pro-preview TEMP_0.5.js | 31 +- .../gemini-3-pro-preview TEMP_0.6.js | 33 +- .../gemini-3-pro-preview TEMP_0.7.js | 31 +- .../gemini-3-pro-preview TEMP_0.8.js | 34 +- .../gemini-3-pro-preview TEMP_0.9.js | 32 +- .../gemini-3-pro-preview TEMP_1.1.js | 36 +- .../gemini-3-pro-preview TEMP_1.2.js | 20 + .../gemini-3-pro-preview TEMP_1.3.js | 23 ++ .../gemini-3-pro-preview TEMP_1.4.js | 17 + .../gemini-3-pro-preview TEMP_1.5.js | 19 + .../gemini-3-pro-preview TEMP_1.6.js | 19 + .../gemini-3-pro-preview TEMP_1.7.js | 18 + .../gemini-3-pro-preview TEMP_1.8.js | 22 + .../gemini-3-pro-preview TEMP_1.9.js | 18 + .../gemini-3-pro-preview TEMP_1.js | 23 +- .../gemini-3-pro-preview TEMP_2.js | 16 + .../gemini-3-pro-preview TEMP_0.1.js | 85 ++-- .../gemini-3-pro-preview TEMP_0.2.js | 52 +-- .../gemini-3-pro-preview TEMP_0.3.js | 79 ++-- .../gemini-3-pro-preview TEMP_0.4.js | 65 ++- .../gemini-3-pro-preview TEMP_0.5.js | 80 ++-- .../gemini-3-pro-preview TEMP_0.6.js | 70 ++-- .../gemini-3-pro-preview TEMP_0.7.js | 95 +++-- .../gemini-3-pro-preview TEMP_0.8.js | 76 ++-- .../gemini-3-pro-preview TEMP_0.9.js | 71 +--- .../gemini-3-pro-preview TEMP_1.1.js | 66 ++- .../gemini-3-pro-preview TEMP_1.2.js | 32 ++ .../gemini-3-pro-preview TEMP_1.3.js | 58 +++ .../gemini-3-pro-preview TEMP_1.4.js | 52 +++ .../gemini-3-pro-preview TEMP_1.5.js | 65 +++ .../gemini-3-pro-preview TEMP_1.6.js | 49 +++ .../gemini-3-pro-preview TEMP_1.7.js | 43 ++ .../gemini-3-pro-preview TEMP_1.8.js | 45 +++ .../gemini-3-pro-preview TEMP_1.9.js | 57 +++ .../gemini-3-pro-preview TEMP_1.js | 68 ++-- .../gemini-3-pro-preview TEMP_2.js | 50 +++ .../gemini-3-pro-preview TEMP_0.1.js | 19 +- .../gemini-3-pro-preview TEMP_0.2.js | 20 +- .../gemini-3-pro-preview TEMP_0.3.js | 16 +- .../gemini-3-pro-preview TEMP_0.4.js | 12 +- .../gemini-3-pro-preview TEMP_0.5.js | 7 +- .../gemini-3-pro-preview TEMP_0.6.js | 13 +- .../gemini-3-pro-preview TEMP_0.7.js | 12 +- .../gemini-3-pro-preview TEMP_0.8.js | 17 +- .../gemini-3-pro-preview TEMP_0.9.js | 20 +- .../gemini-3-pro-preview TEMP_1.1.js | 15 +- .../gemini-3-pro-preview TEMP_1.2.js | 10 + .../gemini-3-pro-preview TEMP_1.3.js | 7 + .../gemini-3-pro-preview TEMP_1.4.js | 7 + .../gemini-3-pro-preview TEMP_1.5.js | 10 + .../gemini-3-pro-preview TEMP_1.6.js | 14 + .../gemini-3-pro-preview TEMP_1.7.js | 6 + .../gemini-3-pro-preview TEMP_1.8.js | 10 + .../gemini-3-pro-preview TEMP_1.9.js | 10 + .../gemini-3-pro-preview TEMP_1.js | 8 +- .../gemini-3-pro-preview TEMP_2.js | 6 + .../gemini-3-pro-preview TEMP_0.1.js | 32 +- .../gemini-3-pro-preview TEMP_0.2.js | 24 +- .../gemini-3-pro-preview TEMP_0.3.js | 31 +- .../gemini-3-pro-preview TEMP_0.4.js | 32 +- .../gemini-3-pro-preview TEMP_0.5.js | 32 +- .../gemini-3-pro-preview TEMP_0.6.js | 32 +- .../gemini-3-pro-preview TEMP_0.7.js | 31 +- .../gemini-3-pro-preview TEMP_0.8.js | 14 +- .../gemini-3-pro-preview TEMP_0.9.js | 28 +- .../gemini-3-pro-preview TEMP_1.1.js | 16 +- .../gemini-3-pro-preview TEMP_1.2.js | 25 ++ .../gemini-3-pro-preview TEMP_1.3.js | 29 ++ .../gemini-3-pro-preview TEMP_1.4.js | 14 + .../gemini-3-pro-preview TEMP_1.5.js | 32 ++ .../gemini-3-pro-preview TEMP_1.6.js | 20 + .../gemini-3-pro-preview TEMP_1.7.js | 21 + .../gemini-3-pro-preview TEMP_1.8.js | 31 ++ .../gemini-3-pro-preview TEMP_1.9.js | 29 ++ .../gemini-3-pro-preview TEMP_1.js | 33 +- .../gemini-3-pro-preview TEMP_2.js | 22 + 220 files changed, 3259 insertions(+), 1494 deletions(-) create mode 100644 tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_1.2.js create mode 100644 tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_1.3.js create mode 100644 tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_1.4.js create mode 100644 tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_1.5.js create mode 100644 tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_1.6.js create mode 100644 tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_1.7.js create mode 100644 tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_1.8.js create mode 100644 tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_1.9.js create mode 100644 tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_2.js create mode 100644 tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_1.2.js create mode 100644 tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_1.3.js create mode 100644 tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_1.4.js create mode 100644 tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_1.5.js create mode 100644 tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_1.6.js create mode 100644 tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_1.7.js create mode 100644 tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_1.8.js create mode 100644 tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_1.9.js create mode 100644 tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_2.js create mode 100644 tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_1.2.js create mode 100644 tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_1.3.js create mode 100644 tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_1.4.js create mode 100644 tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_1.5.js create mode 100644 tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_1.6.js create mode 100644 tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_1.7.js create mode 100644 tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_1.8.js create mode 100644 tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_1.9.js create mode 100644 tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_2.js create mode 100644 tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_1.2.js create mode 100644 tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_1.3.js create mode 100644 tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_1.4.js create mode 100644 tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_1.5.js create mode 100644 tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_1.6.js create mode 100644 tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_1.7.js create mode 100644 tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_1.8.js create mode 100644 tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_1.9.js create mode 100644 tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_2.js create mode 100644 tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_1.2.js create mode 100644 tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_1.3.js create mode 100644 tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_1.4.js create mode 100644 tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_1.5.js create mode 100644 tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_1.6.js create mode 100644 tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_1.7.js create mode 100644 tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_1.8.js create mode 100644 tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_1.9.js create mode 100644 tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_2.js create mode 100644 tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_1.2.js create mode 100644 tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_1.3.js create mode 100644 tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_1.4.js create mode 100644 tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_1.5.js create mode 100644 tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_1.6.js create mode 100644 tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_1.7.js create mode 100644 tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_1.8.js create mode 100644 tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_1.9.js create mode 100644 tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_2.js create mode 100644 tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_1.2.js create mode 100644 tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_1.3.js create mode 100644 tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_1.4.js create mode 100644 tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_1.5.js create mode 100644 tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_1.6.js create mode 100644 tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_1.7.js create mode 100644 tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_1.8.js create mode 100644 tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_1.9.js create mode 100644 tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_2.js create mode 100644 tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_1.2.js create mode 100644 tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_1.3.js create mode 100644 tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_1.4.js create mode 100644 tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_1.5.js create mode 100644 tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_1.6.js create mode 100644 tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_1.7.js create mode 100644 tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_1.8.js create mode 100644 tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_1.9.js create mode 100644 tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_2.js create mode 100644 tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_1.2.js create mode 100644 tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_1.3.js create mode 100644 tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_1.4.js create mode 100644 tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_1.5.js create mode 100644 tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_1.6.js create mode 100644 tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_1.7.js create mode 100644 tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_1.8.js create mode 100644 tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_1.9.js create mode 100644 tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_2.js create mode 100644 tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_1.2.js create mode 100644 tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_1.3.js create mode 100644 tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_1.4.js create mode 100644 tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_1.5.js create mode 100644 tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_1.6.js create mode 100644 tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_1.7.js create mode 100644 tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_1.8.js create mode 100644 tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_1.9.js create mode 100644 tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_2.js create mode 100644 tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_1.2.js create mode 100644 tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_1.3.js create mode 100644 tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_1.4.js create mode 100644 tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_1.5.js create mode 100644 tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_1.6.js create mode 100644 tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_1.7.js create mode 100644 tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_1.8.js create mode 100644 tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_1.9.js create mode 100644 tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_2.js diff --git a/results.json b/results.json index ad0162a..9334ce0 100644 --- a/results.json +++ b/results.json @@ -78,159 +78,276 @@ "9_stream_visualizer": 28.426358369000255 }, "gemini-3-pro-preview TEMP:1.1": { - "10_scrypt_hash": 19.25561597, - "11_geospatial": 16.537793451, - "1_dijkstra": 19.709102094000002, - "2_convex_hull": 23.759404848, - "3_lis": 23.048148686, - "4_determinant": 20.935209288, - "5_markdown_parser": 34.398462477999985, - "6_csv_processor": 43.183913065, - "7_scheduler": 31.16975645300001, - "8_json_validator": 22.189696912000013, - "9_stream_visualizer": 27.786803166999977 + "10_scrypt_hash": 20.09197308799997, + "11_geospatial": 16.744538625000043, + "1_dijkstra": 20.368975195999724, + "2_convex_hull": 27.382338132999838, + "3_lis": 17.644244979000185, + "4_determinant": 16.541462185999844, + "5_markdown_parser": 24.495124363999814, + "6_csv_processor": 30.402239049999974, + "7_scheduler": 40.37338068899978, + "8_json_validator": 16.042334551000035, + "9_stream_visualizer": 20.290600096000357 }, "gemini-3-pro-preview TEMP:1": { - "10_scrypt_hash": 16.73660885900003, - "11_geospatial": 27.702141619000002, - "1_dijkstra": 24.343912240999984, - "2_convex_hull": 22.499538950000016, - "3_lis": 23.92277027799998, - "4_determinant": 19.12632760900003, - "5_markdown_parser": 24.235546227000015, - "6_csv_processor": 28.255928477999987, - "7_scheduler": 52.90334799400001, - "8_json_validator": 16.544846496000012, - "9_stream_visualizer": 28.031947036999977 + "10_scrypt_hash": 23.12222202300001, + "11_geospatial": 26.206914669000078, + "1_dijkstra": 26.885644016999752, + "2_convex_hull": 28.454881988000125, + "3_lis": 21.56611355999997, + "4_determinant": 12.317508710999974, + "5_markdown_parser": 42.852985185000115, + "6_csv_processor": 38.87679926400026, + "7_scheduler": 50.29471840999974, + "8_json_validator": 14.745134738999884, + "9_stream_visualizer": 25.84060898800008 }, "gemini-3-pro-preview TEMP:0.9": { - "10_scrypt_hash": 18.39214110999997, - "11_geospatial": 21.698826697999962, - "1_dijkstra": 31.32494983399997, - "2_convex_hull": 33.63882225600001, - "3_lis": 22.98625518599991, - "4_determinant": 9.706784340000013, - "5_markdown_parser": 25.077740615000017, - "6_csv_processor": 38.424850744000054, - "7_scheduler": 40.46733092999994, - "8_json_validator": 21.866049754999928, - "9_stream_visualizer": 29.938616987999993 + "10_scrypt_hash": 19.74835643199971, + "11_geospatial": 20.92234129700018, + "1_dijkstra": 23.868050303000025, + "2_convex_hull": 34.55523202600004, + "3_lis": 20.2101665719999, + "4_determinant": 39.270334673000036, + "5_markdown_parser": 33.19924508200027, + "6_csv_processor": 41.52472499500029, + "7_scheduler": 49.9266366109997, + "8_json_validator": 26.833344192000105, + "9_stream_visualizer": 21.42339840399986 }, "gemini-3-pro-preview TEMP:0.8": { - "10_scrypt_hash": 22.864061476000003, - "11_geospatial": 21.802520365000003, - "1_dijkstra": 25.727360443000098, - "2_convex_hull": 20.067116691999953, - "3_lis": 17.514798727000016, - "4_determinant": 26.222232214999966, - "5_markdown_parser": 27.822983316000084, - "6_csv_processor": 31.795846373000067, - "7_scheduler": 45.54547771500005, - "8_json_validator": 20.04490028099995, - "9_stream_visualizer": 31.52293631999986 + "10_scrypt_hash": 21.932031273999716, + "11_geospatial": 28.99488797000004, + "1_dijkstra": 26.922454760999884, + "2_convex_hull": 33.567102398000195, + "3_lis": 20.515141533999703, + "4_determinant": 21.268977479999887, + "5_markdown_parser": 40.8980531250001, + "6_csv_processor": 32.91058637899999, + "7_scheduler": 80.64269605799997, + "8_json_validator": 20.85698480999982, + "9_stream_visualizer": 37.75345811099932 }, "gemini-3-pro-preview TEMP:0.7": { - "10_scrypt_hash": 23.39639778, - "11_geospatial": 23.114445250999882, - "1_dijkstra": 24.20112610200001, - "2_convex_hull": 29.664885391999967, - "3_lis": 15.16884128500009, - "4_determinant": 36.34684787500021, - "5_markdown_parser": 27.07226724700001, - "6_csv_processor": 36.69383957000007, - "7_scheduler": 41.66182964499993, - "8_json_validator": 24.68038384200004, - "9_stream_visualizer": 32.811990770999806 + "10_scrypt_hash": 19.486387687000445, + "11_geospatial": 22.537344641000033, + "1_dijkstra": 24.757761477999388, + "2_convex_hull": 25.543014148999937, + "3_lis": 19.770237300000154, + "4_determinant": 22.60989380299952, + "5_markdown_parser": 42.83827392700035, + "6_csv_processor": 34.6238196200002, + "7_scheduler": 45.15323736399971, + "8_json_validator": 28.7569554270003, + "9_stream_visualizer": 25.663316451999357 }, "gemini-3-pro-preview TEMP:0.6": { - "10_scrypt_hash": 20.319240230000112, - "11_geospatial": 14.71396687299991, - "1_dijkstra": 29.94397802599985, - "2_convex_hull": 30.130152880999958, - "3_lis": 22.789678306000074, - "4_determinant": 13.336225186000112, - "5_markdown_parser": 26.61024377000006, - "6_csv_processor": 23.28925823200005, - "7_scheduler": 31.414080646000105, - "8_json_validator": 18.36662647700007, - "9_stream_visualizer": 31.141520149999998 + "10_scrypt_hash": 22.85184260199964, + "11_geospatial": 26.641837239999322, + "1_dijkstra": 22.808483874000608, + "2_convex_hull": 23.80214131500013, + "3_lis": 21.100967756000347, + "4_determinant": 10.740180964999832, + "5_markdown_parser": 36.143312074000015, + "6_csv_processor": 53.21065433599986, + "7_scheduler": 59.45305509700067, + "8_json_validator": 21.731487070000732, + "9_stream_visualizer": 29.278473306000233 }, "gemini-3-pro-preview TEMP:0.5": { - "10_scrypt_hash": 26.257502701000078, - "11_geospatial": 27.292514397000197, - "1_dijkstra": 26.930725388999797, - "2_convex_hull": 28.365386472000043, - "3_lis": 20.404020288000115, - "4_determinant": 19.956521905999864, - "5_markdown_parser": 41.075851207999975, - "6_csv_processor": 33.550666006000014, - "7_scheduler": 54.52258278499986, - "8_json_validator": 30.504760077999904, - "9_stream_visualizer": 25.344985834000166 + "10_scrypt_hash": 21.873170082999394, + "11_geospatial": 20.211224280000664, + "1_dijkstra": 26.509259402999653, + "2_convex_hull": 28.398400859000162, + "3_lis": 27.511312441000715, + "4_determinant": 9.919108345000073, + "5_markdown_parser": 33.96838048799988, + "6_csv_processor": 34.895041311000476, + "7_scheduler": 65.26757784599997, + "8_json_validator": 22.589250137999652, + "9_stream_visualizer": 28.14733931099996 }, "gemini-3-pro-preview TEMP:0.4": { - "10_scrypt_hash": 16.79715236100019, - "11_geospatial": 25.48661641700007, - "1_dijkstra": 17.67472643599985, - "2_convex_hull": 34.115073089000305, - "3_lis": 18.289524143000133, - "4_determinant": 22.224696940999944, - "5_markdown_parser": 53.21322759300005, - "6_csv_processor": 39.43421280799993, - "7_scheduler": 30.78163343900023, - "8_json_validator": 26.184069054999853, - "9_stream_visualizer": 21.324422691999935 + "10_scrypt_hash": 24.754794635999946, + "11_geospatial": 22.880691410999745, + "1_dijkstra": 18.020111163999886, + "2_convex_hull": 20.038773117000236, + "3_lis": 11.807387412999757, + "4_determinant": 20.521637209000065, + "5_markdown_parser": 35.67531904900074, + "6_csv_processor": 23.8520766750006, + "7_scheduler": 31.85370118200034, + "8_json_validator": 17.14643698600028, + "9_stream_visualizer": 25.974873207000083 }, "gemini-3-pro-preview TEMP:0.3": { - "10_scrypt_hash": 22.419933818999677, - "11_geospatial": 14.525312852999662, - "1_dijkstra": 24.24144133199984, - "2_convex_hull": 27.67347379200021, - "3_lis": 13.649138154000044, - "4_determinant": 28.68561609600019, - "5_markdown_parser": 44.175827321999705, - "6_csv_processor": 40.22086091799987, - "7_scheduler": 42.102860941999595, - "8_json_validator": 24.13780150000006, - "9_stream_visualizer": 22.134434574999847 + "10_scrypt_hash": 31.34955882699974, + "11_geospatial": 21.212845159000718, + "1_dijkstra": 14.686580670000055, + "2_convex_hull": 36.39883294000011, + "3_lis": 13.597776002999396, + "4_determinant": 24.862609581999482, + "5_markdown_parser": 36.88983640800044, + "6_csv_processor": 36.582046242999844, + "7_scheduler": 37.754115211999974, + "8_json_validator": 16.674394439999947, + "9_stream_visualizer": 25.583348608000204 }, "gemini-3-pro-preview TEMP:0.2": { - "10_scrypt_hash": 24.400115432000252, - "11_geospatial": 32.89142006099969, - "1_dijkstra": 36.531734934999605, - "2_convex_hull": 30.47034405499976, - "3_lis": 14.03327947399998, - "4_determinant": 15.886417729000096, - "5_markdown_parser": 43.89735358300013, - "6_csv_processor": 36.24166352199996, - "7_scheduler": 49.958096608999654, - "8_json_validator": 21.518541840999852, - "9_stream_visualizer": 30.054751582999714 + "10_scrypt_hash": 25.04706531199999, + "11_geospatial": 18.636367162999697, + "1_dijkstra": 23.471250179999508, + "2_convex_hull": 32.36644217699953, + "3_lis": 21.03346423900034, + "4_determinant": 33.63182032500021, + "5_markdown_parser": 45.76653377099987, + "6_csv_processor": 44.927907913000325, + "7_scheduler": 41.063800591999666, + "8_json_validator": 26.052476222000085, + "9_stream_visualizer": 20.329862430999988 }, "gemini-3-pro-preview TEMP:0.1": { - "10_scrypt_hash": 21.251296984999907, - "11_geospatial": 28.01666565400036, - "1_dijkstra": 22.908056412999983, - "2_convex_hull": 31.488867672999856, - "3_lis": 19.367484238999896, - "4_determinant": 16.061534822999967, - "5_markdown_parser": 30.51042381200008, - "6_csv_processor": 20.860845792999957, - "7_scheduler": 34.17653273200011, - "8_json_validator": 14.083612348000054, - "9_stream_visualizer": 19.854906946000177 + "10_scrypt_hash": 16.787732964999975, + "11_geospatial": 20.16605759199988, + "1_dijkstra": 31.337674549999647, + "2_convex_hull": 15.677699519000017, + "3_lis": 19.142893268000336, + "4_determinant": 26.106286918999626, + "5_markdown_parser": 25.228105368999763, + "6_csv_processor": 36.924520573999736, + "7_scheduler": 49.74383629500028, + "8_json_validator": 17.1179925739998, + "9_stream_visualizer": 24.9906886749994 }, "gemini-3-pro-preview TEMP:0": { - "10_scrypt_hash": 22.467800446999725, - "11_geospatial": 23.184671450000256, - "1_dijkstra": 28.33117579400027, - "2_convex_hull": 26.517016473000403, - "3_lis": 17.292057299999986, - "4_determinant": 22.012527137000113, - "5_markdown_parser": 44.51245308799995, - "6_csv_processor": 35.65954501500027, - "7_scheduler": 31.53722489799978, - "8_json_validator": 21.652465214000085, - "9_stream_visualizer": 28.28463803699985 + "10_scrypt_hash": 20.874672585999594, + "11_geospatial": 22.346452704999596, + "1_dijkstra": 28.580189787000418, + "2_convex_hull": 25.09971364900004, + "3_lis": 16.770306450999342, + "4_determinant": 22.11130663099978, + "5_markdown_parser": 42.952995118000544, + "6_csv_processor": 34.98289658599999, + "7_scheduler": 28.964328855000435, + "8_json_validator": 21.71179311800003, + "9_stream_visualizer": 27.561015010000208 + }, + "gemini-3-pro-preview TEMP:2": { + "10_scrypt_hash": 18.850475267999997, + "11_geospatial": 26.061414934000002, + "1_dijkstra": 32.080058634000004, + "2_convex_hull": 40.262037018, + "3_lis": 23.863135326000002, + "4_determinant": 21.64576313800001, + "5_markdown_parser": 35.426119787000005, + "6_csv_processor": 41.461592468999996, + "7_scheduler": 63.031456737, + "8_json_validator": 17.80283297700004, + "9_stream_visualizer": 37.456500977999994 + }, + "gemini-3-pro-preview TEMP:1.9": { + "10_scrypt_hash": 26.550956544000016, + "11_geospatial": 28.613920013999973, + "1_dijkstra": 26.252092659999967, + "2_convex_hull": 51.264573769999956, + "3_lis": 30.342489231000012, + "4_determinant": 29.058629305999958, + "5_markdown_parser": 30.14169296200003, + "6_csv_processor": 29.499591516999992, + "7_scheduler": 85.24949619800003, + "8_json_validator": 20.337025739999955, + "9_stream_visualizer": 40.432301935 + }, + "gemini-3-pro-preview TEMP:1.8": { + "10_scrypt_hash": 17.1179911150001, + "11_geospatial": 29.514046728000046, + "1_dijkstra": 28.144339148, + "2_convex_hull": 30.832829297999968, + "3_lis": 22.427721954999956, + "4_determinant": 12.77717681199999, + "5_markdown_parser": 33.72199084900005, + "6_csv_processor": 37.25121678799996, + "7_scheduler": 71.505791187, + "8_json_validator": 25.41118813699996, + "9_stream_visualizer": 21.328009533000177 + }, + "gemini-3-pro-preview TEMP:1.7": { + "10_scrypt_hash": 18.910409689000108, + "11_geospatial": 30.51153287200001, + "1_dijkstra": 21.085283119000028, + "2_convex_hull": 37.588829656000016, + "3_lis": 21.455840754000004, + "4_determinant": 15.062050559000111, + "5_markdown_parser": 28.85249140900001, + "6_csv_processor": 44.475366975999904, + "7_scheduler": 62.510325283000014, + "8_json_validator": 24.96264758999995, + "9_stream_visualizer": 32.618002833000155 + }, + "gemini-3-pro-preview TEMP:1.6": { + "10_scrypt_hash": 18.07594707799982, + "11_geospatial": 24.192698191999924, + "1_dijkstra": 23.389250704000005, + "2_convex_hull": 30.81265446199989, + "3_lis": 21.40121195099992, + "4_determinant": 11.822610518000088, + "5_markdown_parser": 22.82010067499988, + "6_csv_processor": 33.57937185800006, + "7_scheduler": 83.33972460600012, + "8_json_validator": 25.279451872000006, + "9_stream_visualizer": 27.714689797000027 + }, + "gemini-3-pro-preview TEMP:1.5": { + "10_scrypt_hash": 18.69272038900014, + "11_geospatial": 23.77197485099989, + "1_dijkstra": 26.440856348, + "2_convex_hull": 29.677680263000074, + "3_lis": 26.63670439099986, + "4_determinant": 25.75282643499994, + "5_markdown_parser": 41.91444458999997, + "6_csv_processor": 28.044683143000118, + "7_scheduler": 50.095482387, + "8_json_validator": 15.720686942999949, + "9_stream_visualizer": 18.935609488999937 + }, + "gemini-3-pro-preview TEMP:1.4": { + "10_scrypt_hash": 24.387901307999854, + "11_geospatial": 29.17852593200025, + "1_dijkstra": 23.139700418999883, + "2_convex_hull": 34.18627439399995, + "3_lis": 22.094377453000284, + "4_determinant": 15.912985173999797, + "5_markdown_parser": 28.417516086000017, + "6_csv_processor": 32.795155487999786, + "7_scheduler": 42.208218053000046, + "8_json_validator": 15.106514658999629, + "9_stream_visualizer": 25.44312660600012 + }, + "gemini-3-pro-preview TEMP:1.3": { + "10_scrypt_hash": 20.99151984900003, + "11_geospatial": 20.858707120000386, + "1_dijkstra": 24.934105057999957, + "2_convex_hull": 31.693044794999995, + "3_lis": 15.41439853399992, + "4_determinant": 18.300773887000048, + "5_markdown_parser": 31.605673247999977, + "6_csv_processor": 41.59330867599975, + "7_scheduler": 57.69496162199974, + "8_json_validator": 18.894077386000195, + "9_stream_visualizer": 27.242338625999633 + }, + "gemini-3-pro-preview TEMP:1.2": { + "10_scrypt_hash": 19.87584538699966, + "11_geospatial": 31.579098602999935, + "1_dijkstra": 31.312650417000054, + "2_convex_hull": 39.108151202999984, + "3_lis": 18.894060660999735, + "4_determinant": 27.813572447000073, + "5_markdown_parser": 33.95318160999985, + "6_csv_processor": 39.11827627599985, + "7_scheduler": 43.091859620000236, + "8_json_validator": 24.684869859999978, + "9_stream_visualizer": 19.26046375499992 } } \ No newline at end of file diff --git a/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_0.1.js b/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_0.1.js index dbb359c..d7a5ef1 100644 --- a/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_0.1.js +++ b/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_0.1.js @@ -2,6 +2,6 @@ const hashPassword = async (p, s) => { const { scrypt } = await import('https://esm.sh/scrypt-js@3.0.1') const e = new TextEncoder() const k = await scrypt(e.encode(p), e.encode(s), 1024, 8, 1, 32) - return [...k].map(b => (b + 256).toString(16).slice(1)).join('') + return Array.from(k, b => b.toString(16).padStart(2, '0')).join('') } export default hashPassword; \ No newline at end of file diff --git a/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_0.2.js b/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_0.2.js index d98f403..af96c36 100644 --- a/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_0.2.js +++ b/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_0.2.js @@ -1,7 +1,7 @@ const hashPassword = async (p, s) => { - const { scrypt } = await import('https://esm.sh/scrypt-js') - const e = new TextEncoder() - const k = await scrypt(e.encode(p), e.encode(s), 1024, 8, 1, 32) - return [...k].map(b => b.toString(16).padStart(2, '0')).join('') -} + const { scrypt } = await import('https://cdn.jsdelivr.net/npm/scrypt-js@3.0.1/scrypt.js'); + const e = new TextEncoder(); + const k = await scrypt(e.encode(p), e.encode(s), 1024, 8, 1, 32); + return Array.from(k, b => b.toString(16).padStart(2, '0')).join(''); +}; export default hashPassword; \ No newline at end of file diff --git a/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_0.3.js b/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_0.3.js index d98f403..49ecbda 100644 --- a/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_0.3.js +++ b/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_0.3.js @@ -1,5 +1,5 @@ const hashPassword = async (p, s) => { - const { scrypt } = await import('https://esm.sh/scrypt-js') + const { scrypt } = await import('https://esm.sh/scrypt-js@3.0.1') const e = new TextEncoder() const k = await scrypt(e.encode(p), e.encode(s), 1024, 8, 1, 32) return [...k].map(b => b.toString(16).padStart(2, '0')).join('') diff --git a/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_0.4.js b/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_0.4.js index be315d2..074fdb2 100644 --- a/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_0.4.js +++ b/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_0.4.js @@ -1,7 +1,7 @@ const hashPassword = async (p, s) => { - const { scrypt } = await import('https://esm.sh/scrypt-js'); - const e = new TextEncoder(); - const k = await scrypt(e.encode(p), e.encode(s), 1024, 8, 1, 32); - return [...k].map(b => b.toString(16).padStart(2, '0')).join(''); -}; + const { scrypt } = await import('https://esm.sh/scrypt-js') + const e = new TextEncoder() + const h = await scrypt(e.encode(p), e.encode(s), 1024, 8, 1, 32) + return [...h].map(b => b.toString(16).padStart(2, '0')).join('') +} export default hashPassword; \ No newline at end of file diff --git a/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_0.5.js b/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_0.5.js index daa549c..f52f4a8 100644 --- a/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_0.5.js +++ b/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_0.5.js @@ -1,7 +1,7 @@ const hashPassword = async (p, s) => { const { scrypt } = await import('https://cdn.jsdelivr.net/npm/scrypt-js@3.0.1/+esm') const e = new TextEncoder() - const k = await scrypt(e.encode(p), e.encode(s), 1024, 8, 1, 32) - return Array.from(k, b => b.toString(16).padStart(2, '0')).join('') + const h = await scrypt(e.encode(p), e.encode(s), 1024, 8, 1, 32) + return Array.from(h, b => b.toString(16).padStart(2, '0')).join('') } export default hashPassword; \ No newline at end of file diff --git a/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_0.6.js b/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_0.6.js index a8fb52e..ba2768b 100644 --- a/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_0.6.js +++ b/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_0.6.js @@ -1,7 +1,7 @@ -const hashPassword = async (p, s) => { - const { scrypt } = await import('https://unpkg.com/scrypt-js?module') - const e = new TextEncoder() - const k = await scrypt(e.encode(p), e.encode(s), 1024, 8, 1, 32) - return [...k].map(b => b.toString(16).padStart(2, '0')).join('') +const hashPassword = async (pwd, salt) => { + const { scrypt } = await import('https://cdn.jsdelivr.net/npm/scrypt-js@3.0.1/scrypt.js') + const enc = new TextEncoder() + const key = await scrypt(enc.encode(pwd), enc.encode(salt), 1024, 8, 1, 32) + return [...key].map(b => (b + 256).toString(16).slice(1)).join('') } export default hashPassword; \ No newline at end of file diff --git a/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_0.7.js b/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_0.7.js index 81db990..a90cce9 100644 --- a/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_0.7.js +++ b/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_0.7.js @@ -1,7 +1,7 @@ -const hashPassword = async (p, s) => { - const { scrypt } = await import('https://esm.sh/scrypt-js') - const e = new TextEncoder() - const k = await scrypt(e.encode(p), e.encode(s), 1024, 8, 1, 32) - return [...k].map(b => b.toString(16).padStart(2, 0)).join('') -} +const hashPassword = async (pwd, salt) => { + const { scrypt } = await import('https://cdn.jsdelivr.net/npm/scrypt-js@3.0.1/+esm'); + const e = new TextEncoder(); + const h = await scrypt(e.encode(pwd), e.encode(salt), 1024, 8, 1, 32); + return Array.from(h, b => b.toString(16).padStart(2, '0')).join(''); +}; export default hashPassword; \ No newline at end of file diff --git a/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_0.8.js b/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_0.8.js index 03cff67..4748fd8 100644 --- a/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_0.8.js +++ b/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_0.8.js @@ -1,7 +1,7 @@ -const hashPassword = async (p, s) => { +const hashPassword = async (pwd, salt) => { const { scrypt } = await import('https://esm.sh/scrypt-js') const e = new TextEncoder() - const k = await scrypt(e.encode(p), e.encode(s), 1024, 8, 1, 32) - return Array.from(k, b => b.toString(16).padStart(2, '0')).join('') + const h = await scrypt(e.encode(pwd), e.encode(salt), 1024, 8, 1, 32) + return [...h].map(v => v.toString(16).padStart(2, '0')).join('') } export default hashPassword; \ No newline at end of file diff --git a/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_0.9.js b/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_0.9.js index 0eee31a..132f0cf 100644 --- a/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_0.9.js +++ b/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_0.9.js @@ -1,7 +1,7 @@ const hashPassword = async (pwd, salt) => { - const { scrypt } = await import('https://esm.sh/scrypt-js') - const enc = txt => new TextEncoder().encode(txt) - const key = await scrypt(enc(pwd), enc(salt), 1024, 8, 1, 32) - return Array.from(key, b => b.toString(16).padStart(2, '0')).join('') -} + const { scrypt } = await import('https://esm.sh/scrypt-js'); + const enc = new TextEncoder(); + const hash = await scrypt(enc.encode(pwd), enc.encode(salt), 1024, 8, 1, 32); + return Array.from(hash, b => b.toString(16).padStart(2, '0')).join(''); +}; export default hashPassword; \ No newline at end of file diff --git a/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_1.1.js b/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_1.1.js index dbb359c..074fdb2 100644 --- a/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_1.1.js +++ b/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_1.1.js @@ -1,7 +1,7 @@ const hashPassword = async (p, s) => { - const { scrypt } = await import('https://esm.sh/scrypt-js@3.0.1') + const { scrypt } = await import('https://esm.sh/scrypt-js') const e = new TextEncoder() - const k = await scrypt(e.encode(p), e.encode(s), 1024, 8, 1, 32) - return [...k].map(b => (b + 256).toString(16).slice(1)).join('') + const h = await scrypt(e.encode(p), e.encode(s), 1024, 8, 1, 32) + return [...h].map(b => b.toString(16).padStart(2, '0')).join('') } export default hashPassword; \ No newline at end of file diff --git a/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_1.2.js b/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_1.2.js new file mode 100644 index 0000000..d98f403 --- /dev/null +++ b/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_1.2.js @@ -0,0 +1,7 @@ +const hashPassword = async (p, s) => { + const { scrypt } = await import('https://esm.sh/scrypt-js') + const e = new TextEncoder() + const k = await scrypt(e.encode(p), e.encode(s), 1024, 8, 1, 32) + return [...k].map(b => b.toString(16).padStart(2, '0')).join('') +} +export default hashPassword; \ No newline at end of file diff --git a/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_1.3.js b/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_1.3.js new file mode 100644 index 0000000..49ecbda --- /dev/null +++ b/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_1.3.js @@ -0,0 +1,7 @@ +const hashPassword = async (p, s) => { + const { scrypt } = await import('https://esm.sh/scrypt-js@3.0.1') + const e = new TextEncoder() + const k = await scrypt(e.encode(p), e.encode(s), 1024, 8, 1, 32) + return [...k].map(b => b.toString(16).padStart(2, '0')).join('') +} +export default hashPassword; \ No newline at end of file diff --git a/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_1.4.js b/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_1.4.js new file mode 100644 index 0000000..2240200 --- /dev/null +++ b/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_1.4.js @@ -0,0 +1,9 @@ +const hashPassword = async (p, s) => { + const { scrypt } = await import('https://esm.sh/scrypt-js') + const e = new TextEncoder() + return Array.from( + await scrypt(e.encode(p), e.encode(s), 1024, 8, 1, 32), + b => b.toString(16).padStart(2, '0') + ).join('') +} +export default hashPassword; \ No newline at end of file diff --git a/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_1.5.js b/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_1.5.js new file mode 100644 index 0000000..a627a4a --- /dev/null +++ b/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_1.5.js @@ -0,0 +1,7 @@ +const hashPassword = async (password, salt) => { + const { scrypt } = await import('https://unpkg.com/scrypt-js@3.0.1/scrypt.js') + const enc = str => new TextEncoder().encode(str) + const buf = await scrypt(enc(password), enc(salt), 1024, 8, 1, 32) + return Array.from(buf, b => b.toString(16).padStart(2, '0')).join('') +} +export default hashPassword; \ No newline at end of file diff --git a/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_1.6.js b/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_1.6.js new file mode 100644 index 0000000..b32153c --- /dev/null +++ b/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_1.6.js @@ -0,0 +1,7 @@ +const hashPassword = async (pwd, salt) => { + const { scrypt } = await import('https://esm.sh/scrypt-js@3.0.1') + const e = new TextEncoder() + const k = await scrypt(e.encode(pwd), e.encode(salt), 1024, 8, 1, 32) + return [...k].map(b => b.toString(16).padStart(2, '0')).join('') +} +export default hashPassword; \ No newline at end of file diff --git a/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_1.7.js b/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_1.7.js new file mode 100644 index 0000000..49ecbda --- /dev/null +++ b/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_1.7.js @@ -0,0 +1,7 @@ +const hashPassword = async (p, s) => { + const { scrypt } = await import('https://esm.sh/scrypt-js@3.0.1') + const e = new TextEncoder() + const k = await scrypt(e.encode(p), e.encode(s), 1024, 8, 1, 32) + return [...k].map(b => b.toString(16).padStart(2, '0')).join('') +} +export default hashPassword; \ No newline at end of file diff --git a/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_1.8.js b/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_1.8.js new file mode 100644 index 0000000..f72843f --- /dev/null +++ b/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_1.8.js @@ -0,0 +1,11 @@ +const hashPassword = async (password, salt) => { + const { scrypt } = await import('https://esm.sh/scrypt-js') + const encoder = new TextEncoder() + const buffer = await scrypt( + encoder.encode(password), + encoder.encode(salt), + 1024, 8, 1, 32 + ) + return [...buffer].map(b => b.toString(16).padStart(2, '0')).join('') +} +export default hashPassword; \ No newline at end of file diff --git a/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_1.9.js b/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_1.9.js new file mode 100644 index 0000000..7ab05bc --- /dev/null +++ b/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_1.9.js @@ -0,0 +1,7 @@ +const hashPassword = async (p, s) => { + const { scrypt: k } = await import('https://esm.sh/scrypt-js@3.0.1') + const e = t => new TextEncoder().encode(t) + const r = await k(e(p), e(s), 1024, 8, 1, 32) + return [...r].map(b => b.toString(16).padStart(2, '0')).join('') +} +export default hashPassword; \ No newline at end of file diff --git a/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_1.js b/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_1.js index d98f403..123bdb7 100644 --- a/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_1.js +++ b/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_1.js @@ -1,7 +1,7 @@ -const hashPassword = async (p, s) => { +const hashPassword = async (pwd, salt) => { const { scrypt } = await import('https://esm.sh/scrypt-js') const e = new TextEncoder() - const k = await scrypt(e.encode(p), e.encode(s), 1024, 8, 1, 32) + const k = await scrypt(e.encode(pwd), e.encode(salt), 1024, 8, 1, 32) return [...k].map(b => b.toString(16).padStart(2, '0')).join('') } export default hashPassword; \ No newline at end of file diff --git a/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_2.js b/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_2.js new file mode 100644 index 0000000..c01b326 --- /dev/null +++ b/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_2.js @@ -0,0 +1,7 @@ +const hashPassword = async (p, s) => { + const { scrypt } = await import('https://cdn.jsdelivr.net/npm/scrypt-js/+esm') + const e = new TextEncoder() + const k = await scrypt(e.encode(p), e.encode(s), 1024, 8, 1, 32) + return Array.from(k, b => b.toString(16).padStart(2, '0')).join('') +} +export default hashPassword; \ No newline at end of file diff --git a/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_0.1.js b/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_0.1.js index 0d97eeb..438f783 100644 --- a/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_0.1.js +++ b/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_0.1.js @@ -1,10 +1,12 @@ const analyzeGPS = async (readings, boundary) => { - const T = await import('https://esm.sh/@turf/turf') - const pts = readings - .filter(r => T.booleanPointInPolygon(T.point(r.loc), boundary, { ignoreBoundary: true })) + const { booleanPointInPolygon, point, lineString, length } = await import('https://esm.sh/@turf/turf'); + + const coords = readings + .filter(({ loc }) => booleanPointInPolygon(point(loc), boundary, { ignoreBoundary: true })) .sort((a, b) => a.ts - b.ts) - .map(r => r.loc) + .map(({ loc }) => loc); - return pts.length < 2 ? 0 : +T.length(T.lineString(pts), { units: 'kilometers' }).toFixed(2) -} + return coords.length < 2 ? 0 : + Math.round(length(lineString(coords), { units: 'kilometers' }) * 100) / 100; +}; export default analyzeGPS; \ No newline at end of file diff --git a/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_0.2.js b/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_0.2.js index 326b005..4edb299 100644 --- a/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_0.2.js +++ b/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_0.2.js @@ -1,12 +1,13 @@ const analyzeGPS = async (readings, boundary) => { - const t = await import('https://cdn.jsdelivr.net/npm/@turf/turf/+esm'); - - const pts = readings - .filter(({ loc }) => t.booleanPointInPolygon(t.point(loc), boundary, { ignoreBoundary: true })) - .sort((a, b) => a.ts - b.ts) - .map(({ loc }) => loc); + const { booleanPointInPolygon, point, lineString, length } = + await import('https://cdn.jsdelivr.net/npm/@turf/turf/+esm') - return pts.length < 2 ? 0 : - Math.round(t.length(t.lineString(pts), { units: 'kilometers' }) * 100) / 100; -}; + const valid = readings + .filter(({ loc }) => booleanPointInPolygon(point(loc), boundary, { ignoreBoundary: true })) + .sort((a, b) => a.ts - b.ts) + .map(({ loc }) => loc) + + return valid.length < 2 ? 0 : + Math.round(length(lineString(valid), { units: 'kilometers' }) * 100) / 100 +} export default analyzeGPS; \ No newline at end of file diff --git a/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_0.3.js b/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_0.3.js index fbbdee8..8e0e783 100644 --- a/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_0.3.js +++ b/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_0.3.js @@ -1,14 +1,12 @@ const analyzeGPS = async (readings, boundary) => { - const T = await import('https://esm.sh/@turf/turf'); + const t = await import('https://cdn.jsdelivr.net/npm/@turf/turf/+esm') const pts = readings - .filter(r => T.booleanPointInPolygon(T.point(r.loc), boundary, { ignoreBoundary: true })) + .filter(({ loc }) => t.booleanPointInPolygon(t.point(loc), boundary, { ignoreBoundary: true })) .sort((a, b) => a.ts - b.ts) - .map(r => r.loc); + .map(r => r.loc) - if (pts.length < 2) return 0; - - const len = T.length(T.lineString(pts), { units: 'kilometers' }); - return Math.round(len * 100) / 100; -}; + return pts.length < 2 ? 0 : + Math.round(t.length(t.lineString(pts), { units: 'kilometers' }) * 100) / 100 +} export default analyzeGPS; \ No newline at end of file diff --git a/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_0.4.js b/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_0.4.js index 326b005..5907dab 100644 --- a/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_0.4.js +++ b/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_0.4.js @@ -1,12 +1,11 @@ const analyzeGPS = async (readings, boundary) => { const t = await import('https://cdn.jsdelivr.net/npm/@turf/turf/+esm'); - const pts = readings .filter(({ loc }) => t.booleanPointInPolygon(t.point(loc), boundary, { ignoreBoundary: true })) .sort((a, b) => a.ts - b.ts) .map(({ loc }) => loc); - return pts.length < 2 ? 0 : + return pts.length < 2 ? 0 : Math.round(t.length(t.lineString(pts), { units: 'kilometers' }) * 100) / 100; }; export default analyzeGPS; \ No newline at end of file diff --git a/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_0.5.js b/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_0.5.js index 36d1e9f..6a981c1 100644 --- a/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_0.5.js +++ b/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_0.5.js @@ -1,13 +1,12 @@ const analyzeGPS = async (readings, boundary) => { - const { booleanPointInPolygon, point, lineString, length } = await import('https://esm.sh/@turf/turf'); - - const coords = readings - .filter(({ loc }) => booleanPointInPolygon(point(loc), boundary, { ignoreBoundary: true })) + const t = await import('https://esm.sh/@turf/turf'); + + const pts = readings + .filter(({ loc }) => t.booleanPointInPolygon(t.point(loc), boundary, { ignoreBoundary: true })) .sort((a, b) => a.ts - b.ts) .map(({ loc }) => loc); - return coords.length < 2 - ? 0 - : +length(lineString(coords), { units: 'kilometers' }).toFixed(2); + return pts.length < 2 ? 0 : + Math.round(t.length(t.lineString(pts), { units: 'kilometers' }) * 100) / 100; }; export default analyzeGPS; \ No newline at end of file diff --git a/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_0.6.js b/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_0.6.js index b3db285..36cc4b1 100644 --- a/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_0.6.js +++ b/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_0.6.js @@ -1,10 +1,12 @@ const analyzeGPS = async (readings, boundary) => { - const t = await import('https://esm.sh/@turf/turf'); - const pts = readings - .filter(r => t.booleanPointInPolygon(t.point(r.loc), boundary, { ignoreBoundary: true })) + const { booleanPointInPolygon, point, lineString, length } = await import('https://cdn.jsdelivr.net/npm/@turf/turf/+esm') + + const path = readings + .filter(({ loc }) => booleanPointInPolygon(point(loc), boundary, { ignoreBoundary: true })) .sort((a, b) => a.ts - b.ts) - .map(r => r.loc); + .map(r => r.loc) - return pts.length < 2 ? 0 : +t.length(t.lineString(pts), { units: 'kilometers' }).toFixed(2); -}; + return path.length < 2 ? 0 : + Math.round(length(lineString(path), { units: 'kilometers' }) * 100) / 100 +} export default analyzeGPS; \ No newline at end of file diff --git a/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_0.7.js b/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_0.7.js index c19352d..6d159ff 100644 --- a/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_0.7.js +++ b/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_0.7.js @@ -1,12 +1,9 @@ const analyzeGPS = async (readings, boundary) => { - const { booleanPointInPolygon, point, lineString, length } = await import('https://esm.sh/@turf/turf'); - - const path = readings - .filter(({ loc }) => booleanPointInPolygon(point(loc), boundary, { ignoreBoundary: true })) + const t = await import('https://cdn.jsdelivr.net/npm/@turf/turf/+esm'); + const pts = readings + .filter(r => t.booleanPointInPolygon(t.point(r.loc), boundary, { ignoreBoundary: true })) .sort((a, b) => a.ts - b.ts) - .map(({ loc }) => loc); - - return path.length < 2 ? 0 : - Math.round(length(lineString(path), { units: 'kilometers' }) * 100) / 100; + .map(r => r.loc); + return pts.length < 2 ? 0 : +t.length(t.lineString(pts), { units: 'kilometers' }).toFixed(2); }; export default analyzeGPS; \ No newline at end of file diff --git a/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_0.8.js b/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_0.8.js index 20a08ec..1c6c0e9 100644 --- a/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_0.8.js +++ b/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_0.8.js @@ -1,10 +1,13 @@ const analyzeGPS = async (readings, boundary) => { - const T = await import('https://cdn.jsdelivr.net/npm/@turf/turf/+esm') - const pts = readings - .filter(r => T.booleanPointInPolygon(T.point(r.loc), boundary, { ignoreBoundary: true })) + const { booleanPointInPolygon, point, lineString, length } = await import('https://esm.sh/@turf/turf') + + const path = readings + .filter(r => booleanPointInPolygon(point(r.loc), boundary)) .sort((a, b) => a.ts - b.ts) .map(r => r.loc) - - return pts.length < 2 ? 0 : +T.length(T.lineString(pts), { units: 'kilometers' }).toFixed(2) + + return path.length < 2 + ? 0 + : +length(lineString(path), { units: 'kilometers' }).toFixed(2) } export default analyzeGPS; \ No newline at end of file diff --git a/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_0.9.js b/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_0.9.js index 2c0351f..97db457 100644 --- a/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_0.9.js +++ b/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_0.9.js @@ -1,12 +1,14 @@ const analyzeGPS = async (readings, boundary) => { const { booleanPointInPolygon, point, lineString, length } = await import('https://esm.sh/@turf/turf'); - const pts = readings - .filter(r => booleanPointInPolygon(point(r.loc), boundary, { ignoreBoundary: true })) + const coords = readings + .filter(({ loc }) => booleanPointInPolygon(point(loc), boundary)) .sort((a, b) => a.ts - b.ts) - .map(r => r.loc); + .map(({ loc }) => loc); - return pts.length < 2 ? 0 - : +length(lineString(pts), { units: 'kilometers' }).toFixed(2); + if (coords.length < 2) return 0; + + const total = length(lineString(coords), { units: 'kilometers' }); + return Math.round(total * 100) / 100; }; export default analyzeGPS; \ No newline at end of file diff --git a/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_1.1.js b/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_1.1.js index 1140a00..5c9994c 100644 --- a/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_1.1.js +++ b/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_1.1.js @@ -1,14 +1,11 @@ const analyzeGPS = async (readings, boundary) => { - const { booleanPointInPolygon, point, lineString, length } = await import('https://esm.sh/@turf/turf') - - const path = readings - .filter(({ loc }) => booleanPointInPolygon(point(loc), boundary)) + const turf = await import('https://esm.sh/@turf/turf'); + const coords = readings + .filter(({ loc }) => turf.booleanPointInPolygon(turf.point(loc), boundary)) .sort((a, b) => a.ts - b.ts) - .map(({ loc }) => loc) + .map(r => r.loc); - if (path.length < 2) return 0 - - const dist = length(lineString(path), { units: 'kilometers' }) - return Math.round(dist * 100) / 100 -} + return coords.length < 2 ? 0 : + Math.round(turf.length(turf.lineString(coords), { units: 'kilometers' }) * 100) / 100; +}; export default analyzeGPS; \ No newline at end of file diff --git a/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_1.2.js b/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_1.2.js new file mode 100644 index 0000000..c5295e5 --- /dev/null +++ b/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_1.2.js @@ -0,0 +1,12 @@ +export const analyzeGPS = async (readings, boundary) => { + const { point, booleanPointInPolygon, lineString, length } = await import('https://esm.sh/@turf/turf@6.5.0') + + const coords = readings + .filter(({ loc }) => booleanPointInPolygon(point(loc), boundary, { ignoreBoundary: true })) + .sort((a, b) => a.ts - b.ts) + .map(r => r.loc) + + return coords.length < 2 ? 0 : + Math.round(length(lineString(coords), { units: 'kilometers' }) * 100) / 100 +} +export default analyzeGPS; \ No newline at end of file diff --git a/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_1.3.js b/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_1.3.js new file mode 100644 index 0000000..76b9531 --- /dev/null +++ b/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_1.3.js @@ -0,0 +1,11 @@ +const analyzeGPS = async (readings, boundary) => { + const { booleanPointInPolygon, point, lineString, length } = await import('https://esm.sh/@turf/turf'); + + const path = readings + .filter(({ loc }) => booleanPointInPolygon(point(loc), boundary, { ignoreBoundary: true })) + .sort((a, b) => a.ts - b.ts) + .map(r => r.loc); + + return path.length < 2 ? 0 : +length(lineString(path)).toFixed(2); +}; +export default analyzeGPS; \ No newline at end of file diff --git a/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_1.4.js b/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_1.4.js new file mode 100644 index 0000000..aeafa9c --- /dev/null +++ b/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_1.4.js @@ -0,0 +1,13 @@ +const analyzeGPS = async (readings, boundary) => { + const { booleanPointInPolygon: inside, point, lineString, length } = await import('https://cdn.jsdelivr.net/npm/@turf/turf/+esm') + + const path = readings + .filter(({ loc }) => inside(point(loc), boundary, { ignoreBoundary: true })) + .sort((a, b) => a.ts - b.ts) + .map(({ loc }) => loc) + + if (path.length < 2) return 0 + + return +length(lineString(path), { units: 'kilometers' }).toFixed(2) +} +export default analyzeGPS; \ No newline at end of file diff --git a/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_1.5.js b/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_1.5.js new file mode 100644 index 0000000..e6e83be --- /dev/null +++ b/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_1.5.js @@ -0,0 +1,13 @@ +const analyzeGPS = async (readings, boundary) => { + const turf = await import('https://cdn.jsdelivr.net/npm/@turf/turf/+esm'); + + const pts = readings + .filter(r => turf.booleanPointInPolygon(turf.point(r.loc), boundary, { ignoreBoundary: true })) + .sort((a, b) => a.ts - b.ts) + .map(r => r.loc); + + return pts.length < 2 + ? 0 + : +turf.length(turf.lineString(pts), { units: 'kilometers' }).toFixed(2); +}; +export default analyzeGPS; \ No newline at end of file diff --git a/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_1.6.js b/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_1.6.js new file mode 100644 index 0000000..d4e6a3f --- /dev/null +++ b/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_1.6.js @@ -0,0 +1,9 @@ +const analyzeGPS = async (data, boundary) => { + const { booleanPointInPolygon, point, lineString, length } = await import('https://cdn.jsdelivr.net/npm/@turf/turf/+esm') + const pts = data + .filter(d => booleanPointInPolygon(point(d.loc), boundary, { ignoreBoundary: true })) + .sort((a, b) => a.ts - b.ts) + .map(d => d.loc) + return pts.length < 2 ? 0 : +length(lineString(pts)).toFixed(2) +} +export default analyzeGPS; \ No newline at end of file diff --git a/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_1.7.js b/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_1.7.js new file mode 100644 index 0000000..da13d2d --- /dev/null +++ b/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_1.7.js @@ -0,0 +1,11 @@ +const analyzeGPS = async (readings, boundary) => { + const { point, booleanPointInPolygon, lineString, length } = await import('https://cdn.jsdelivr.net/npm/@turf/turf/+esm'); + + const path = readings + .filter(({ loc }) => booleanPointInPolygon(point(loc), boundary, { ignoreBoundary: true })) + .sort((a, b) => a.ts - b.ts) + .map(r => r.loc); + + return path.length < 2 ? 0 : +length(lineString(path)).toFixed(2); +}; +export default analyzeGPS; \ No newline at end of file diff --git a/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_1.8.js b/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_1.8.js new file mode 100644 index 0000000..1740f67 --- /dev/null +++ b/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_1.8.js @@ -0,0 +1,11 @@ +const analyzeGPS = async (readings, boundary) => { + const { point, booleanPointInPolygon, lineString, length } = await import('https://esm.sh/@turf/turf') + + const path = readings + .filter(({ loc }) => booleanPointInPolygon(point(loc), boundary)) + .sort((a, b) => a.ts - b.ts) + .map(r => r.loc) + + return path.length < 2 ? 0 : +length(lineString(path), { units: 'kilometers' }).toFixed(2) +} +export default analyzeGPS; \ No newline at end of file diff --git a/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_1.9.js b/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_1.9.js new file mode 100644 index 0000000..382985c --- /dev/null +++ b/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_1.9.js @@ -0,0 +1,12 @@ +const analyzeGPS = async (readings, boundary) => { + const T = await import('https://esm.sh/@turf/turf') + const valid = readings + .filter(r => T.booleanPointInPolygon(T.point(r.loc), boundary)) + .sort((a, b) => a.ts - b.ts) + + if (valid.length < 2) return 0 + + const line = T.lineString(valid.map(v => v.loc)) + return Math.round(T.length(line) * 1e2) / 1e2 +} +export default analyzeGPS; \ No newline at end of file diff --git a/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_1.js b/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_1.js index f3dd564..6d88602 100644 --- a/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_1.js +++ b/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_1.js @@ -1,14 +1,13 @@ const analyzeGPS = async (readings, boundary) => { - const { booleanPointInPolygon, point, lineString, length } = await import('https://esm.sh/@turf/turf') + const T = await import('https://esm.sh/@turf/turf'); - const path = readings - .filter(({ loc }) => booleanPointInPolygon(point(loc), boundary, { ignoreBoundary: true })) + const pts = readings + .filter(({ loc }) => T.booleanPointInPolygon(T.point(loc), boundary, { ignoreBoundary: true })) .sort((a, b) => a.ts - b.ts) - .map(({ loc }) => loc) + .map(r => r.loc); - if (path.length < 2) return 0 - - const dist = length(lineString(path), { units: 'kilometers' }) - return Math.round(dist * 100) / 100 -} + return pts.length < 2 + ? 0 + : +T.length(T.lineString(pts), { units: 'kilometers' }).toFixed(2); +}; export default analyzeGPS; \ No newline at end of file diff --git a/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_2.js b/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_2.js new file mode 100644 index 0000000..3435c66 --- /dev/null +++ b/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_2.js @@ -0,0 +1,9 @@ +const analyzeGPS = async (readings, boundary) => { + const { booleanPointInPolygon, point, lineString, length } = await import('https://esm.sh/@turf/turf'); + const valid = readings + .filter(r => booleanPointInPolygon(point(r.loc), boundary)) + .sort((a, b) => a.ts - b.ts); + + return valid.length < 2 ? 0 : +length(lineString(valid.map(r => r.loc))).toFixed(2); +}; +export default analyzeGPS; \ No newline at end of file diff --git a/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_0.1.js b/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_0.1.js index 4729419..a626c41 100644 --- a/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_0.1.js +++ b/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_0.1.js @@ -1,22 +1,22 @@ const findShortestPath = async (g, s, e) => { - const { default: Q } = await import('https://esm.sh/js-priority-queue') - const q = new Q({ comparator: (a, b) => a.w - b.w }) + const { default: PQ } = await import('https://esm.sh/js-priority-queue') + const q = new PQ({ comparator: (a, b) => a.w - b.w }) const d = { [s]: 0 } q.queue({ n: s, w: 0 }) while (q.length) { const { n, w } = q.dequeue() if (n === e) return w - if (w > (d[n] ?? 1/0)) continue + if (w > (d[n] ?? Infinity)) continue for (let v in g[n]) { - let t = w + g[n][v] - if (t < (d[v] ?? 1/0)) { - d[v] = t - q.queue({ n: v, w: t }) + let k = w + g[n][v] + if (k < (d[v] ?? Infinity)) { + d[v] = k + q.queue({ n: v, w: k }) } } } - return 1/0 + return Infinity } export default findShortestPath; \ No newline at end of file diff --git a/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_0.2.js b/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_0.2.js index 4a113fc..89fac42 100644 --- a/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_0.2.js +++ b/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_0.2.js @@ -1,19 +1,21 @@ const findShortestPath = async (g, s, e) => { - const { default: P } = await import('https://esm.sh/js-priority-queue'); - const q = new P({ comparator: (a, b) => a.w - b.w }), d = { [s]: 0 }; - q.queue({ n: s, w: 0 }); + const { default: Q } = await import('https://esm.sh/js-priority-queue') + const d = { [s]: 0 }, q = new Q({ comparator: (a, b) => a[1] - b[1] }) + q.queue([s, 0]) + while (q.length) { - const { n, w } = q.dequeue(); - if (n === e) return w; - if (w > (d[n] ?? 1 / 0)) continue; - for (const k in g[n] || {}) { - const t = w + g[n][k]; - if (t < (d[k] ?? 1 / 0)) { - d[k] = t; - q.queue({ n: k, w: t }); + const [u, w] = q.dequeue() + if (u === e) return w + if (w > (d[u] ?? 1/0)) continue + + for (let v in g[u]) { + const k = w + g[u][v] + if (k < (d[v] ?? 1/0)) { + d[v] = k + q.queue([v, k]) } } } - return 1 / 0; -}; + return 1/0 +} export default findShortestPath; \ No newline at end of file diff --git a/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_0.3.js b/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_0.3.js index 6af6468..e3ae8b6 100644 --- a/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_0.3.js +++ b/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_0.3.js @@ -1,20 +1,25 @@ const findShortestPath = async (g, s, e) => { - const { default: P } = await import('https://esm.sh/js-priority-queue') - const q = new P({ comparator: (a, b) => a.w - b.w }) - const m = { [s]: 0 } - q.queue({ n: s, w: 0 }) - while (q.length) { - const { n, w } = q.dequeue() - if (n === e) return w - if (w > (m[n] ?? 1 / 0)) continue - for (const k in g[n] || {}) { - const t = w + g[n][k] - if (t < (m[k] ?? 1 / 0)) { - m[k] = t - q.queue({ n: k, w: t }) - } + const { default: P } = await import('https://cdn.jsdelivr.net/npm/js-priority-queue@0.1.5/+esm'); + const q = new P({ comparator: (a, b) => a.w - b.w }); + const d = { [s]: 0 }; + + q.queue({ n: s, w: 0 }); + + while (q.length) { + const { n, w } = q.dequeue(); + + if (n === e) return w; + if (w > (d[n] ?? 1/0)) continue; + + for (let v in g[n]) { + let k = w + g[n][v]; + if (k < (d[v] ?? 1/0)) { + d[v] = k; + q.queue({ n: v, w: k }); + } + } } - } - return 1 / 0 -} + + return 1/0; +}; export default findShortestPath; \ No newline at end of file diff --git a/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_0.4.js b/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_0.4.js index 1ae0fc6..ea0eb39 100644 --- a/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_0.4.js +++ b/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_0.4.js @@ -1,19 +1,18 @@ const findShortestPath = async (g, s, e) => { const { default: PQ } = await import('https://esm.sh/js-priority-queue') - const q = new PQ({ comparator: (a, b) => a.w - b.w }) - const d = { [s]: 0 } + const d = { [s]: 0 }, q = new PQ({ comparator: (a, b) => a.w - b.w }) q.queue({ n: s, w: 0 }) while (q.length) { - const { n, w } = q.dequeue() - if (n === e) return w - if (w > (d[n] ?? 1 / 0)) continue + const { n: u, w } = q.dequeue() + if (u === e) return w + if (w > (d[u] ?? 1 / 0)) continue - for (const [v, cost] of Object.entries(g[n] || {})) { - const t = w + cost - if (t < (d[v] ?? 1 / 0)) { - d[v] = t - q.queue({ n: v, w: t }) + for (const v in g[u]) { + const nw = w + g[u][v] + if (nw < (d[v] ?? 1 / 0)) { + d[v] = nw + q.queue({ n: v, w: nw }) } } } diff --git a/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_0.5.js b/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_0.5.js index ad292fe..748cbe6 100644 --- a/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_0.5.js +++ b/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_0.5.js @@ -1,16 +1,17 @@ const findShortestPath = async (g, s, e) => { - const { default: Q } = await import('https://esm.sh/js-priority-queue') - const d = { [s]: 0 }, q = new Q({ comparator: (a, b) => a.w - b.w }) + const { default: P } = await import('https://esm.sh/js-priority-queue') + const q = new P({ comparator: (a, b) => a.w - b.w }) + const d = { [s]: 0 } q.queue({ n: s, w: 0 }) while (q.length) { const { n, w } = q.dequeue() if (n === e) return w if (w > (d[n] ?? 1 / 0)) continue - for (const [v, c] of Object.entries(g[n] || {})) { - const k = w + c - if (k < (d[v] ?? 1 / 0)) { - d[v] = k - q.queue({ n: v, w: k }) + for (let k in g[n]) { + const t = w + g[n][k] + if (t < (d[k] ?? 1 / 0)) { + d[k] = t + q.queue({ n: k, w: t }) } } } diff --git a/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_0.6.js b/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_0.6.js index 24e12bb..c6e5968 100644 --- a/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_0.6.js +++ b/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_0.6.js @@ -1,24 +1,19 @@ const findShortestPath = async (g, s, e) => { - const { default: PQ } = await import('https://esm.sh/js-priority-queue') - const q = new PQ({ comparator: (a, b) => a.w - b.w }) - const d = { [s]: 0 }, v = new Set() - + const { default: PQ } = await import('https://cdn.jsdelivr.net/npm/js-priority-queue@0.1.5/+esm') + const q = new PQ({ comparator: (a, b) => a.w - b.w }), d = { [s]: 0 } q.queue({ n: s, w: 0 }) - while (q.length) { const { n, w } = q.dequeue() if (n === e) return w - if (v.has(n)) continue - v.add(n) - - for (const k in g[n]) { - const t = w + g[n][k] - if (t < (d[k] ?? Infinity)) { - d[k] = t - q.queue({ n: k, w: t }) + if (w > (d[n] ?? 1 / 0)) continue + for (const v in g[n]) { + const k = w + g[n][v] + if (k < (d[v] ?? 1 / 0)) { + d[v] = k + q.queue({ n: v, w: k }) } } } - return Infinity + return 1 / 0 } export default findShortestPath; \ No newline at end of file diff --git a/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_0.7.js b/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_0.7.js index a6d3943..1fdd785 100644 --- a/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_0.7.js +++ b/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_0.7.js @@ -1,25 +1,19 @@ const findShortestPath = async (g, s, e) => { - const { default: PQ } = await import('https://esm.sh/js-priority-queue'); - const q = new PQ({ comparator: (a, b) => a.w - b.w }); - const d = { [s]: 0 }; - - q.queue({ w: 0, n: s }); - + const { default: Q } = await import('https://esm.sh/js-priority-queue'); + const q = new Q({ comparator: (a, b) => a.w - b.w }), m = { [s]: 0 }; + q.queue({ n: s, w: 0 }); while (q.length) { - const { w, n } = q.dequeue(); - + const { n, w } = q.dequeue(); if (n === e) return w; - if (w > (d[n] ?? 1 / 0)) continue; - + if (w > (m[n] ?? 1/0)) continue; for (const v in g[n]) { const k = w + g[n][v]; - if (k < (d[v] ?? 1 / 0)) { - d[v] = k; - q.queue({ w: k, n: v }); + if (k < (m[v] ?? 1/0)) { + m[v] = k; + q.queue({ n: v, w: k }); } } } - - return 1 / 0; + return 1/0; }; export default findShortestPath; \ No newline at end of file diff --git a/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_0.8.js b/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_0.8.js index 5dbc719..3d4370d 100644 --- a/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_0.8.js +++ b/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_0.8.js @@ -1,19 +1,22 @@ const findShortestPath = async (g, s, e) => { - const { default: P } = await import('https://esm.sh/js-priority-queue'); - const q = new P({ comparator: (a, b) => a.c - b.c }), d = { [s]: 0 }; - q.queue({ n: s, c: 0 }); + const { default: P } = await import('https://esm.sh/js-priority-queue') + const q = new P({ comparator: (a, b) => a.w - b.w }) + const d = { [s]: 0 } + q.queue({ n: s, w: 0 }) + while (q.length) { - const { n, c } = q.dequeue(); - if (n === e) return c; - if (c > (d[n] ?? 1 / 0)) continue; - for (let v in g[n]) { - let k = c + g[n][v]; - if (k < (d[v] ?? 1 / 0)) { - d[v] = k; - q.queue({ n: v, c: k }); + const { n, w } = q.dequeue() + if (n === e) return w + if (w > (d[n] ?? Infinity)) continue + + for (const k in g[n]) { + const c = w + g[n][k] + if (c < (d[k] ?? Infinity)) { + d[k] = c + q.queue({ n: k, w: c }) } } } - return 1 / 0; -}; + return Infinity +} export default findShortestPath; \ No newline at end of file diff --git a/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_0.9.js b/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_0.9.js index 1e1528c..2d26d13 100644 --- a/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_0.9.js +++ b/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_0.9.js @@ -1,5 +1,5 @@ const findShortestPath = async (g, s, e) => { - const { default: PQ } = await import('https://cdn.jsdelivr.net/npm/js-priority-queue@0.1.5/+esm') + const { default: PQ } = await import('https://esm.sh/js-priority-queue') const q = new PQ({ comparator: (a, b) => a.w - b.w }) const d = { [s]: 0 } @@ -7,15 +7,14 @@ const findShortestPath = async (g, s, e) => { while (q.length) { const { n, w } = q.dequeue() - if (n === e) return w if (w > (d[n] ?? 1 / 0)) continue - for (const k in g[n] || {}) { - const c = w + g[n][k] - if (c < (d[k] ?? 1 / 0)) { - d[k] = c - q.queue({ n: k, w: c }) + for (const [v, c] of Object.entries(g[n] || {})) { + const t = w + c + if (t < (d[v] ?? 1 / 0)) { + d[v] = t + q.queue({ n: v, w: t }) } } } diff --git a/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_1.1.js b/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_1.1.js index e3d76a7..0eb2b3c 100644 --- a/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_1.1.js +++ b/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_1.1.js @@ -1,25 +1,23 @@ const findShortestPath = async (graph, start, end) => { - const { default: PQ } = await import('https://cdn.jsdelivr.net/npm/js-priority-queue/+esm') - const costs = { [start]: 0 } - const queue = new PQ({ comparator: (a, b) => a.cost - b.cost }) + const { default: PQ } = await import('https://esm.sh/js-priority-queue') + const q = new PQ({ comparator: (a, b) => a.w - b.w }) + const dist = { [start]: 0 } + + q.queue({ n: start, w: 0 }) - queue.queue({ node: start, cost: 0 }) + while (q.length) { + const { n, w } = q.dequeue() + if (n === end) return w + if (w > (dist[n] ?? Infinity)) continue - while (queue.length) { - const { node, cost } = queue.dequeue() - - if (node === end) return cost - if (cost > (costs[node] ?? Infinity)) continue - - for (const [neighbor, weight] of Object.entries(graph[node] || {})) { - const nextCost = cost + weight - if (nextCost < (costs[neighbor] ?? Infinity)) { - costs[neighbor] = nextCost - queue.queue({ node: neighbor, cost: nextCost }) + for (const v in graph[n]) { + const d = w + graph[n][v] + if (d < (dist[v] ?? Infinity)) { + dist[v] = d + q.queue({ n: v, w: d }) } } } - return Infinity } export default findShortestPath; \ No newline at end of file diff --git a/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_1.2.js b/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_1.2.js new file mode 100644 index 0000000..4db4389 --- /dev/null +++ b/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_1.2.js @@ -0,0 +1,19 @@ +const findShortestPath = async (g, s, e) => { + const { default: P } = await import('https://cdn.skypack.dev/js-priority-queue') + const d = { [s]: 0 }, q = new P({ compare: (a, b) => a.w - b.w }) + q.queue({ id: s, w: 0 }) + while (q.length) { + const { id, w } = q.dequeue() + if (id === e) return w + if (w > (d[id] ?? 1 / 0)) continue + for (let n in g[id]) { + const k = w + g[id][n] + if (k < (d[n] ?? 1 / 0)) { + d[n] = k + q.queue({ id: n, w: k }) + } + } + } + return 1 / 0 +} +export default findShortestPath; \ No newline at end of file diff --git a/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_1.3.js b/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_1.3.js new file mode 100644 index 0000000..312454d --- /dev/null +++ b/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_1.3.js @@ -0,0 +1,22 @@ +const findShortestPath = async (g, s, e) => { + const { default: PQ } = await import('https://cdn.jsdelivr.net/npm/js-priority-queue@0.1.5/+esm') + const q = new PQ({ comparator: (a, b) => a.w - b.w }) + const d = { [s]: 0 } + q.queue({ n: s, w: 0 }) + + while (q.length) { + const { n: u, w: c } = q.dequeue() + if (u === e) return c + if (c > (d[u] ?? 1 / 0)) continue + + for (const v in g[u] || {}) { + const k = c + g[u][v] + if (k < (d[v] ?? 1 / 0)) { + d[v] = k + q.queue({ n: v, w: k }) + } + } + } + return 1 / 0 +} +export default findShortestPath; \ No newline at end of file diff --git a/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_1.4.js b/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_1.4.js new file mode 100644 index 0000000..53d3df3 --- /dev/null +++ b/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_1.4.js @@ -0,0 +1,25 @@ +const findShortestPath = async (g, s, e) => { + const { default: PQ } = await import('https://cdn.jsdelivr.net/npm/js-priority-queue@0.1.5/+esm') + const q = new PQ({ comparator: (a, b) => a.d - b.d }) + const D = { [s]: 0 } + + q.queue({ n: s, d: 0 }) + + while (q.length) { + const { n, d } = q.dequeue() + + if (n === e) return d + if (d > (D[n] ?? 1 / 0)) continue + + for (const [v, w] of Object.entries(g[n] || {})) { + const c = d + w + if (c < (D[v] ?? 1 / 0)) { + D[v] = c + q.queue({ n: v, d: c }) + } + } + } + + return 1 / 0 +} +export default findShortestPath; \ No newline at end of file diff --git a/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_1.5.js b/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_1.5.js new file mode 100644 index 0000000..bdf221c --- /dev/null +++ b/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_1.5.js @@ -0,0 +1,23 @@ +const findShortestPath = async (g, s, e) => { + const { default: PQ } = await import('https://esm.sh/js-priority-queue') + const q = new PQ({ comparator: (a, b) => a.w - b.w }) + const d = { [s]: 0 } + + q.queue({ n: s, w: 0 }) + + while (q.length) { + const { n, w } = q.dequeue() + if (n === e) return w + if (w > (d[n] ?? 1 / 0)) continue + + for (const v in g[n] || {}) { + const k = w + g[n][v] + if (k < (d[v] ?? 1 / 0)) { + d[v] = k + q.queue({ n: v, w: k }) + } + } + } + return 1 / 0 +} +export default findShortestPath; \ No newline at end of file diff --git a/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_1.6.js b/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_1.6.js new file mode 100644 index 0000000..9971f1e --- /dev/null +++ b/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_1.6.js @@ -0,0 +1,21 @@ +const findShortestPath = async (g, s, e) => { + const { default: P } = await import('https://esm.sh/js-priority-queue'); + const q = new P({ comparator: (a, b) => a.w - b.w }), m = { [s]: 0 }; + q.queue({ n: s, w: 0 }); + + while (q.length) { + const { n, w } = q.dequeue(); + if (n === e) return w; + if (w > (m[n] ?? 1 / 0)) continue; + + for (const [k, v] of Object.entries(g[n] || {})) { + const t = w + v; + if (t < (m[k] ?? 1 / 0)) { + m[k] = t; + q.queue({ n: k, w: t }); + } + } + } + return 1 / 0; +}; +export default findShortestPath; \ No newline at end of file diff --git a/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_1.7.js b/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_1.7.js new file mode 100644 index 0000000..401a7b3 --- /dev/null +++ b/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_1.7.js @@ -0,0 +1,27 @@ +const findShortestPath = async (g, s, e) => { + const { default: PQ } = await import('https://esm.sh/js-priority-queue'); + const q = new PQ({ compare: (a, b) => a.d - b.d }); + const m = { [s]: 0 }; + const v = new Set(); + + q.queue({ n: s, d: 0 }); + + while (q.length) { + const { n, d: c } = q.dequeue(); + if (n === e) return c; + if (v.has(n)) continue; + v.add(n); + + const adj = g[n] || {}; + for (const k in adj) { + const t = c + adj[k]; + if (t < (m[k] ?? Infinity)) { + m[k] = t; + q.queue({ n: k, d: t }); + } + } + } + + return Infinity; +}; +export default findShortestPath; \ No newline at end of file diff --git a/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_1.8.js b/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_1.8.js new file mode 100644 index 0000000..cc53857 --- /dev/null +++ b/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_1.8.js @@ -0,0 +1,24 @@ +const findShortestPath = async (g, s, e) => { + const { default: Q } = await import('https://cdn.skypack.dev/js-priority-queue') + const q = new Q({ comparator: (a, b) => a.d - b.d }) + const m = { [s]: 0 } + + q.queue({ n: s, d: 0 }) + + while (q.length) { + const { n, d } = q.dequeue() + + if (n === e) return d + if (d > (m[n] ?? 1/0)) continue + + for (const v in g[n]) { + const t = d + g[n][v] + if (t < (m[v] ?? 1/0)) { + m[v] = t + q.queue({ n: v, d: t }) + } + } + } + return 1/0 +} +export default findShortestPath; \ No newline at end of file diff --git a/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_1.9.js b/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_1.9.js new file mode 100644 index 0000000..d160484 --- /dev/null +++ b/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_1.9.js @@ -0,0 +1,25 @@ +const findShortestPath = async (graph, start, end) => { + const { default: PQ } = await import('https://esm.sh/js-priority-queue@0.1.5') + const q = new PQ({ compare: (a, b) => a.d - b.d }) + const dist = { [start]: 0 } + + q.queue({ n: start, d: 0 }) + + while (q.length) { + const { n, d } = q.dequeue() + + if (n === end) return d + if (d > (dist[n] ?? Infinity)) continue + + for (const [v, w] of Object.entries(graph[n] || {})) { + const t = d + w + if (t < (dist[v] ?? Infinity)) { + dist[v] = t + q.queue({ n: v, d: t }) + } + } + } + + return Infinity +} +export default findShortestPath; \ No newline at end of file diff --git a/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_1.js b/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_1.js index 3fb4d38..b47b073 100644 --- a/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_1.js +++ b/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_1.js @@ -1,24 +1,25 @@ const findShortestPath = async (graph, start, end) => { - const { default: PQ } = await import('https://cdn.skypack.dev/js-priority-queue'); - const queue = new PQ({ comparator: (a, b) => a.d - b.d }); - const dists = { [start]: 0 }, visited = new Set(); - - queue.queue({ n: start, d: 0 }); + const { default: PriorityQueue } = await import('https://cdn.jsdelivr.net/npm/js-priority-queue@0.1.5/+esm') + const dists = new Map([[start, 0]]) + const pq = new PriorityQueue({ comparator: (a, b) => a.w - b.w }) - while (queue.length) { - const { n, d } = queue.dequeue(); - if (n === end) return d; - if (visited.has(n)) continue; - visited.add(n); + pq.queue({ n: start, w: 0 }) + + while (pq.length) { + const { n, w } = pq.dequeue() + + if (n === end) return w + if (w > (dists.get(n) ?? 1 / 0)) continue for (const [neighbor, weight] of Object.entries(graph[n] || {})) { - const newDist = d + weight; - if (newDist < (dists[neighbor] ?? Infinity)) { - dists[neighbor] = newDist; - queue.queue({ n: neighbor, d: newDist }); + const newWeight = w + weight + if (newWeight < (dists.get(neighbor) ?? 1 / 0)) { + dists.set(neighbor, newWeight) + pq.queue({ n: neighbor, w: newWeight }) } } } - return Infinity; -}; + + return 1 / 0 +} export default findShortestPath; \ No newline at end of file diff --git a/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_2.js b/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_2.js new file mode 100644 index 0000000..9c3601d --- /dev/null +++ b/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_2.js @@ -0,0 +1,25 @@ +const findShortestPath = async (g, s, e) => { + const { default: PQ } = await import('https://esm.sh/js-priority-queue') + const q = new PQ({ comparator: (a, b) => a.d - b.d }) + const m = { [s]: 0 } + + q.queue({ n: s, d: 0 }) + + while (q.length) { + const { n, d } = q.dequeue() + if (n === e) return d + if (d > (m[n] ?? 1 / 0)) continue + + const adj = g[n] || {} + for (const k in adj) { + const v = d + adj[k] + if (v < (m[k] ?? 1 / 0)) { + m[k] = v + q.queue({ n: k, d: v }) + } + } + } + + return 1 / 0 +} +export default findShortestPath; \ No newline at end of file diff --git a/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_0.1.js b/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_0.1.js index f4ff180..553a4a6 100644 --- a/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_0.1.js +++ b/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_0.1.js @@ -1,15 +1,25 @@ -const findConvexHull = async (pts) => { - const { default: _ } = await import('https://cdn.jsdelivr.net/npm/lodash@4.17.21/+esm') - const s = _.sortBy(_.uniqWith(pts, _.isEqual), ['x', 'y']) - if (s.length < 3) return s - const x = (a, b, c) => (b.x - a.x) * (c.y - a.y) - (b.y - a.y) * (c.x - a.x) - const m = (l) => l.reduce((h, p) => { - while (h.length >= 2 && x(h[h.length - 2], h[h.length - 1], p) <= 0) h.pop() - h.push(p) - return h - }, []) - const l = m(s) - const u = m([...s].reverse()) - return [...l.slice(0, -1), ...u.slice(0, -1)] -} +const findConvexHull = async (P) => { + const { default: _ } = await import('https://cdn.jsdelivr.net/npm/lodash@4.17.21/+esm'); + + const U = _.uniqWith(P, _.isEqual); + if (U.length < 3) return U; + + const S = _.sortBy(U, ['x', 'y']); + + const cross = (o, a, b) => (a.x - o.x) * (b.y - o.y) - (a.y - o.y) * (b.x - o.x); + + const build = (list) => { + const h = []; + list.forEach(p => { + while (h.length >= 2 && cross(h[h.length - 2], h[h.length - 1], p) <= 0) h.pop(); + h.push(p); + }); + return h; + }; + + const l = build(S); + const u = build([...S].reverse()); + + return [...l.slice(0, -1), ...u.slice(0, -1)]; +}; export default findConvexHull; \ No newline at end of file diff --git a/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_0.2.js b/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_0.2.js index 8454638..4a8cac5 100644 --- a/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_0.2.js +++ b/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_0.2.js @@ -1,13 +1,19 @@ const findConvexHull = async (pts) => { - const { default: _ } = await import('https://cdn.jsdelivr.net/npm/lodash@4.17.21/+esm'); - const s = _.sortBy(_.uniqWith(pts, _.isEqual), ['x', 'y']); - if (s.length < 3) return s; - const k = (a, b, c) => (b.x - a.x) * (c.y - a.y) - (b.y - a.y) * (c.x - a.x); - const f = (h, p) => { - while (h.length > 1 && k(h[h.length - 2], h[h.length - 1], p) <= 0) h.pop(); - h.push(p); - return h; - }; - return [...s.reduce(f, []).slice(0, -1), ...s.reduceRight(f, []).slice(0, -1)]; -}; + const { default: _ } = await import('https://esm.sh/lodash') + const u = _.uniqWith(pts, _.isEqual) + if (u.length < 3) return u + const s = _.sortBy(u, ['x', 'y']) + const cp = (a, b, c) => (b.x - a.x) * (c.y - a.y) - (b.y - a.y) * (c.x - a.x) + const scan = (lst) => { + const h = [] + lst.forEach(p => { + while (h.length >= 2 && cp(h[h.length - 2], h[h.length - 1], p) <= 0) h.pop() + h.push(p) + }) + return h + } + const l = scan(s) + const uH = scan(s.reverse()) + return _.concat(l.slice(0, -1), uH.slice(0, -1)) +} export default findConvexHull; \ No newline at end of file diff --git a/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_0.3.js b/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_0.3.js index 0a35936..c9a0caf 100644 --- a/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_0.3.js +++ b/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_0.3.js @@ -1,27 +1,18 @@ const findConvexHull = async (pts) => { - const { default: _ } = await import('https://cdn.jsdelivr.net/npm/lodash@4.17.21/+esm'); - - if (!Array.isArray(pts)) throw new Error('Input must be an array'); - const u = _.uniqWith(pts, _.isEqual); - if (u.length < 3) return u; - - const s = _.sortBy(u, ['x', 'y']); - const k = (a, b, c) => (b.x - a.x) * (c.y - a.y) - (b.y - a.y) * (c.x - a.x); - const h = []; - + const { default: _ } = await import('https://cdn.jsdelivr.net/npm/lodash@4.17.21/+esm') + const s = _.sortBy(_.uniqWith(pts, _.isEqual), ['x', 'y']) + if (s.length < 3) return s + const h = [], x = (o, a, b) => (a.x - o.x) * (b.y - o.y) - (a.y - o.y) * (b.x - o.x) for (const p of s) { - while (h.length >= 2 && k(h[h.length - 2], h[h.length - 1], p) <= 0) h.pop(); - h.push(p); + while (h.length >= 2 && x(h[h.length - 2], h[h.length - 1], p) <= 0) h.pop() + h.push(p) } - - const t = h.length + 1; + const t = h.length + 1 for (let i = s.length - 2; i >= 0; i--) { - const p = s[i]; - while (h.length >= t && k(h[h.length - 2], h[h.length - 1], p) <= 0) h.pop(); - h.push(p); + while (h.length >= t && x(h[h.length - 2], h[h.length - 1], s[i]) <= 0) h.pop() + h.push(s[i]) } - - h.pop(); - return h; -}; + h.pop() + return h +} export default findConvexHull; \ No newline at end of file diff --git a/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_0.4.js b/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_0.4.js index daab7dc..3b427ab 100644 --- a/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_0.4.js +++ b/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_0.4.js @@ -1,24 +1,29 @@ -const findConvexHull = async (pts) => { +const findConvexHull = async points => { const { default: _ } = await import('https://cdn.jsdelivr.net/npm/lodash@4.17.21/+esm') - const s = _.sortBy(_.uniqWith(pts, _.isEqual), ['x', 'y']) - if (s.length < 3) return s - const cross = (a, b, o) => (a.x - o.x) * (b.y - o.y) - (a.y - o.y) * (b.x - o.x) - const build = (list) => { - const h = [] - for (const p of list) { - while (h.length >= 2 && cross(h[h.length - 1], p, h[h.length - 2]) <= 0) h.pop() - h.push(p) + const sorted = _.sortBy(_.uniqWith(points, _.isEqual), ['x', 'y']) + if (sorted.length < 3) return sorted + + const cross = (a, b, c) => (b.x - a.x) * (c.y - a.y) - (b.y - a.y) * (c.x - a.x) + const hull = [] + + for (const p of sorted) { + while (hull.length >= 2 && cross(hull[hull.length - 2], hull[hull.length - 1], p) <= 0) { + hull.pop() } - return h + hull.push(p) } - const l = build(s) - const u = build([...s].reverse()) - - l.pop() - u.pop() - - return [...l, ...u] + const lowerLen = hull.length + 1 + for (let i = sorted.length - 2; i >= 0; i--) { + const p = sorted[i] + while (hull.length >= lowerLen && cross(hull[hull.length - 2], hull[hull.length - 1], p) <= 0) { + hull.pop() + } + hull.push(p) + } + + hull.pop() + return hull } export default findConvexHull; \ No newline at end of file diff --git a/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_0.5.js b/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_0.5.js index 6981d54..e4a3c56 100644 --- a/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_0.5.js +++ b/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_0.5.js @@ -1,16 +1,24 @@ -const findConvexHull = async (pts) => { - const { default: _ } = await import('https://cdn.jsdelivr.net/npm/lodash@4.17.21/+esm') - const u = _.uniqWith(pts, _.isEqual) - if (u.length < 3) return u - const s = _.sortBy(u, ['x', 'y']) - const cp = (o, a, b) => (a.x - o.x) * (b.y - o.y) - (a.y - o.y) * (b.x - o.x) - const scan = (lst) => lst.reduce((h, p) => { - while (h.length >= 2 && cp(h[h.length - 2], h[h.length - 1], p) <= 0) h.pop() - h.push(p) - return h - }, []) - const l = scan(s) - const up = scan([...s].reverse()) - return [...l.slice(0, -1), ...up.slice(0, -1)] -} +const findConvexHull = async (p) => { + const { default: _ } = await import('https://cdn.skypack.dev/lodash'); + const s = _.sortBy(_.uniqWith(p, _.isEqual), ['x', 'y']); + if (s.length < 3) return s; + + const x = (a, b, c) => (b.x - a.x) * (c.y - a.y) - (b.y - a.y) * (c.x - a.x); + const h = []; + + for (const i of s) { + while (h.length >= 2 && x(h[h.length - 2], h[h.length - 1], i) <= 0) h.pop(); + h.push(i); + } + + const t = h.length + 1; + for (let i = s.length - 2; i >= 0; i--) { + const k = s[i]; + while (h.length >= t && x(h[h.length - 2], h[h.length - 1], k) <= 0) h.pop(); + h.push(k); + } + + h.pop(); + return h; +}; export default findConvexHull; \ No newline at end of file diff --git a/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_0.6.js b/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_0.6.js index ff2e4a3..cd9115d 100644 --- a/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_0.6.js +++ b/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_0.6.js @@ -1,17 +1,21 @@ const findConvexHull = async (pts) => { - const { default: _ } = await import('https://cdn.jsdelivr.net/npm/lodash@4.17.21/+esm') - const s = _.sortBy(_.uniqWith(pts, _.isEqual), ['x', 'y']) - if (s.length < 3) return s - const k = (o, a, b) => (a.x - o.x) * (b.y - o.y) - (a.y - o.y) * (b.x - o.x) - const m = (v) => { - const h = [] - for (const p of v) { - while (h.length >= 2 && k(h[h.length - 2], h[h.length - 1], p) <= 0) h.pop() - h.push(p) - } - return h + const { default: _ } = await import('https://cdn.jsdelivr.net/npm/lodash@4.17.21/+esm'); + const s = _.sortBy(_.uniqWith(pts, _.isEqual), ['x', 'y']); + if (s.length < 3) return s; + + const h = [], x = (o, a, b) => (a.x - o.x) * (b.y - o.y) - (a.y - o.y) * (b.x - o.x); + + for (let i = 0; i < s.length; i++) { + while (h.length >= 2 && x(h[h.length - 2], h[h.length - 1], s[i]) <= 0) h.pop(); + h.push(s[i]); } - const l = m(s), u = m(s.reverse()) - return l.slice(0, -1).concat(u.slice(0, -1)) -} + + for (let i = s.length - 2, t = h.length + 1; i >= 0; i--) { + while (h.length >= t && x(h[h.length - 2], h[h.length - 1], s[i]) <= 0) h.pop(); + h.push(s[i]); + } + + h.pop(); + return h; +}; export default findConvexHull; \ No newline at end of file diff --git a/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_0.7.js b/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_0.7.js index 70abd52..f0ae5e7 100644 --- a/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_0.7.js +++ b/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_0.7.js @@ -1,22 +1,23 @@ -const findConvexHull = async points => { - const { default: _ } = await import('https://esm.sh/lodash') - const s = _.sortBy(_.uniqWith(points, _.isEqual), ['x', 'y']) - if (s.length < 3) return s +const findConvexHull = async (points) => { + const { default: _ } = await import('https://cdn.jsdelivr.net/npm/lodash@4.17.21/+esm'); + const sorted = _.sortBy(_.uniqWith(points, _.isEqual), ['x', 'y']); - const h = [], x = (a, b, c) => (b.x - a.x) * (c.y - a.y) - (b.y - a.y) * (c.x - a.x) + if (sorted.length < 3) return sorted; + + const cross = (o, a, b) => (a.x - o.x) * (b.y - o.y) - (a.y - o.y) * (b.x - o.x); - s.forEach(p => { - while (h.length >= 2 && x(h.at(-2), h.at(-1), p) <= 0) h.pop() - h.push(p) - }) - - const t = h.length + 1 - for (let i = s.length - 2; i >= 0; i--) { - while (h.length >= t && x(h.at(-2), h.at(-1), s[i]) <= 0) h.pop() - h.push(s[i]) - } - - h.pop() - return h -} + const buildHull = (list) => { + const hull = []; + list.forEach(p => { + while (hull.length >= 2 && cross(hull[hull.length - 2], hull[hull.length - 1], p) <= 0) hull.pop(); + hull.push(p); + }); + return hull; + }; + + const lower = buildHull(sorted); + const upper = buildHull([...sorted].reverse()); + + return [...lower.slice(0, -1), ...upper.slice(0, -1)]; +}; export default findConvexHull; \ No newline at end of file diff --git a/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_0.8.js b/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_0.8.js index 9f05440..5090fe1 100644 --- a/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_0.8.js +++ b/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_0.8.js @@ -1,24 +1,19 @@ const findConvexHull = async (pts) => { - const { default: _ } = await import('https://cdn.jsdelivr.net/npm/lodash@4.17.21/+esm'); + const { default: _ } = await import('https://esm.sh/lodash@4'); const s = _.sortBy(_.uniqWith(pts, _.isEqual), ['x', 'y']); - if (s.length < 3) return s; + + const k = (o, a, b) => (a.x - o.x) * (b.y - o.y) - (a.y - o.y) * (b.x - o.x); + const add = (h, p) => { + while (h.length > 1 && k(h[h.length - 2], h[h.length - 1], p) <= 0) h.pop(); + h.push(p); + }; - const cross = (o, a, b) => (a.x - o.x) * (b.y - o.y) - (a.y - o.y) * (b.x - o.x); - const h = []; - - for (let i = 0; i < s.length; i++) { - while (h.length >= 2 && cross(h[h.length - 2], h[h.length - 1], s[i]) <= 0) h.pop(); - h.push(s[i]); - } - - const t = h.length + 1; - for (let i = s.length - 2; i >= 0; i--) { - while (h.length >= t && cross(h[h.length - 2], h[h.length - 1], s[i]) <= 0) h.pop(); - h.push(s[i]); - } - - h.pop(); - return h; + const l = [], u = []; + s.forEach(p => add(l, p)); + for (let i = s.length - 1; i >= 0; i--) add(u, s[i]); + + l.pop(); u.pop(); + return [...l, ...u]; }; export default findConvexHull; \ No newline at end of file diff --git a/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_0.9.js b/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_0.9.js index 8b2f382..a3ffa57 100644 --- a/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_0.9.js +++ b/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_0.9.js @@ -1,23 +1,18 @@ const findConvexHull = async (pts) => { - if (!pts?.length || pts.length < 3) return pts || []; + const { default: _ } = await import('https://cdn.jsdelivr.net/npm/lodash@4.17.21/+esm') + const s = _.sortBy(_.uniqWith(pts, _.isEqual), ['x', 'y']) + if (s.length < 3) return s - const { default: _ } = await import('https://cdn.jsdelivr.net/npm/lodash@4.17.21/+esm'); - - const s = _.sortBy(_.uniqWith(pts, _.isEqual), ['x', 'y']); - const k = (a, b, c) => (b.x - a.x) * (c.y - a.y) - (b.y - a.y) * (c.x - a.x); - - const scan = (list) => { - const h = []; - for (const p of list) { - while (h.length >= 2 && k(h[h.length - 2], h[h.length - 1], p) <= 0) h.pop(); - h.push(p); + const x = (a, b, c) => (b.x - a.x) * (c.y - a.y) - (b.y - a.y) * (c.x - a.x) + const scan = (arr, h = []) => { + for (const p of arr) { + while (h.length >= 2 && x(h[h.length - 2], h[h.length - 1], p) <= 0) h.pop() + h.push(p) } - return h; - }; + return h + } - const l = scan(s); - const u = scan(s.reverse()); - - return [...l.slice(0, -1), ...u.slice(0, -1)]; -}; + const l = scan(s), u = scan([...s].reverse()) + return [...l.slice(0, -1), ...u.slice(0, -1)] +} export default findConvexHull; \ No newline at end of file diff --git a/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_1.1.js b/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_1.1.js index 7e0ba91..4919343 100644 --- a/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_1.1.js +++ b/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_1.1.js @@ -1,22 +1,17 @@ -const findConvexHull = async (points) => { +const findConvexHull = async points => { const { default: _ } = await import('https://cdn.jsdelivr.net/npm/lodash@4.17.21/+esm') - const P = _.sortBy(_.uniqWith(points, _.isEqual), ['x', 'y']) - if (P.length < 3) return P - - const xp = (a, b, c) => (b.x - a.x) * (c.y - a.y) - (b.y - a.y) * (c.x - a.x) - - const scan = (arr) => { - const h = [] - for (const p of arr) { - while (h.length >= 2 && xp(h[h.length - 2], h[h.length - 1], p) <= 0) h.pop() + const s = _.sortBy(_.uniqWith(points, _.isEqual), ['x', 'y']) + if (s.length < 3) return s + const x = (o, a, b) => (a.x - o.x) * (b.y - o.y) - (a.y - o.y) * (b.x - o.x) + const scan = (arr, h = []) => { + arr.forEach(p => { + while (h.length >= 2 && x(h[h.length - 2], h[h.length - 1], p) <= 0) h.pop() h.push(p) - } + }) return h } - - const l = scan(P) - const u = scan(P.reverse()) - - return [...l.slice(0, -1), ...u.slice(0, -1)] + const l = scan(s) + const u = scan([...s].reverse()) + return l.slice(0, -1).concat(u.slice(0, -1)) } export default findConvexHull; \ No newline at end of file diff --git a/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_1.2.js b/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_1.2.js new file mode 100644 index 0000000..d2bdce0 --- /dev/null +++ b/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_1.2.js @@ -0,0 +1,17 @@ +const findConvexHull = async points => { + const { default: _ } = await import('https://cdn.jsdelivr.net/npm/lodash@4.17.21/+esm') + const p = _.sortBy(_.uniqWith(points, _.isEqual), ['x', 'y']) + if (p.length < 3) return p + const h = [], x = (a, b, c) => (b.x - a.x) * (c.y - a.y) - (b.y - a.y) * (c.x - a.x) + for (let i = 0; i < p.length; i++) { + while (h.length >= 2 && x(h[h.length - 2], h[h.length - 1], p[i]) <= 0) h.pop() + h.push(p[i]) + } + for (let i = p.length - 2, t = h.length + 1; i >= 0; i--) { + while (h.length >= t && x(h[h.length - 2], h[h.length - 1], p[i]) <= 0) h.pop() + h.push(p[i]) + } + h.pop() + return h +} +export default findConvexHull; \ No newline at end of file diff --git a/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_1.3.js b/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_1.3.js new file mode 100644 index 0000000..2173935 --- /dev/null +++ b/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_1.3.js @@ -0,0 +1,28 @@ +export const findConvexHull = async (points) => { + const { default: _ } = await import('https://cdn.jsdelivr.net/npm/lodash@4.17.21/+esm'); + const P = _.sortBy(_.uniqWith(points, _.isEqual), ['x', 'y']); + + if (P.length < 3) return P; + + const cross = (a, b, o) => (a.x - o.x) * (b.y - o.y) - (a.y - o.y) * (b.x - o.x); + + const buildChain = (nodes) => { + const hull = []; + for (const p of nodes) { + while (hull.length >= 2 && cross(hull[hull.length - 1], p, hull[hull.length - 2]) <= 0) { + hull.pop(); + } + hull.push(p); + } + return hull; + }; + + const lower = buildChain(P); + const upper = buildChain([...P].reverse()); + + lower.pop(); + upper.pop(); + + return [...lower, ...upper]; +}; +export default findConvexHull; \ No newline at end of file diff --git a/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_1.4.js b/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_1.4.js new file mode 100644 index 0000000..051e52d --- /dev/null +++ b/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_1.4.js @@ -0,0 +1,22 @@ +const findConvexHull = async (pts) => { + const { default: _ } = await import('https://cdn.jsdelivr.net/npm/lodash@4.17.21/+esm') + const s = _.sortBy(_.uniqWith(pts, _.isEqual), ['x', 'y']) + if (s.length < 3) return s + + const k = (a, b, o) => (a.x - o.x) * (b.y - o.y) - (a.y - o.y) * (b.x - o.x) + const build = (list) => { + const stack = [] + for (const p of list) { + while (stack.length > 1 && k(stack[stack.length - 1], p, stack[stack.length - 2]) <= 0) { + stack.pop() + } + stack.push(p) + } + return stack + } + + const l = build(s) + const u = build([...s].reverse()) + return [...l.slice(0, -1), ...u.slice(0, -1)] +} +export default findConvexHull; \ No newline at end of file diff --git a/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_1.5.js b/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_1.5.js new file mode 100644 index 0000000..2030260 --- /dev/null +++ b/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_1.5.js @@ -0,0 +1,23 @@ +const findConvexHull = async (rawPoints) => { + const { default: _ } = await import('https://cdn.jsdelivr.net/npm/lodash@4.17.21/+esm') + const pts = _.sortBy(_.uniqWith(rawPoints, _.isEqual), ['x', 'y']) + if (pts.length < 3) return pts + + const cross = (a, b, c) => (b.x - a.x) * (c.y - a.y) - (b.y - a.y) * (c.x - a.x) + + const build = (list) => { + const h = [] + list.forEach(p => { + while (h.length >= 2 && cross(h[h.length - 2], h[h.length - 1], p) <= 0) h.pop() + h.push(p) + }) + return h + } + + const lower = build(pts) + const upper = build([...pts].reverse()) + + lower.pop(), upper.pop() + return [...lower, ...upper] +} +export default findConvexHull; \ No newline at end of file diff --git a/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_1.6.js b/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_1.6.js new file mode 100644 index 0000000..2255766 --- /dev/null +++ b/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_1.6.js @@ -0,0 +1,23 @@ +export const findConvexHull = async (pts) => { + const { default: _ } = await import('https://cdn.jsdelivr.net/npm/lodash@4.17.21/+esm') + const S = _.sortBy(_.uniqWith(pts, _.isEqual), ['x', 'y']) + if (S.length < 3) return S + + const cross = (a, b, c) => (b.x - a.x) * (c.y - a.y) - (b.y - a.y) * (c.x - a.x) + const chain = (list) => { + const h = [] + for (const p of list) { + while (h.length >= 2 && cross(h[h.length - 2], h[h.length - 1], p) <= 0) h.pop() + h.push(p) + } + return h + } + + const l = chain(S) + const u = chain([...S].reverse()) + + l.pop() + u.pop() + return l.concat(u) +} +export default findConvexHull; \ No newline at end of file diff --git a/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_1.7.js b/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_1.7.js new file mode 100644 index 0000000..1ca0175 --- /dev/null +++ b/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_1.7.js @@ -0,0 +1,19 @@ +const findConvexHull = async (points) => { + const { default: _ } = await import('https://cdn.jsdelivr.net/npm/lodash@4.17.21/+esm'); + const sorted = _.sortBy(_.uniqWith(points, _.isEqual), ['x', 'y']); + + if (sorted.length < 3) return sorted; + + const cross = (o, a, b) => (a.x - o.x) * (b.y - o.y) - (a.y - o.y) * (b.x - o.x); + + const scan = (list) => list.reduce((h, p) => { + while (h.length > 1 && cross(h[h.length - 2], h[h.length - 1], p) <= 0) h.pop(); + return h.push(p), h; + }, []); + + const lower = scan(sorted); + const upper = scan([...sorted].reverse()); + + return [...lower.slice(0, -1), ...upper.slice(0, -1)]; +}; +export default findConvexHull; \ No newline at end of file diff --git a/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_1.8.js b/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_1.8.js new file mode 100644 index 0000000..f382af6 --- /dev/null +++ b/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_1.8.js @@ -0,0 +1,18 @@ +const findConvexHull = async (pts) => { + const { default: _ } = await import('https://cdn.jsdelivr.net/npm/lodash-es@4.17.21/+esm') + const s = _.sortBy(_.uniqWith(pts, _.isEqual), ['x', 'y']) + if (s.length < 3) return s + + const k = (a, b, c) => (b.x - a.x) * (c.y - a.y) - (b.y - a.y) * (c.x - a.x) + const f = (h, p) => { + while (h.length >= 2 && k(h[h.length - 2], h[h.length - 1], p) <= 0) h.pop() + h.push(p) + return h + } + + const l = _.reduce(s, f, []) + const u = _.reduceRight(s, f, []) + + return [..._.dropRight(l), ..._.dropRight(u)] +} +export default findConvexHull; \ No newline at end of file diff --git a/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_1.9.js b/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_1.9.js new file mode 100644 index 0000000..101b6ee --- /dev/null +++ b/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_1.9.js @@ -0,0 +1,17 @@ +const findConvexHull = async (points) => { + const { default: _ } = await import('https://cdn.jsdelivr.net/npm/lodash@4.17.21/+esm'); + const pts = _.sortBy(_.uniqWith(points, _.isEqual), ['x', 'y']); + if (pts.length < 3) return pts; + const cross = (o, a, b) => (a.x - o.x) * (b.y - o.y) - (a.y - o.y) * (b.x - o.x); + const chain = (list) => { + const h = []; + for (const p of list) { + while (h.length >= 2 && cross(h[h.length - 2], h[h.length - 1], p) <= 0) h.pop(); + h.push(p); + } + return h; + }; + const lower = chain(pts), upper = chain([...pts].reverse()); + return [...lower.slice(0, -1), ...upper.slice(0, -1)]; +}; +export default findConvexHull; \ No newline at end of file diff --git a/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_1.js b/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_1.js index 4de2579..1be2621 100644 --- a/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_1.js +++ b/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_1.js @@ -1,23 +1,31 @@ const findConvexHull = async (points) => { + if (!Array.isArray(points)) throw new Error('Input must be an array'); + const { default: _ } = await import('https://esm.sh/lodash'); - const P = _.sortBy(_.uniqWith(points, _.isEqual), ['x', 'y']); - if (P.length < 3) return P; - + + const uniq = _.uniqWith(points, _.isEqual); + if (uniq.length < 3) return uniq; + + const sorted = _.sortBy(uniq, ['x', 'y']); const cross = (o, a, b) => (a.x - o.x) * (b.y - o.y) - (a.y - o.y) * (b.x - o.x); - const h = []; + + const build = (list) => { + const hull = []; + for (const p of list) { + while (hull.length >= 2 && cross(hull[hull.length - 2], hull[hull.length - 1], p) <= 0) { + hull.pop(); + } + hull.push(p); + } + return hull; + }; - for (const p of P) { - while (h.length >= 2 && cross(h[h.length - 2], h[h.length - 1], p) <= 0) h.pop(); - h.push(p); - } - - const t = h.length + 1; - for (let i = P.length - 2; i >= 0; i--) { - while (h.length >= t && cross(h[h.length - 2], h[h.length - 1], P[i]) <= 0) h.pop(); - h.push(P[i]); - } - - h.pop(); - return h; + const lower = build(sorted); + const upper = build([...sorted].reverse()); + + lower.pop(); + upper.pop(); + + return [...lower, ...upper]; }; export default findConvexHull; \ No newline at end of file diff --git a/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_2.js b/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_2.js new file mode 100644 index 0000000..1368f4d --- /dev/null +++ b/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_2.js @@ -0,0 +1,18 @@ +const findConvexHull = async (pts) => { + const _ = (await import('https://cdn.jsdelivr.net/npm/lodash@4.17.21/+esm')).default; + const u = _.uniqWith(pts, _.isEqual); + if (u.length < 3) return u; + const s = _.sortBy(u, ['x', 'y']); + const k = (a, b, c) => (b.x - a.x) * (c.y - a.y) - (b.y - a.y) * (c.x - a.x); + const b = (list, h = []) => { + for (const p of list) { + while (h.length > 1 && k(h[h.length - 2], h[h.length - 1], p) <= 0) h.pop(); + h.push(p); + } + return h; + }; + const l = b(s); + const r = b(s.reverse()); + return l.slice(0, -1).concat(r.slice(0, -1)); +}; +export default findConvexHull; \ No newline at end of file diff --git a/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_0.1.js b/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_0.1.js index 2e94416..17e1ff1 100644 --- a/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_0.1.js +++ b/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_0.1.js @@ -1,7 +1,9 @@ -const findLISLength = async nums => { - const { bisectLeft } = await import('https://esm.sh/d3-array') +const findLISLength = async (nums) => { + const { bisectLeft } = await import('https://cdn.jsdelivr.net/npm/d3-array@3/+esm') const tails = [] - for (const n of nums) tails[bisectLeft(tails, n)] = n + for (const x of nums) { + tails[bisectLeft(tails, x)] = x + } return tails.length } export default findLISLength; \ No newline at end of file diff --git a/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_0.2.js b/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_0.2.js index af73b89..5266350 100644 --- a/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_0.2.js +++ b/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_0.2.js @@ -1,7 +1,7 @@ -const findLISLength = async a => { - const { bisectLeft: b } = await import('https://cdn.jsdelivr.net/npm/d3-array@3/+esm') - const t = [] - for (const n of a) t[b(t, n)] = n - return t.length +const findLISLength = async nums => { + const { bisectLeft } = await import('https://cdn.jsdelivr.net/npm/d3-array@3/+esm') + const tails = [] + for (const n of nums) tails[bisectLeft(tails, n)] = n + return tails.length } export default findLISLength; \ No newline at end of file diff --git a/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_0.3.js b/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_0.3.js index 2e94416..2a3ce9b 100644 --- a/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_0.3.js +++ b/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_0.3.js @@ -1,7 +1,11 @@ -const findLISLength = async nums => { - const { bisectLeft } = await import('https://esm.sh/d3-array') +const findLISLength = async (arr) => { + if (!arr?.length) return 0 + const { bisectLeft } = await import('https://cdn.jsdelivr.net/npm/d3-array@3/+esm') const tails = [] - for (const n of nums) tails[bisectLeft(tails, n)] = n + for (const n of arr) { + const i = bisectLeft(tails, n) + i < tails.length ? tails[i] = n : tails.push(n) + } return tails.length } export default findLISLength; \ No newline at end of file diff --git a/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_0.4.js b/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_0.4.js index 5266350..2e94416 100644 --- a/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_0.4.js +++ b/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_0.4.js @@ -1,5 +1,5 @@ const findLISLength = async nums => { - const { bisectLeft } = await import('https://cdn.jsdelivr.net/npm/d3-array@3/+esm') + const { bisectLeft } = await import('https://esm.sh/d3-array') const tails = [] for (const n of nums) tails[bisectLeft(tails, n)] = n return tails.length diff --git a/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_0.5.js b/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_0.5.js index 7b3833d..a0a1935 100644 --- a/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_0.5.js +++ b/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_0.5.js @@ -1,7 +1,7 @@ -const findLISLength = async (nums) => { - const { bisectLeft } = await import('https://cdn.jsdelivr.net/npm/d3-array@3/+esm') - const tails = [] - for (const x of nums) tails[bisectLeft(tails, x)] = x - return tails.length +const findLISLength = async a => { + const { bisectLeft: b } = await import('https://esm.sh/d3-array') + const t = [] + for (const n of a) t[b(t, n)] = n + return t.length } export default findLISLength; \ No newline at end of file diff --git a/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_0.6.js b/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_0.6.js index 90c831b..2e94416 100644 --- a/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_0.6.js +++ b/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_0.6.js @@ -1,11 +1,7 @@ -const findLISLength = async (nums) => { +const findLISLength = async nums => { const { bisectLeft } = await import('https://esm.sh/d3-array') const tails = [] - - for (const x of nums) { - tails[bisectLeft(tails, x)] = x - } - + for (const n of nums) tails[bisectLeft(tails, n)] = n return tails.length } export default findLISLength; \ No newline at end of file diff --git a/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_0.7.js b/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_0.7.js index 38f3539..5266350 100644 --- a/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_0.7.js +++ b/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_0.7.js @@ -1,9 +1,7 @@ -const findLISLength = async n => { - const { bisectLeft: b } = await import('https://cdn.jsdelivr.net/npm/d3-array@3/+esm') - const t = [] - for (const x of n) { - t[b(t, x)] = x - } - return t.length +const findLISLength = async nums => { + const { bisectLeft } = await import('https://cdn.jsdelivr.net/npm/d3-array@3/+esm') + const tails = [] + for (const n of nums) tails[bisectLeft(tails, n)] = n + return tails.length } export default findLISLength; \ No newline at end of file diff --git a/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_0.8.js b/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_0.8.js index 8843d33..a0a1935 100644 --- a/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_0.8.js +++ b/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_0.8.js @@ -1,7 +1,7 @@ -const findLISLength = async nums => { - const { bisectLeft: search } = await import('https://cdn.jsdelivr.net/npm/d3-array@3/+esm') - const tails = [] - for (const n of nums) tails[search(tails, n)] = n - return tails.length +const findLISLength = async a => { + const { bisectLeft: b } = await import('https://esm.sh/d3-array') + const t = [] + for (const n of a) t[b(t, n)] = n + return t.length } export default findLISLength; \ No newline at end of file diff --git a/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_0.9.js b/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_0.9.js index ba40fa8..fdd4e1b 100644 --- a/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_0.9.js +++ b/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_0.9.js @@ -1,7 +1,7 @@ -const findLISLength = async n => { - const { bisectLeft: b } = await import('https://cdn.jsdelivr.net/npm/d3-array@3/+esm') - const t = [] - for (const x of n) t[b(t, x)] = x - return t.length +const findLISLength = async a => { + const { bisectLeft: b } = await import('https://esm.sh/d3-array') + const q = [] + for (const n of a) q[b(q, n)] = n + return q.length } export default findLISLength; \ No newline at end of file diff --git a/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_1.1.js b/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_1.1.js index af73b89..ce2380f 100644 --- a/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_1.1.js +++ b/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_1.1.js @@ -1,7 +1,10 @@ -const findLISLength = async a => { - const { bisectLeft: b } = await import('https://cdn.jsdelivr.net/npm/d3-array@3/+esm') +async function findLISLength(a) { + const { bisectLeft: b } = await import('https://cdn.jsdelivr.net/npm/d3-array/+esm') const t = [] - for (const n of a) t[b(t, n)] = n + for (const n of a) { + const i = b(t, n) + i < t.length ? t[i] = n : t.push(n) + } return t.length } export default findLISLength; \ No newline at end of file diff --git a/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_1.2.js b/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_1.2.js new file mode 100644 index 0000000..5266350 --- /dev/null +++ b/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_1.2.js @@ -0,0 +1,7 @@ +const findLISLength = async nums => { + const { bisectLeft } = await import('https://cdn.jsdelivr.net/npm/d3-array@3/+esm') + const tails = [] + for (const n of nums) tails[bisectLeft(tails, n)] = n + return tails.length +} +export default findLISLength; \ No newline at end of file diff --git a/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_1.3.js b/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_1.3.js new file mode 100644 index 0000000..4df647c --- /dev/null +++ b/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_1.3.js @@ -0,0 +1,10 @@ +const findLISLength = async a => { + const { bisectLeft: b } = await import('https://esm.sh/d3-array') + const t = [] + for (const v of a) { + const i = b(t, v) + i < t.length ? t[i] = v : t.push(v) + } + return t.length +} +export default findLISLength; \ No newline at end of file diff --git a/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_1.4.js b/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_1.4.js new file mode 100644 index 0000000..5a36d79 --- /dev/null +++ b/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_1.4.js @@ -0,0 +1,10 @@ +const findLISLength = async (n) => { + const { bisectLeft: b } = await import('https://cdn.jsdelivr.net/npm/d3-array@3/+esm') + const t = [] + for (const v of n) { + const i = b(t, v) + i < t.length ? t[i] = v : t.push(v) + } + return t.length +} +export default findLISLength; \ No newline at end of file diff --git a/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_1.5.js b/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_1.5.js new file mode 100644 index 0000000..0252104 --- /dev/null +++ b/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_1.5.js @@ -0,0 +1,7 @@ +const findLISLength = async (nums) => { + const { bisectLeft: b } = await import('https://esm.sh/d3-array@3'); + const t = []; + for (const n of nums) t[b(t, n)] = n; + return t.length; +}; +export default findLISLength; \ No newline at end of file diff --git a/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_1.6.js b/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_1.6.js new file mode 100644 index 0000000..3f609e2 --- /dev/null +++ b/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_1.6.js @@ -0,0 +1,9 @@ +const findLISLength = async (nums) => { + const { bisectLeft } = await import('https://esm.sh/d3-array@3'); + const tails = []; + for (const n of nums) { + tails[bisectLeft(tails, n)] = n; + } + return tails.length; +}; +export default findLISLength; \ No newline at end of file diff --git a/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_1.7.js b/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_1.7.js new file mode 100644 index 0000000..84efb2b --- /dev/null +++ b/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_1.7.js @@ -0,0 +1,7 @@ +const findLISLength = async nums => { + const { bisectLeft: search } = await import('https://esm.sh/d3-array') + const tails = [] + for (const n of nums) tails[search(tails, n)] = n + return tails.length +} +export default findLISLength; \ No newline at end of file diff --git a/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_1.8.js b/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_1.8.js new file mode 100644 index 0000000..348f309 --- /dev/null +++ b/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_1.8.js @@ -0,0 +1,7 @@ +const findLISLength = async (n) => { + const { bisectLeft: b } = await import('https://esm.run/d3-array') + const t = [] + for (const v of n) t[b(t, v)] = v + return t.length +} +export default findLISLength; \ No newline at end of file diff --git a/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_1.9.js b/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_1.9.js new file mode 100644 index 0000000..067fb61 --- /dev/null +++ b/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_1.9.js @@ -0,0 +1,9 @@ +const findLISLength = async (nums) => { + const { bisectLeft } = await import('https://esm.sh/d3-array'); + const tails = []; + for (const n of nums) { + tails[bisectLeft(tails, n)] = n; + } + return tails.length; +}; +export default findLISLength; \ No newline at end of file diff --git a/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_1.js b/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_1.js index 866a044..af73b89 100644 --- a/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_1.js +++ b/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_1.js @@ -1,9 +1,7 @@ -const findLISLength = async nums => { - const { bisectLeft } = await import('https://esm.sh/d3-array') - const sub = [] - for (const n of nums) { - sub[bisectLeft(sub, n)] = n - } - return sub.length +const findLISLength = async a => { + const { bisectLeft: b } = await import('https://cdn.jsdelivr.net/npm/d3-array@3/+esm') + const t = [] + for (const n of a) t[b(t, n)] = n + return t.length } export default findLISLength; \ No newline at end of file diff --git a/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_2.js b/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_2.js new file mode 100644 index 0000000..e415160 --- /dev/null +++ b/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_2.js @@ -0,0 +1,9 @@ +const findLISLength = async (nums) => { + const { bisectLeft } = await import("https://cdn.jsdelivr.net/npm/d3-array@3/+esm"); + const tails = []; + for (const n of nums) { + tails[bisectLeft(tails, n)] = n; + } + return tails.length; +}; +export default findLISLength; \ No newline at end of file diff --git a/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_0.1.js b/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_0.1.js index 752ccfd..146821a 100644 --- a/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_0.1.js +++ b/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_0.1.js @@ -1,4 +1,5 @@ -const calculateDeterminant = async m => - (await import('https://cdn.jsdelivr.net/npm/mathjs@12/+esm')) - .det(m) +const calculateDeterminant = async m => { + const { det } = await import('https://cdn.jsdelivr.net/npm/mathjs@12/+esm') + return det(m) +} export default calculateDeterminant; \ No newline at end of file diff --git a/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_0.2.js b/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_0.2.js index cb1fdbb..300cb1c 100644 --- a/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_0.2.js +++ b/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_0.2.js @@ -1,4 +1,4 @@ const calculateDeterminant = async m => - (await import('https://esm.sh/mathjs')) - .det(m) + (await import('https://cdn.jsdelivr.net/npm/mathjs@12/+esm')) + .det(m) export default calculateDeterminant; \ No newline at end of file diff --git a/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_0.3.js b/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_0.3.js index 76c0957..b294f8b 100644 --- a/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_0.3.js +++ b/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_0.3.js @@ -1,4 +1,5 @@ -const calculateDeterminant = async m => - (await import('https://cdn.jsdelivr.net/npm/mathjs/+esm')) - .det(m) +const calculateDeterminant = async m => { + const { det } = await import('https://cdn.jsdelivr.net/npm/mathjs/+esm') + return det(m) +} export default calculateDeterminant; \ No newline at end of file diff --git a/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_0.4.js b/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_0.4.js index 2d831e5..2cc696b 100644 --- a/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_0.4.js +++ b/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_0.4.js @@ -1,5 +1,4 @@ -const calculateDeterminant = async m => { - const { det } = await import('https://esm.sh/mathjs@12') - return det(m) -} +const calculateDeterminant = async m => + (await import('https://esm.sh/mathjs@12')) + .det(m) export default calculateDeterminant; \ No newline at end of file diff --git a/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_0.6.js b/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_0.6.js index 84bcba8..b294f8b 100644 --- a/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_0.6.js +++ b/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_0.6.js @@ -1,5 +1,5 @@ const calculateDeterminant = async m => { - const { det } = await import('https://esm.sh/mathjs') + const { det } = await import('https://cdn.jsdelivr.net/npm/mathjs/+esm') return det(m) } export default calculateDeterminant; \ No newline at end of file diff --git a/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_0.7.js b/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_0.7.js index 2d831e5..b294f8b 100644 --- a/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_0.7.js +++ b/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_0.7.js @@ -1,5 +1,5 @@ const calculateDeterminant = async m => { - const { det } = await import('https://esm.sh/mathjs@12') + const { det } = await import('https://cdn.jsdelivr.net/npm/mathjs/+esm') return det(m) } export default calculateDeterminant; \ No newline at end of file diff --git a/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_0.8.js b/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_0.8.js index 2d831e5..146821a 100644 --- a/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_0.8.js +++ b/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_0.8.js @@ -1,5 +1,5 @@ const calculateDeterminant = async m => { - const { det } = await import('https://esm.sh/mathjs@12') + const { det } = await import('https://cdn.jsdelivr.net/npm/mathjs@12/+esm') return det(m) } export default calculateDeterminant; \ No newline at end of file diff --git a/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_0.9.js b/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_0.9.js index 84bcba8..c707d6f 100644 --- a/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_0.9.js +++ b/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_0.9.js @@ -1,5 +1,5 @@ const calculateDeterminant = async m => { - const { det } = await import('https://esm.sh/mathjs') + const { det } = await import('https://cdn.jsdelivr.net/npm/mathjs@13/+esm') return det(m) } export default calculateDeterminant; \ No newline at end of file diff --git a/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_1.1.js b/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_1.1.js index e72123e..146821a 100644 --- a/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_1.1.js +++ b/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_1.1.js @@ -1,5 +1,5 @@ const calculateDeterminant = async m => { - const { det } = await import('https://esm.sh/mathjs@13.0.0') + const { det } = await import('https://cdn.jsdelivr.net/npm/mathjs@12/+esm') return det(m) } export default calculateDeterminant; \ No newline at end of file diff --git a/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_1.2.js b/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_1.2.js new file mode 100644 index 0000000..2d831e5 --- /dev/null +++ b/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_1.2.js @@ -0,0 +1,5 @@ +const calculateDeterminant = async m => { + const { det } = await import('https://esm.sh/mathjs@12') + return det(m) +} +export default calculateDeterminant; \ No newline at end of file diff --git a/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_1.3.js b/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_1.3.js new file mode 100644 index 0000000..27892d1 --- /dev/null +++ b/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_1.3.js @@ -0,0 +1,5 @@ +const calculateDeterminant = async matrix => { + const { det } = await import('https://cdn.jsdelivr.net/npm/mathjs/+esm') + return det(matrix) +} +export default calculateDeterminant; \ No newline at end of file diff --git a/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_1.4.js b/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_1.4.js new file mode 100644 index 0000000..84bcba8 --- /dev/null +++ b/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_1.4.js @@ -0,0 +1,5 @@ +const calculateDeterminant = async m => { + const { det } = await import('https://esm.sh/mathjs') + return det(m) +} +export default calculateDeterminant; \ No newline at end of file diff --git a/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_1.5.js b/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_1.5.js new file mode 100644 index 0000000..2d831e5 --- /dev/null +++ b/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_1.5.js @@ -0,0 +1,5 @@ +const calculateDeterminant = async m => { + const { det } = await import('https://esm.sh/mathjs@12') + return det(m) +} +export default calculateDeterminant; \ No newline at end of file diff --git a/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_1.6.js b/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_1.6.js new file mode 100644 index 0000000..b294f8b --- /dev/null +++ b/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_1.6.js @@ -0,0 +1,5 @@ +const calculateDeterminant = async m => { + const { det } = await import('https://cdn.jsdelivr.net/npm/mathjs/+esm') + return det(m) +} +export default calculateDeterminant; \ No newline at end of file diff --git a/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_1.7.js b/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_1.7.js new file mode 100644 index 0000000..db5a424 --- /dev/null +++ b/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_1.7.js @@ -0,0 +1,5 @@ +const calculateDeterminant = async matrix => { + const { det } = await import('https://esm.sh/mathjs@12'); + return det(matrix); +}; +export default calculateDeterminant; \ No newline at end of file diff --git a/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_1.8.js b/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_1.8.js new file mode 100644 index 0000000..a2ede75 --- /dev/null +++ b/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_1.8.js @@ -0,0 +1,4 @@ +const calculateDeterminant = async m => + (await import('https://cdn.jsdelivr.net/npm/mathjs/+esm')) + .det(m) +export default calculateDeterminant; \ No newline at end of file diff --git a/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_1.9.js b/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_1.9.js new file mode 100644 index 0000000..f3b16cd --- /dev/null +++ b/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_1.9.js @@ -0,0 +1,5 @@ +const calculateDeterminant = async matrix => { + const { det } = await import('https://cdn.skypack.dev/mathjs') + return det(matrix) +} +export default calculateDeterminant; \ No newline at end of file diff --git a/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_1.js b/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_1.js index b294f8b..146821a 100644 --- a/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_1.js +++ b/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_1.js @@ -1,5 +1,5 @@ const calculateDeterminant = async m => { - const { det } = await import('https://cdn.jsdelivr.net/npm/mathjs/+esm') + const { det } = await import('https://cdn.jsdelivr.net/npm/mathjs@12/+esm') return det(m) } export default calculateDeterminant; \ No newline at end of file diff --git a/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_2.js b/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_2.js new file mode 100644 index 0000000..2d831e5 --- /dev/null +++ b/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_2.js @@ -0,0 +1,5 @@ +const calculateDeterminant = async m => { + const { det } = await import('https://esm.sh/mathjs@12') + return det(m) +} +export default calculateDeterminant; \ No newline at end of file diff --git a/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_0.1.js b/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_0.1.js index 9fd9d4c..746bed9 100644 --- a/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_0.1.js +++ b/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_0.1.js @@ -1,5 +1,8 @@ -const parseMarkdown = async t => { - const { parse } = await import('https://esm.sh/marked') - return parse(t ?? '') +const parseMarkdown = async s => { + const [{ marked: m }, { default: p }] = await Promise.all([ + import('https://cdn.jsdelivr.net/npm/marked/lib/marked.esm.js'), + import('https://cdn.jsdelivr.net/npm/dompurify/dist/purify.es.js') + ]) + return p.sanitize(m.parse(s)) } export default parseMarkdown; \ No newline at end of file diff --git a/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_0.2.js b/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_0.2.js index 2766dea..373d7b2 100644 --- a/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_0.2.js +++ b/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_0.2.js @@ -1,5 +1,5 @@ -const parseMarkdown = async s => { - const { parse } = await import('https://esm.sh/marked@12.0.1') - return parse(s) -} +const parseMarkdown = async (text) => { + const { parse } = await import('https://esm.sh/marked'); + return parse(text); +}; export default parseMarkdown; \ No newline at end of file diff --git a/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_0.3.js b/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_0.3.js index 6ae9870..c853bc8 100644 --- a/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_0.3.js +++ b/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_0.3.js @@ -1,5 +1,5 @@ -const parseMarkdown = async md => { - const { parse } = await import('https://esm.sh/marked@12.0.1') - return parse(md) +const parseMarkdown = async (md) => { + const { parse } = await import('https://cdn.jsdelivr.net/npm/marked/+esm') + return parse(md || '') } export default parseMarkdown; \ No newline at end of file diff --git a/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_0.4.js b/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_0.4.js index 460483f..0dc632c 100644 --- a/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_0.4.js +++ b/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_0.4.js @@ -1,5 +1,5 @@ -const parseMarkdown = async m => ( - (await import('https://esm.sh/marked@12.0.0')) - .parse(m) -) +const parseMarkdown = async (md) => { + const { parse } = await import('https://esm.sh/marked'); + return parse(md); +}; export default parseMarkdown; \ No newline at end of file diff --git a/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_0.5.js b/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_0.5.js index 89e5bee..1be7a95 100644 --- a/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_0.5.js +++ b/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_0.5.js @@ -1,5 +1,11 @@ -const parseMarkdown = async md => { - const { marked } = await import('https://cdn.jsdelivr.net/npm/marked@12.0.1/lib/marked.esm.js') - return marked.parse(md) +const parseMarkdown = async s => { + if (typeof s !== 'string') return '' + try { + const { parse } = await import('https://cdn.jsdelivr.net/npm/marked/+esm') + return parse(s) + } catch (e) { + console.error(e) + return '' + } } export default parseMarkdown; \ No newline at end of file diff --git a/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_0.6.js b/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_0.6.js index da8577e..b64633c 100644 --- a/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_0.6.js +++ b/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_0.6.js @@ -1,7 +1,5 @@ -let parser - -const parseMarkdown = async (md) => { - parser ??= (await import('https://cdn.jsdelivr.net/npm/marked/+esm')).parse - return parser(md) +const parseMarkdown = async md => { + const { marked } = await import('https://esm.sh/marked@12') + return marked.parse(md) } export default parseMarkdown; \ No newline at end of file diff --git a/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_0.7.js b/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_0.7.js index 9e3efc0..63516ca 100644 --- a/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_0.7.js +++ b/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_0.7.js @@ -1,5 +1,5 @@ -const parseMarkdown = async md => { - const { parse } = await import('https://cdn.jsdelivr.net/npm/marked@12/+esm') - return parse(md) +const parseMarkdown = async (md) => { + const { parse } = await import('https://esm.sh/marked@12.0.1') + return parse(md ?? '') } export default parseMarkdown; \ No newline at end of file diff --git a/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_0.8.js b/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_0.8.js index 7ab6846..3010d5a 100644 --- a/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_0.8.js +++ b/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_0.8.js @@ -1,5 +1,5 @@ -const parseMarkdown = async s => { - const { parse } = await import('https://esm.sh/marked@12.0.2') - return parse(s + '') -} +const parseMarkdown = async (md) => { + const { parse } = await import('https://esm.sh/marked@12'); + return parse(md || ''); +}; export default parseMarkdown; \ No newline at end of file diff --git a/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_0.9.js b/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_0.9.js index 851491f..e9298c9 100644 --- a/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_0.9.js +++ b/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_0.9.js @@ -1,5 +1,5 @@ -const parseMarkdown = async (md) => { - const { parse } = await import('https://cdn.jsdelivr.net/npm/marked@12.0.2/+esm') - return parse(md) +const parseMarkdown = async (content = '') => { + const { marked } = await import('https://cdn.jsdelivr.net/npm/marked@12.0.2/+esm') + return marked.parse(content) } export default parseMarkdown; \ No newline at end of file diff --git a/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_1.1.js b/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_1.1.js index 26b0bf4..a2e3de8 100644 --- a/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_1.1.js +++ b/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_1.1.js @@ -1,9 +1,5 @@ -const parseMarkdown = async t => { - const { parse: p } = await import('https://esm.sh/marked@12') - return p(t, { - async: false, - breaks: true, - gfm: true - }) -} +const parseMarkdown = async s => { + const { parse: p } = await import('https://esm.sh/marked@12'); + return p(s); +}; export default parseMarkdown; \ No newline at end of file diff --git a/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_1.2.js b/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_1.2.js new file mode 100644 index 0000000..d9c12da --- /dev/null +++ b/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_1.2.js @@ -0,0 +1,5 @@ +const parseMarkdown = async (md) => { + const { marked: p } = await import('https://cdn.jsdelivr.net/npm/marked/+esm') + return p.parse(md || '') +} +export default parseMarkdown; \ No newline at end of file diff --git a/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_1.3.js b/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_1.3.js new file mode 100644 index 0000000..2766dea --- /dev/null +++ b/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_1.3.js @@ -0,0 +1,5 @@ +const parseMarkdown = async s => { + const { parse } = await import('https://esm.sh/marked@12.0.1') + return parse(s) +} +export default parseMarkdown; \ No newline at end of file diff --git a/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_1.4.js b/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_1.4.js new file mode 100644 index 0000000..9926a11 --- /dev/null +++ b/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_1.4.js @@ -0,0 +1,10 @@ +export const parseMarkdown = async (str) => { + const ref = parseMarkdown; + ref.lib ||= (await import('https://esm.sh/marked@12.0.1')).marked; + return ref.lib.parse(str || '', { + async: false, + gfm: true, + breaks: true + }); +}; +export default parseMarkdown; \ No newline at end of file diff --git a/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_1.5.js b/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_1.5.js new file mode 100644 index 0000000..5cd0944 --- /dev/null +++ b/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_1.5.js @@ -0,0 +1,5 @@ +const parseMarkdown = async m => { + const { parse: p } = await import('https://esm.sh/marked@12.0.2') + return p(m ?? '') +} +export default parseMarkdown; \ No newline at end of file diff --git a/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_1.6.js b/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_1.6.js new file mode 100644 index 0000000..8e4beb6 --- /dev/null +++ b/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_1.6.js @@ -0,0 +1,5 @@ +const parseMarkdown = async s => { + const { parse } = await import('https://esm.sh/marked@12') + return parse(s) +} +export default parseMarkdown; \ No newline at end of file diff --git a/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_1.7.js b/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_1.7.js new file mode 100644 index 0000000..0f85fa8 --- /dev/null +++ b/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_1.7.js @@ -0,0 +1,5 @@ +const parseMarkdown = async md => { + const { parse } = await import('https://cdn.jsdelivr.net/npm/marked/+esm') + return parse(md) +} +export default parseMarkdown; \ No newline at end of file diff --git a/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_1.8.js b/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_1.8.js new file mode 100644 index 0000000..ec97cae --- /dev/null +++ b/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_1.8.js @@ -0,0 +1,4 @@ +const parseMarkdown = async md => ( + await import('https://esm.sh/marked@12') +).parse(md, { gfm: true, breaks: true }) +export default parseMarkdown; \ No newline at end of file diff --git a/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_1.9.js b/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_1.9.js new file mode 100644 index 0000000..11f9f1e --- /dev/null +++ b/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_1.9.js @@ -0,0 +1,5 @@ +export const parseMarkdown = async (md = '') => { + const { parse } = await import('https://esm.sh/marked@12.0.1') + return parse(md) +} +export default parseMarkdown; \ No newline at end of file diff --git a/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_1.js b/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_1.js index a87c9a4..41de67a 100644 --- a/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_1.js +++ b/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_1.js @@ -1,4 +1,5 @@ -const parseMarkdown = async s => - (await import('https://cdn.jsdelivr.net/npm/marked/+esm')) - .parse(s) +const parseMarkdown = async (md = '') => { + const { parse } = await import('https://esm.sh/marked@12') + return parse(md) +} export default parseMarkdown; \ No newline at end of file diff --git a/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_2.js b/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_2.js new file mode 100644 index 0000000..e98a618 --- /dev/null +++ b/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_2.js @@ -0,0 +1,5 @@ +const parseMarkdown = async (md) => { + const { parse } = await import('https://esm.run/marked') + return parse(md ?? '', { async: false }) +} +export default parseMarkdown; \ No newline at end of file diff --git a/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_0.1.js b/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_0.1.js index 3adcde9..56fe33d 100644 --- a/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_0.1.js +++ b/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_0.1.js @@ -1,18 +1,20 @@ -const processCSV = async (csv, { filterColumn: fc, filterValue: fv, groupBy: gb, aggregateColumn: ac, operation: op }) => { - const { parse } = (await import('https://cdn.jsdelivr.net/npm/papaparse@5.4.1/+esm')).default - const { data } = parse(csv, { header: true, skipEmptyLines: true }) +const processCSV = async (csvString, { filterColumn, filterValue, groupBy, aggregateColumn, operation }) => { + const { csvParse, rollup, sum, mean } = await import('https://esm.sh/d3@7'); + + const toNum = d => +d[aggregateColumn] || 0; + + const aggregators = { + sum: g => sum(g, toNum), + avg: g => mean(g, toNum), + count: g => g.length + }; - return Object.entries(data.reduce((a, r) => { - if (r[fc] == fv) { - const k = r[gb], v = +r[ac] || 0 - a[k] ??= { s: 0, c: 0 } - a[k].s += v - a[k].c++ - } - return a - }, {})).map(([k, { s, c }]) => ({ - [gb]: k, - result: op === 'count' ? c : op === 'avg' ? s / c : s - })) -} + const data = csvParse(csvString).filter(row => row[filterColumn] == filterValue); + const grouped = rollup(data, aggregators[operation], d => d[groupBy]); + + return Array.from(grouped, ([key, val]) => ({ + [groupBy]: key, + result: val + })); +}; export default processCSV; \ No newline at end of file diff --git a/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_0.2.js b/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_0.2.js index 4bf5afe..665036e 100644 --- a/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_0.2.js +++ b/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_0.2.js @@ -1,17 +1,24 @@ -export const processCSV = async (str, { filterColumn: fc, filterValue: fv, groupBy: gb, aggregateColumn: ac, operation: op }) => { - const [{ parse }, { filter, groupBy, map, sum }] = await Promise.all([ - import('https://cdn.jsdelivr.net/npm/papaparse@5.4.1/+esm'), - import('https://cdn.jsdelivr.net/npm/lodash-es@4.17.21/+esm') - ]) +const processCSV = async (csvString, config) => { + const { default: Papa } = await import('https://esm.sh/papaparse@5.4.1'); + const { filterColumn: fc, filterValue: fv, groupBy: gb, aggregateColumn: ac, operation: op } = config; - const { data } = parse(str, { header: true, skipEmptyLines: true }) - const rows = filter(data, r => r[fc] == fv) + const { data } = Papa.parse(csvString, { header: true, skipEmptyLines: true }); - return map(groupBy(rows, gb), (group, key) => { - const vals = map(group, r => +r[ac] || 0) - const total = sum(vals) - const res = op === 'count' ? group.length : op === 'sum' ? total : total / group.length - return { [gb]: key, result: res } - }) -} + const groups = data.reduce((acc, row) => { + if (row[fc] == fv) { + const key = row[gb]; + const val = +row[ac] || 0; + + acc[key] ??= { sum: 0, count: 0 }; + acc[key].sum += val; + acc[key].count++; + } + return acc; + }, {}); + + return Object.entries(groups).map(([key, { sum, count }]) => ({ + [gb]: key, + result: op === 'count' ? count : op === 'sum' ? sum : sum / count + })); +}; export default processCSV; \ No newline at end of file diff --git a/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_0.3.js b/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_0.3.js index 222228d..4b13f3a 100644 --- a/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_0.3.js +++ b/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_0.3.js @@ -1,18 +1,25 @@ const processCSV = async (csvString, { filterColumn, filterValue, groupBy, aggregateColumn, operation }) => { - const [{ csvParse }, { rollup, sum, mean }] = await Promise.all([ - import('https://cdn.jsdelivr.net/npm/d3-dsv@3/+esm'), - import('https://cdn.jsdelivr.net/npm/d3-array@3/+esm') - ]); + const [{ default: { parse } }, { rollup, sum, mean }] = await Promise.all([ + import('https://esm.sh/papaparse@5.4.1'), + import('https://esm.sh/d3-array@3.2.4') + ]); - const getValue = d => +d[aggregateColumn] || 0; - const data = csvParse(csvString).filter(d => d[filterColumn] == filterValue); - - const aggregated = rollup( - data, - g => operation === 'count' ? g.length : (operation === 'sum' ? sum : mean)(g, getValue), - d => d[groupBy] - ); + const getNum = row => { + const val = parseFloat(row[aggregateColumn]); + return isNaN(val) ? 0 : val; + }; - return Array.from(aggregated, ([key, result]) => ({ [groupBy]: key, result })); + const rows = parse(csvString, { header: true, skipEmptyLines: true }).data + .filter(row => row[filterColumn] == filterValue); + + const grouped = rollup( + rows, + group => operation === 'count' ? group.length : + operation === 'sum' ? sum(group, getNum) : + mean(group, getNum), + row => row[groupBy] + ); + + return Array.from(grouped, ([key, result]) => ({ [groupBy]: key, result })); }; export default processCSV; \ No newline at end of file diff --git a/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_0.4.js b/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_0.4.js index 5ec8f08..6afa630 100644 --- a/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_0.4.js +++ b/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_0.4.js @@ -1,22 +1,19 @@ -const processCSV = async (csvString, { filterColumn: fc, filterValue: fv, groupBy: gb, aggregateColumn: ac, operation: op }) => { - const { parse } = await import('https://cdn.jsdelivr.net/npm/papaparse@5.4.1/+esm') - const { data } = parse(csvString, { header: true, skipEmptyLines: true }) +const processCSV = async (csv, { filterColumn: fc, filterValue: fv, groupBy: gb, aggregateColumn: ac, operation: op }) => { + const { csvParse } = await import('https://esm.run/d3-dsv') const groups = new Map() - for (const row of data) { + csvParse(csv).forEach(row => { if (row[fc] == fv) { const key = row[gb] const val = +row[ac] || 0 - const acc = groups.get(key) || { sum: 0, count: 0 } - acc.sum += val - acc.count += 1 - groups.set(key, acc) + const curr = groups.get(key) || { s: 0, n: 0 } + groups.set(key, { s: curr.s + val, n: curr.n + 1 }) } - } + }) - return Array.from(groups, ([key, { sum, count }]) => ({ + return [...groups].map(([key, { s, n }]) => ({ [gb]: key, - result: op === 'count' ? count : op === 'sum' ? sum : sum / count + result: op === 'count' ? n : op === 'sum' ? s : s / n })) } export default processCSV; \ No newline at end of file diff --git a/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_0.5.js b/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_0.5.js index 771b07f..34f64ea 100644 --- a/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_0.5.js +++ b/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_0.5.js @@ -1,18 +1,21 @@ -const processCSV = async (csv, { filterColumn: fc, filterValue: fv, groupBy: gb, aggregateColumn: ac, operation: op }) => { - const [{ default: Papa }, { default: _ }] = await Promise.all([ - import('https://esm.sh/papaparse@5.4.1'), - import('https://esm.sh/lodash@4.17.21') - ]) - - const { data } = Papa.parse(csv, { header: true, skipEmptyLines: true }) +const processCSV = async (csvStr, { filterColumn: fCol, filterValue: fVal, groupBy: gBy, aggregateColumn: aggCol, operation: op }) => { + const { default: Papa } = await import('https://cdn.jsdelivr.net/npm/papaparse@5.4.1/+esm') + const { data } = Papa.parse(csvStr, { header: true, skipEmptyLines: true }) - return _.map(_.groupBy(_.filter(data, r => r[fc] == fv), gb), (rows, k) => { - const vals = rows.map(r => +r[ac] || 0) - const sum = _.sum(vals) - return { - [gb]: k, - result: op === 'count' ? vals.length : op === 'sum' ? sum : sum / vals.length + const groups = data.reduce((acc, row) => { + if (row[fCol] == fVal) { + const key = row[gBy] + const val = +row[aggCol] || 0 + acc[key] = acc[key] || { s: 0, c: 0 } + acc[key].s += val + acc[key].c++ } - }) + return acc + }, {}) + + return Object.entries(groups).map(([key, { s, c }]) => ({ + [gBy]: key, + result: op === 'count' ? c : op === 'avg' ? s / c : s + })) } export default processCSV; \ No newline at end of file diff --git a/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_0.6.js b/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_0.6.js index fb23459..884b38e 100644 --- a/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_0.6.js +++ b/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_0.6.js @@ -1,20 +1,19 @@ const processCSV = async (csv, { filterColumn: fc, filterValue: fv, groupBy: gb, aggregateColumn: ac, operation: op }) => { - const { default: Papa } = await import('https://cdn.jsdelivr.net/npm/papaparse@5.4.1/+esm') - const { data } = Papa.parse(csv, { header: true, skipEmptyLines: true }) + const [{ csvParse }, { rollup, sum, mean }] = await Promise.all([ + import('https://esm.sh/d3-dsv@3'), + import('https://esm.sh/d3-array@3') + ]); - const groups = data.reduce((acc, row) => { - if (row[fc] == fv) { - const k = row[gb], v = +row[ac] || 0 - acc[k] = acc[k] || { s: 0, c: 0 } - acc[k].s += v - acc[k].c++ - } - return acc - }, {}) - - return Object.entries(groups).map(([k, { s, c }]) => ({ - [gb]: k, - result: op === 'count' ? c : op === 'avg' ? s / c : s - })) -} + return Array.from( + rollup( + csvParse(csv).filter(d => d[fc] == fv), + g => { + const v = g.map(d => +d[ac] || 0); + return op === 'count' ? v.length : op === 'sum' ? sum(v) : mean(v); + }, + d => d[gb] + ), + ([k, v]) => ({ [gb]: k, result: v }) + ); +}; export default processCSV; \ No newline at end of file diff --git a/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_0.7.js b/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_0.7.js index 89ef65f..9ae151f 100644 --- a/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_0.7.js +++ b/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_0.7.js @@ -1,18 +1,21 @@ -const processCSV = async (csv, cfg) => { - const [{default: P}, {default: _}] = await Promise.all([ - import('https://cdn.jsdelivr.net/npm/papaparse@5.4.1/+esm'), - import('https://cdn.jsdelivr.net/npm/lodash@4.17.21/+esm') - ]); +const processCSV = async (csv, { filterColumn, filterValue, groupBy, aggregateColumn, operation }) => { + const { parse } = await import('https://cdn.jsdelivr.net/npm/papaparse@5.4.1/+esm'); + const { data } = parse(csv, { header: true, skipEmptyLines: true }); - const {data} = P.parse(csv, {header: true, skipEmptyLines: true}); - const {filterColumn: fc, filterValue: fv, groupBy: gb, aggregateColumn: ac, operation: op} = cfg; + const groups = data.reduce((acc, row) => { + if (row[filterColumn] == filterValue) { + const key = row[groupBy]; + const val = +row[aggregateColumn] || 0; + acc[key] ||= { sum: 0, count: 0 }; + acc[key].sum += val; + acc[key].count++; + } + return acc; + }, {}); - return _.map(_.groupBy(_.filter(data, r => r[fc] == fv), gb), (rows, key) => { - const vals = rows.map(r => +r[ac] || 0), sum = _.sum(vals); - return { - [gb]: key, - result: op === 'count' ? vals.length : op === 'sum' ? sum : sum / vals.length - }; - }); + return Object.entries(groups).map(([key, { sum, count }]) => ({ + [groupBy]: key, + result: operation === 'count' ? count : operation === 'sum' ? sum : sum / count + })); }; export default processCSV; \ No newline at end of file diff --git a/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_0.8.js b/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_0.8.js index 2e93bab..047bbca 100644 --- a/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_0.8.js +++ b/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_0.8.js @@ -1,21 +1,21 @@ -const processCSV = async (csvString, config) => { - const { parse } = await import('https://cdn.jsdelivr.net/npm/papaparse@5.4.1/+esm'); - const { filterColumn: fc, filterValue: fv, groupBy: gb, aggregateColumn: ac, operation: op } = config; - const acc = {}; +const processCSV = async (csv, { filterColumn: fc, filterValue: fv, groupBy: gb, aggregateColumn: ac, operation: op }) => { + const { default: Papa } = await import('https://esm.sh/papaparse@5.4.1'); + const { data } = Papa.parse(csv, { header: true, skipEmptyLines: true }); - parse(csvString, { header: true, skipEmptyLines: true }).data.forEach(row => { - if (row[fc] == fv) { - const key = row[gb]; - const val = +row[ac] || 0; - const entry = acc[key] ??= { sum: 0, count: 0 }; - entry.sum += val; - entry.count++; - } - }); + const groups = data.reduce((acc, row) => { + if (row[fc] == fv) { + const key = row[gb]; + const val = +row[ac] || 0; + acc[key] = acc[key] || { s: 0, c: 0 }; + acc[key].s += val; + acc[key].c++; + } + return acc; + }, {}); - return Object.entries(acc).map(([key, { sum, count }]) => ({ - [gb]: key, - result: op === 'avg' ? sum / count : op === 'count' ? count : sum - })); + return Object.entries(groups).map(([key, { s, c }]) => ({ + [gb]: key, + result: op === 'count' ? c : op === 'sum' ? s : s / c + })); }; export default processCSV; \ No newline at end of file diff --git a/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_0.9.js b/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_0.9.js index 7797389..0d58ba8 100644 --- a/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_0.9.js +++ b/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_0.9.js @@ -1,20 +1,20 @@ -const processCSV = async (csvStr, { filterColumn: fc, filterValue: fv, groupBy: gb, aggregateColumn: ac, operation: op }) => { - const { csvParse } = await import('https://esm.sh/d3-dsv@3'); - - const groups = csvParse(csvStr).reduce((acc, row) => { - if (row[fc] == fv) { - const key = row[gb], val = +row[ac] || 0; - const entry = acc.get(key) || { s: 0, c: 0 }; - entry.s += val; - entry.c++; - acc.set(key, entry); - } - return acc; - }, new Map()); +const processCSV = async (csv, { filterColumn, filterValue, groupBy, aggregateColumn, operation }) => { + const { parse } = await import('https://cdn.jsdelivr.net/npm/papaparse@5.4.1/+esm'); + const groups = {}; - return Array.from(groups, ([key, { s, c }]) => ({ - [gb]: key, - result: op === 'count' ? c : op === 'sum' ? s : s / c + parse(csv, { header: true, skipEmptyLines: true }).data.forEach(row => { + if (row[filterColumn] == filterValue) { + const key = row[groupBy]; + const val = +row[aggregateColumn] || 0; + const acc = groups[key] ??= { sum: 0, count: 0 }; + acc.sum += val; + acc.count++; + } + }); + + return Object.entries(groups).map(([key, { sum, count }]) => ({ + [groupBy]: key, + result: operation === 'count' ? count : operation === 'avg' ? sum / count : sum })); }; export default processCSV; \ No newline at end of file diff --git a/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_1.1.js b/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_1.1.js index 9dfd98a..174a196 100644 --- a/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_1.1.js +++ b/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_1.1.js @@ -1,21 +1,17 @@ -const processCSV = async (csvString, config) => { - const { csvParse } = await import('https://esm.sh/d3-dsv@3'); - const { filterColumn: fc, filterValue: fv, groupBy: gb, aggregateColumn: ac, operation: op } = config; - - const groups = csvParse(csvString).reduce((acc, row) => { - if (row[fc] == fv) { - const key = row[gb]; - const val = +row[ac] || 0; - acc[key] = acc[key] || { sum: 0, count: 0 }; - acc[key].sum += val; - acc[key].count++; - } - return acc; - }, {}); - - return Object.entries(groups).map(([key, { sum, count }]) => ({ - [gb]: key, - result: op === 'avg' ? sum / count : op === 'count' ? count : sum - })); -}; +const processCSV = async (csv, { filterColumn: fCol, filterValue: fVal, groupBy: gBy, aggregateColumn: aCol, operation: op }) => { + const { csvParse, rollup, sum } = await import('https://cdn.jsdelivr.net/npm/d3@7/+esm') + + return Array.from( + rollup( + csvParse(csv).filter(r => r[fCol] == fVal), + g => { + if (op === 'count') return g.length + const nums = g.map(r => +r[aCol] || 0), total = sum(nums) + return op === 'sum' ? total : total / nums.length + }, + d => d[gBy] + ), + ([k, v]) => ({ [gBy]: k, result: v }) + ) +} export default processCSV; \ No newline at end of file diff --git a/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_1.2.js b/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_1.2.js new file mode 100644 index 0000000..3be6890 --- /dev/null +++ b/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_1.2.js @@ -0,0 +1,20 @@ +const processCSV = async (csvData, { filterColumn, filterValue, groupBy, aggregateColumn, operation }) => { + const { parse } = await import('https://esm.sh/papaparse'); + const groups = {}; + + parse(csvData, { header: true, skipEmptyLines: true }).data.forEach(row => { + if (row[filterColumn] == filterValue) { + const key = row[groupBy]; + const val = +row[aggregateColumn] || 0; + const rec = groups[key] ||= { sum: 0, count: 0 }; + rec.sum += val; + rec.count++; + } + }); + + return Object.entries(groups).map(([key, { sum, count }]) => ({ + [groupBy]: key, + result: operation === 'count' ? count : operation === 'sum' ? sum : sum / count + })); +}; +export default processCSV; \ No newline at end of file diff --git a/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_1.3.js b/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_1.3.js new file mode 100644 index 0000000..18eb2c1 --- /dev/null +++ b/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_1.3.js @@ -0,0 +1,23 @@ +export const processCSV = async (csv, { filterColumn, filterValue, groupBy, aggregateColumn, operation }) => { + const [{ parse }, { default: _ }] = await Promise.all([ + import('https://esm.sh/papaparse@5.4.1'), + import('https://esm.sh/lodash@4.17.21') + ]); + + const rows = _.filter(parse(csv, { header: true, skipEmptyLines: true }).data, r => r[filterColumn] == filterValue); + + return _.map(_.groupBy(rows, groupBy), (group, key) => { + const nums = _.map(group, r => { + const n = parseFloat(r[aggregateColumn]); + return isNaN(n) ? 0 : n; + }); + + const sum = _.sum(nums); + const result = operation === 'count' ? group.length : + operation === 'sum' ? sum : + (sum / (nums.length || 1)); + + return { [groupBy]: key, result }; + }); +}; +export default processCSV; \ No newline at end of file diff --git a/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_1.4.js b/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_1.4.js new file mode 100644 index 0000000..a8e2513 --- /dev/null +++ b/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_1.4.js @@ -0,0 +1,17 @@ +export const processCSV = async (str, { + filterColumn: fc, + filterValue: fv, + groupBy: gb, + aggregateColumn: ac, + operation: op +}) => { + const { csvParse, rollups, sum, mean } = await import('https://cdn.jsdelivr.net/npm/d3@7/+esm') + const val = d => +d[ac] || 0 + + return rollups( + csvParse(str).filter(d => d[fc] == fv), + g => op === 'count' ? g.length : op === 'sum' ? sum(g, val) : mean(g, val) || 0, + d => d[gb] + ).map(([k, r]) => ({ [gb]: k, result: r })) +} +export default processCSV; \ No newline at end of file diff --git a/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_1.5.js b/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_1.5.js new file mode 100644 index 0000000..39a3527 --- /dev/null +++ b/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_1.5.js @@ -0,0 +1,19 @@ +const processCSV = async (csv, { filterColumn: fc, filterValue: fv, groupBy: gb, aggregateColumn: ac, operation: op }) => { + const { csvParse } = await import('https://esm.sh/d3-dsv@3'); + + const groups = csvParse(csv).reduce((acc, row) => { + if (row[fc] == fv) { + const k = row[gb], v = +row[ac] || 0; + acc[k] ??= { s: 0, c: 0 }; + acc[k].s += v; + acc[k].c++; + } + return acc; + }, {}); + + return Object.entries(groups).map(([k, { s, c }]) => ({ + [gb]: k, + result: op === 'count' ? c : op === 'avg' ? s / c : s + })); +}; +export default processCSV; \ No newline at end of file diff --git a/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_1.6.js b/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_1.6.js new file mode 100644 index 0000000..d47fd3b --- /dev/null +++ b/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_1.6.js @@ -0,0 +1,19 @@ +const processCSV = async (csvStr, { filterColumn: fc, filterValue: fv, groupBy: gb, aggregateColumn: ac, operation: op }) => { + const { parse } = await import('https://esm.sh/papaparse@5.4.1'); + const acc = {}; + + parse(csvStr, { header: true, skipEmptyLines: true }).data.forEach(row => { + if (row[fc] == fv) { + const k = row[gb], v = +row[ac] || 0; + const curr = acc[k] ||= { s: 0, c: 0 }; + curr.s += v; + curr.c++; + } + }); + + return Object.entries(acc).map(([key, { s, c }]) => ({ + [gb]: key, + result: op === 'count' ? c : op === 'avg' ? s / c : s + })); +}; +export default processCSV; \ No newline at end of file diff --git a/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_1.7.js b/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_1.7.js new file mode 100644 index 0000000..4fa926d --- /dev/null +++ b/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_1.7.js @@ -0,0 +1,18 @@ +export const processCSV = async (csv, { filterColumn: fc, filterValue: fv, groupBy: gb, aggregateColumn: ac, operation: op }) => { + const [{ parse }, { groupBy, map }] = await Promise.all([ + import('https://esm.sh/papaparse@5.4.1'), + import('https://esm.sh/lodash-es@4.17.21') + ]); + + return map(groupBy( + parse(csv, { header: true, skipEmptyLines: true }).data.filter(r => r[fc] == fv), + gb + ), (rows, key) => { + const sum = rows.reduce((a, r) => a + (+r[ac] || 0), 0); + return { + [gb]: key, + result: op === 'count' ? rows.length : op === 'avg' ? sum / rows.length : sum + }; + }); +}; +export default processCSV; \ No newline at end of file diff --git a/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_1.8.js b/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_1.8.js new file mode 100644 index 0000000..11063d4 --- /dev/null +++ b/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_1.8.js @@ -0,0 +1,22 @@ +const processCSV = async (csvString, config) => { + const { filterColumn: key, filterValue: val, groupBy: group, aggregateColumn: target, operation: op } = config + + const [dsv, d3] = await Promise.all([ + import('https://esm.sh/d3-dsv'), + import('https://esm.sh/d3-array') + ]) + + const getVal = d => +d[target] || 0 + const rows = dsv.csvParse(csvString).filter(r => r[key] == val) + + const aggs = d3.rollup( + rows, + v => op === 'count' ? v.length : + op === 'sum' ? d3.sum(v, getVal) : + d3.mean(v, getVal), + d => d[group] + ) + + return Array.from(aggs, ([gVal, result]) => ({ [group]: gVal, result })) +} +export default processCSV; \ No newline at end of file diff --git a/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_1.9.js b/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_1.9.js new file mode 100644 index 0000000..8246cf2 --- /dev/null +++ b/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_1.9.js @@ -0,0 +1,18 @@ +const processCSV = async (csv, { filterColumn: fCol, filterValue: fVal, groupBy: gBy, aggregateColumn: aggCol, operation: op }) => { + const { parse } = await import('https://cdn.jsdelivr.net/npm/papaparse@5.4.1/+esm') + const groups = new Map() + + parse(csv, { header: true, skipEmptyLines: true }).data.forEach(row => { + if (row[fCol] == fVal) { + const key = row[gBy], val = +row[aggCol] || 0 + const cur = groups.get(key) || { sum: 0, count: 0 } + groups.set(key, { sum: cur.sum + val, count: cur.count + 1 }) + } + }) + + return Array.from(groups, ([key, { sum, count }]) => ({ + [gBy]: key, + result: op === 'avg' ? sum / count : op === 'count' ? count : sum + })) +} +export default processCSV; \ No newline at end of file diff --git a/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_1.js b/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_1.js index 9143e19..cd668cb 100644 --- a/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_1.js +++ b/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_1.js @@ -1,21 +1,22 @@ -const processCSV = async (csv, cfg) => { - const { default: Papa } = await import('https://cdn.jsdelivr.net/npm/papaparse@5.4.1/+esm'); - const { filterColumn: fc, filterValue: fv, groupBy: gb, aggregateColumn: ac, operation: op } = cfg; +export const processCSV = async (csv, { filterColumn: fc, filterValue: fv, groupBy: gb, aggregateColumn: ac, operation: op }) => { + const { parse } = await import('https://esm.sh/papaparse@5.4.1'); + const { data } = parse(csv, { header: true, skipEmptyLines: true }); + const acc = new Map(); - const grouped = Papa.parse(csv, { header: true, skipEmptyLines: true }).data.reduce((acc, row) => { + for (const row of data) { if (row[fc] == fv) { const key = row[gb]; const val = +row[ac] || 0; - acc[key] = acc[key] || { sum: 0, count: 0 }; - acc[key].sum += val; - acc[key].count++; + const rec = acc.get(key) || { sum: 0, count: 0 }; + rec.sum += val; + rec.count += 1; + acc.set(key, rec); } - return acc; - }, {}); + } - return Object.entries(grouped).map(([key, { sum, count }]) => ({ + return Array.from(acc, ([key, { sum, count }]) => ({ [gb]: key, - result: op === 'count' ? count : op === 'avg' ? sum / count : sum + result: op === 'count' ? count : op === 'sum' ? sum : sum / count })); }; export default processCSV; \ No newline at end of file diff --git a/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_2.js b/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_2.js new file mode 100644 index 0000000..0e329b5 --- /dev/null +++ b/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_2.js @@ -0,0 +1,16 @@ +const processCSV = async (csvString, config) => { + const [{ csvParse }, { rollups, sum }] = await Promise.all([ + import('https://esm.sh/d3-dsv'), + import('https://esm.sh/d3-array') + ]); + + const { filterColumn: fc, filterValue: fv, groupBy: gb, aggregateColumn: ac, operation: op } = config; + const getVal = d => +d[ac] || 0; + + return rollups( + csvParse(csvString).filter(d => d[fc] == fv), + g => op === 'count' ? g.length : (op === 'avg' ? sum(g, getVal) / g.length : sum(g, getVal)), + d => d[gb] + ).map(([k, v]) => ({ [gb]: k, result: v })); +}; +export default processCSV; \ No newline at end of file diff --git a/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_0.1.js b/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_0.1.js index 7f6fe55..5732a0b 100644 --- a/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_0.1.js +++ b/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_0.1.js @@ -1,48 +1,59 @@ -const findAvailableSlots = async (calA, calB, { durationMinutes: dur, searchRange: rng, workHours: wh }) => { - const [djs, utc] = await Promise.all([ - import('https://esm.sh/dayjs@1.11.10'), - import('https://esm.sh/dayjs@1.11.10/plugin/utc') - ]).then(m => m.map(i => i.default)); - - djs.extend(utc); - const U = (d) => djs(d).utc(); - const [wsH, wsM] = wh.start.split(':').map(Number); - const [weH, weM] = wh.end.split(':').map(Number); +const findAvailableSlots = async (calA, calB, { durationMinutes: dur, searchRange: range, workHours: wh }) => { + const { parseISO } = await import('https://esm.sh/date-fns@2.30.0'); + const toMs = (t) => parseISO(t).getTime(); + const getMins = (t) => { const [h, m] = t.split(':'); return h * 60 + +m; }; + + const [whStart, whEnd] = [getMins(wh.start), getMins(wh.end)]; + const [rStart, rEnd] = [toMs(range.start), toMs(range.end)]; + const durMs = dur * 60000; + const busy = [...calA, ...calB] - .map(s => ({ s: U(s.start), e: U(s.end) })) - .sort((a, b) => a.s - b.s) - .reduce((acc, c) => { - const last = acc[acc.length - 1]; - if (last && c.s.diff(last.e) < 0) last.e = c.e.diff(last.e) > 0 ? c.e : last.e; - else acc.push(c); - return acc; - }, []); + .map(s => ({ s: toMs(s.start), e: toMs(s.end) })) + .sort((a, b) => a.s - b.s); + + const merged = []; + if (busy.length) { + let curr = busy[0]; + for (let i = 1; i < busy.length; i++) { + if (busy[i].s < curr.e) curr.e = Math.max(curr.e, busy[i].e); + else { merged.push(curr); curr = busy[i]; } + } + merged.push(curr); + } + + const gaps = []; + let ptr = rStart; + const relBusy = [...merged.filter(b => b.e > rStart && b.s < rEnd), { s: rEnd, e: rEnd }]; + + for (const b of relBusy) { + const s = Math.max(ptr, rStart), e = Math.min(b.s, rEnd); + if (e - s >= durMs) gaps.push({ s, e }); + ptr = Math.max(ptr, b.e); + } const slots = []; - let curDay = U(rng.start).startOf('day'); - const limit = U(rng.end); - - while (curDay.isBefore(limit)) { - let wStart = curDay.hour(wsH).minute(wsM); - let wEnd = curDay.hour(weH).minute(weM); - - if (wStart.isBefore(U(rng.start))) wStart = U(rng.start); - if (wEnd.isAfter(limit)) wEnd = limit; - - let ptr = wStart; - while (ptr.add(dur, 'm').diff(wEnd) <= 0) { - const next = ptr.add(dur, 'm'); - const clash = busy.find(b => ptr.isBefore(b.e) && next.isAfter(b.s)); + for (const g of gaps) { + let t = g.s; + while (t + durMs <= g.e) { + const d = new Date(t); + const curM = d.getUTCHours() * 60 + d.getUTCMinutes(); - if (clash) ptr = clash.e; - else { - slots.push({ start: ptr.format(), end: next.format() }); - ptr = next; + if (curM >= whStart && curM + dur <= whEnd) { + slots.push({ start: d.toISOString(), end: new Date(t + durMs).toISOString() }); + t += durMs; + } else { + if (curM < whStart) { + d.setUTCHours(0, whStart, 0, 0); + } else { + d.setUTCDate(d.getUTCDate() + 1); + d.setUTCHours(0, whStart, 0, 0); + } + t = Math.max(t, d.getTime()); } } - curDay = curDay.add(1, 'day'); } + return slots; }; export default findAvailableSlots; \ No newline at end of file diff --git a/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_0.2.js b/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_0.2.js index 8abc2db..df0df8c 100644 --- a/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_0.2.js +++ b/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_0.2.js @@ -1,43 +1,27 @@ const findAvailableSlots = async (calA, calB, { durationMinutes: dur, searchRange: rng, workHours: wh }) => { - const { DateTime: DT, Interval: IV } = await import('https://cdn.jsdelivr.net/npm/luxon@3.4.4/+esm'); - const z = { zone: 'utc' }, parse = s => DT.fromISO(s, z); - const range = IV.fromDateTimes(parse(rng.start), parse(rng.end)); - - const busy = [...calA, ...calB] - .map(s => IV.fromDateTimes(parse(s.start), parse(s.end))) - .filter(i => i.isValid) - .sort((a, b) => a.start - b.start); - - const merged = busy.reduce((acc, curr) => { - const last = acc[acc.length - 1]; - if (last && (last.overlaps(curr) || last.abutsStart(curr))) { - acc[acc.length - 1] = last.union(curr); - } else acc.push(curr); - return acc; - }, []); - - const slots = []; - let day = range.start.startOf('day'); + const { DateTime: D, Interval: I } = await import('https://cdn.jsdelivr.net/npm/luxon@3.4.4/+esm'); + const Z = 'utc', parse = t => D.fromISO(t, { zone: Z }); + const busy = I.merge([...calA, ...calB].map(x => I.fromDateTimes(parse(x.start), parse(x.end)))); + const search = I.fromDateTimes(parse(rng.start), parse(rng.end)); const [sH, sM] = wh.start.split(':'), [eH, eM] = wh.end.split(':'); + const slots = []; - while (day < range.end) { - const wStart = day.set({ hour: sH, minute: sM }), wEnd = day.set({ hour: eH, minute: eM }); - let work = IV.fromDateTimes(wStart, wEnd).intersection(range); + let curr = search.start.startOf('day'); + while (curr < search.end) { + const wStart = curr.set({ hour: sH, minute: sM }), wEnd = curr.set({ hour: eH, minute: eM }); + const work = I.fromDateTimes(wStart, wEnd).intersection(search); - if (work && work.isValid) { - let cursor = work.start; - while (cursor < work.end) { - const block = merged.find(b => b.end > cursor && b.start < work.end); - const limit = (block && block.start < work.end) ? block.start : work.end; - - while (cursor.plus({ minutes: dur }) <= limit) { - slots.push({ start: cursor.toISO(), end: cursor.plus({ minutes: dur }).toISO() }); - cursor = cursor.plus({ minutes: dur }); + if (work?.isValid) { + let free = [work]; + busy.forEach(b => free = free.flatMap(f => f.difference(b))); + free.forEach(f => { + let t = f.start; + while (t.plus({ minutes: dur }) <= f.end) { + slots.push({ start: t.toISO(), end: (t = t.plus({ minutes: dur })).toISO() }); } - cursor = block ? (block.end > cursor ? block.end : cursor) : work.end; - } + }); } - day = day.plus({ days: 1 }); + curr = curr.plus({ days: 1 }); } return slots; }; diff --git a/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_0.3.js b/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_0.3.js index 762cc66..c5653d8 100644 --- a/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_0.3.js +++ b/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_0.3.js @@ -1,55 +1,46 @@ -export const findAvailableSlots = async (calendarA, calendarB, { durationMinutes, searchRange, workHours }) => { - const { default: dayjs } = await import('https://esm.sh/dayjs'); - const { default: utc } = await import('https://esm.sh/dayjs/plugin/utc'); - dayjs.extend(utc); - - const parse = (d) => dayjs.utc(d); - const msDuration = durationMinutes * 60000; - const rangeStart = parse(searchRange.start); - const rangeEnd = parse(searchRange.end); - - let busy = [...calendarA, ...calendarB] - .map(s => ({ s: parse(s.start).valueOf(), e: parse(s.end).valueOf() })) - .sort((a, b) => a.s - b.s) - .reduce((acc, curr) => { - const last = acc[acc.length - 1]; - if (last && curr.s < last.e) last.e = Math.max(last.e, curr.e); - else acc.push(curr); - return acc; +const findAvailableSlots = async (calA, calB, { durationMinutes: dur, searchRange: rng, workHours: wh }) => { + const { DateTime: D, Interval: I } = await import('https://esm.sh/luxon@3.4.4'); + const utc = { zone: 'utc' }; + const parse = t => D.fromISO(t, utc); + + const busy = [...calA, ...calB] + .map(s => I.fromDateTimes(parse(s.start), parse(s.end))) + .filter(i => i.isValid) + .sort((a, b) => a.start - b.start) + .reduce((acc, cur) => { + const last = acc.at(-1); + return (last && last.end >= cur.start) + ? (acc[acc.length - 1] = last.union(cur), acc) + : [...acc, cur]; }, []); + const searchI = I.fromDateTimes(parse(rng.start), parse(rng.end)); + const [sH, sM] = wh.start.split(':'); + const [eH, eM] = wh.end.split(':'); const slots = []; - let currentDay = rangeStart.startOf('day'); - const finalDay = rangeEnd.endOf('day'); - while (currentDay.isBefore(finalDay) || currentDay.isSame(finalDay)) { - const dateStr = currentDay.format('YYYY-MM-DD'); - let start = parse(`${dateStr}T${workHours.start}`); - let end = parse(`${dateStr}T${workHours.end}`); + let day = searchI.start.startOf('day'); + while (day < searchI.end) { + const wStart = day.set({ hour: sH, minute: sM }); + const wEnd = day.set({ hour: eH, minute: eM }); + const workI = I.fromDateTimes(wStart, wEnd).intersection(searchI); - if (start.isBefore(rangeStart)) start = rangeStart; - if (end.isAfter(rangeEnd)) end = rangeEnd; - - let ptr = start.valueOf(); - const limit = end.valueOf(); - - while (ptr + msDuration <= limit) { - const slotEnd = ptr + msDuration; - const conflict = busy.find(b => b.s < slotEnd && b.e > ptr); - - if (conflict) { - ptr = conflict.e; - } else { - slots.push({ - start: dayjs(ptr).utc().format(), - end: dayjs(slotEnd).utc().format() - }); - ptr += msDuration; + if (workI?.isValid) { + let cur = workI.start; + while (cur.plus({ minutes: dur }) <= workI.end) { + const slotI = I.after(cur, { minutes: dur }); + const clash = busy.find(b => b.overlaps(slotI)); + + if (clash) { + cur = clash.end > cur ? clash.end : cur.plus({ minutes: 1 }); + } else { + slots.push({ start: slotI.start.toISO(), end: slotI.end.toISO() }); + cur = slotI.end; + } } } - currentDay = currentDay.add(1, 'day'); + day = day.plus({ days: 1 }); } - return slots; }; export default findAvailableSlots; \ No newline at end of file diff --git a/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_0.4.js b/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_0.4.js index d8f6bbd..723892b 100644 --- a/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_0.4.js +++ b/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_0.4.js @@ -1,44 +1,31 @@ -export const findAvailableSlots = async (calA, calB, { durationMinutes: dur, searchRange, workHours }) => { - const { DateTime, Interval } = await import('https://esm.sh/luxon@3.4.4'); - const utc = (t) => DateTime.fromISO(t, { zone: 'utc' }); - const bounds = Interval.fromDateTimes(utc(searchRange.start), utc(searchRange.end)); +const findAvailableSlots = async (calA, calB, { durationMinutes: dur, searchRange: rng, workHours: wh }) => { + const { DateTime, Interval } = await import('https://esm.sh/luxon'); + const Z = { zone: 'utc' }, P = s => DateTime.fromISO(s, Z); + const [sH, sM] = wh.start.split(':'), [eH, eM] = wh.end.split(':'); - const busy = [...calA, ...calB] - .map(s => Interval.fromDateTimes(utc(s.start), utc(s.end))) - .filter(i => i.isValid && i.overlaps(bounds)) - .sort((a, b) => a.start - b.start) - .reduce((acc, cur) => { - const last = acc.at(-1); - return last && last.end >= cur.start ? [...acc.slice(0, -1), last.union(cur)] : [...acc, cur]; + let cur = P(rng.start).startOf('day'), end = P(rng.end), work = []; + while (cur < end.plus({ days: 1 })) { + const wS = cur.set({ hour: sH, minute: sM }), wE = cur.set({ hour: eH, minute: eM }); + const i = Interval.fromDateTimes(wS, wE).intersection(Interval.fromDateTimes(P(rng.start), P(rng.end))); + if (i?.isValid) work.push(i); + cur = cur.plus({ days: 1 }); + } + + const busy = [...calA, ...calB].map(x => Interval.fromDateTimes(P(x.start), P(x.end))) + .filter(x => x.isValid).sort((a, b) => a.start - b.start) + .reduce((a, c) => { + const l = a[a.length - 1]; + return l && l.end >= c.start ? (a[a.length - 1] = l.union(c), a) : [...a, c]; }, []); - const slots = []; - let cursor = bounds.start.startOf('day'); - - while (cursor <= bounds.end) { - const [sH, sM] = workHours.start.split(':'); - const [eH, eM] = workHours.end.split(':'); - const workInt = Interval.fromDateTimes( - cursor.set({ hour: sH, minute: sM }), - cursor.set({ hour: eH, minute: eM }) - ).intersection(bounds); - - if (workInt?.isValid) { - let free = [workInt]; - busy.filter(b => b.overlaps(workInt)).forEach(b => free = free.flatMap(f => f.difference(b))); - - free.forEach(f => { - let s = f.start; - while (s.plus({ minutes: dur }) <= f.end) { - const e = s.plus({ minutes: dur }); - slots.push({ start: s.toISO(), end: e.toISO() }); - s = e; - } - }); - } - cursor = cursor.plus({ days: 1 }); - } - - return slots; + return busy.reduce((acc, b) => acc.flatMap(w => w.difference(b)), work) + .flatMap(i => { + const r = []; + let s = i.start; + while (s.plus({ minutes: dur }) <= i.end) { + r.push({ start: s.toISO(), end: (s = s.plus({ minutes: dur })).toISO() }); + } + return r; + }); }; export default findAvailableSlots; \ No newline at end of file diff --git a/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_0.5.js b/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_0.5.js index 47dae27..67d9986 100644 --- a/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_0.5.js +++ b/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_0.5.js @@ -1,41 +1,51 @@ -export const findAvailableSlots = async (c1, c2, { durationMinutes: d, searchRange: r, workHours: w }) => { - const { parseISO } = await import('https://cdn.jsdelivr.net/npm/date-fns@2.30.0/+esm'); - const toMs = x => parseISO(x).getTime(); - const [wsH, wsM] = w.start.split(':').map(Number); - const [weH, weM] = w.end.split(':').map(Number); - const rStart = toMs(r.start), rEnd = toMs(r.end), durMs = d * 6e4; +const findAvailableSlots = async (calA, calB, { durationMinutes: dur, searchRange: rng, workHours: wh }) => { + const { addMinutes } = await import('https://esm.sh/date-fns@3'); + const D = (d) => new Date(d); + const [sH, sM] = wh.start.split(':').map(Number); + const [eH, eM] = wh.end.split(':').map(Number); + const startMins = sH * 60 + sM; + const endMins = eH * 60 + eM; - const busy = [...c1, ...c2] - .map(x => ({ s: toMs(x.start), e: toMs(x.end) })) - .sort((a, b) => a.s - b.s) - .reduce((acc, cur) => { - if (acc.length && cur.s <= acc[acc.length - 1].e) acc[acc.length - 1].e = Math.max(acc[acc.length - 1].e, cur.e); - else acc.push(cur); - return acc; - }, []); - - let free = [], curr = new Date(rStart); - curr.setUTCHours(0, 0, 0, 0); - - while (curr.getTime() < rEnd) { - const s = Math.max(new Date(curr).setUTCHours(wsH, wsM, 0, 0), rStart); - const e = Math.min(new Date(curr).setUTCHours(weH, weM, 0, 0), rEnd); - if (s < e) free.push({ s, e }); - curr.setUTCDate(curr.getUTCDate() + 1); + let busy = [...calA, ...calB].map(x => ({ s: D(x.start), e: D(x.end) })).sort((a, b) => a.s - b.s); + let merged = [], c = busy[0]; + if (c) { + for (let i = 1; i < busy.length; i++) busy[i].s < c.e ? c.e = new Date(Math.max(c.e, busy[i].e)) : (merged.push(c), c = busy[i]); + merged.push(c); } - return busy.reduce((acc, b) => acc.flatMap(f => { - if (b.e <= f.s || b.s >= f.e) return [f]; - return [ - ...(f.s < b.s ? [{ s: f.s, e: b.s }] : []), - ...(f.e > b.e ? [{ s: b.e, e: f.e }] : []) - ]; - }), free).flatMap(f => { - const slots = []; - for (let t = f.s; t + durMs <= f.e; t += durMs) { - slots.push({ start: new Date(t).toISOString(), end: new Date(t + durMs).toISOString() }); + let slots = [], cur = D(rng.start), end = D(rng.end), bIdx = 0; + while (cur < end) { + const curMins = cur.getUTCHours() * 60 + cur.getUTCMinutes(); + if (curMins < startMins) { + cur.setUTCHours(sH, sM, 0, 0); + continue; } - return slots; - }); + + const nxt = addMinutes(cur, dur); + const nxtMins = nxt.getUTCHours() * 60 + nxt.getUTCMinutes(); + const isNextDay = nxt.getUTCDate() !== cur.getUTCDate(); + + if ((isNextDay && nxtMins !== 0) || (!isNextDay && nxtMins > endMins) || (isNextDay && nxtMins === 0 && endMins < 1440)) { + cur.setUTCDate(cur.getUTCDate() + 1); + cur.setUTCHours(sH, sM, 0, 0); + continue; + } + + if (nxt > end) break; + + while (bIdx < merged.length && merged[bIdx].e <= cur) bIdx++; + let overlap = null; + for (let i = bIdx; i < merged.length; i++) { + if (merged[i].s >= nxt) break; + if (merged[i].s < nxt && merged[i].e > cur) { overlap = merged[i]; break; } + } + + if (overlap) cur = overlap.e; + else { + slots.push({ start: cur.toISOString(), end: nxt.toISOString() }); + cur = nxt; + } + } + return slots; }; export default findAvailableSlots; \ No newline at end of file diff --git a/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_0.6.js b/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_0.6.js index 20a4d66..ebd2541 100644 --- a/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_0.6.js +++ b/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_0.6.js @@ -1,43 +1,49 @@ -export const findAvailableSlots = async (cal1, cal2, { durationMinutes: dur, searchRange: rng, workHours: wh }) => { - const { DateTime, Interval } = await import('https://cdn.skypack.dev/luxon'); - const zone = 'utc'; - const fromISO = t => DateTime.fromISO(t, { zone }); - const searchIv = Interval.fromDateTimes(fromISO(rng.start), fromISO(rng.end)); +const findAvailableSlots = async (calA, calB, { durationMinutes: dur, searchRange: rng, workHours: wh }) => { + const { parseISO, addMinutes } = await import('https://cdn.jsdelivr.net/npm/date-fns@2.30.0/+esm'); + const [startR, endR] = [parseISO(rng.start), parseISO(rng.end)]; - const busy = [...cal1, ...cal2] - .map(s => Interval.fromDateTimes(fromISO(s.start), fromISO(s.end))) - .filter(i => i.isValid && i.overlaps(searchIv)) - .sort((a, b) => a.start - b.start) - .reduce((acc, cur) => { + const busy = [...calA, ...calB] + .map(x => ({ s: parseISO(x.start), e: parseISO(x.end) })) + .sort((a, b) => a.s - b.s) + .reduce((acc, c) => { const last = acc[acc.length - 1]; - return last && (last.overlaps(cur) || last.abutsStart(cur)) - ? [...acc.slice(0, -1), last.union(cur)] - : [...acc, cur]; + if (last && c.s < last.e) last.e = new Date(Math.max(last.e, c.e)); + else acc.push(c); + return acc; }, []); const slots = []; - let curDate = searchIv.start.startOf('day'); - const [wsH, wsM] = wh.start.split(':'); - const [weH, weM] = wh.end.split(':'); + let currDate = new Date(Date.UTC(startR.getUTCFullYear(), startR.getUTCMonth(), startR.getUTCDate())); + const lastDate = new Date(Date.UTC(endR.getUTCFullYear(), endR.getUTCMonth(), endR.getUTCDate())); - while (curDate < searchIv.end) { - const workStart = curDate.set({ hour: wsH, minute: wsM }); - const workEnd = curDate.set({ hour: weH, minute: weM }); - const workIv = Interval.fromDateTimes(workStart, workEnd).intersection(searchIv); + while (currDate <= lastDate) { + const dStr = currDate.toISOString().split('T')[0]; + const wStart = parseISO(`${dStr}T${wh.start}:00Z`); + const wEnd = parseISO(`${dStr}T${wh.end}:00Z`); - if (workIv && workIv.isValid) { - let free = [workIv]; - busy.forEach(b => { free = free.flatMap(f => f.difference(b)); }); - - free.forEach(iv => { - iv.splitBy({ minutes: dur }).forEach(chunk => { - if (Math.abs(chunk.length('minutes') - dur) < 0.01) { - slots.push({ start: chunk.start.toISO(), end: chunk.end.toISO() }); - } - }); - }); + const winStart = wStart < startR ? startR : wStart; + const winEnd = wEnd > endR ? endR : wEnd; + + if (winStart < winEnd) { + let cursor = winStart; + const relevant = busy.filter(b => b.s < winEnd && b.e > winStart); + + for (const b of relevant) { + while (addMinutes(cursor, dur) <= b.s) { + const next = addMinutes(cursor, dur); + slots.push({ start: cursor.toISOString(), end: next.toISOString() }); + cursor = next; + } + if (cursor < b.e) cursor = b.e; + } + + while (addMinutes(cursor, dur) <= winEnd) { + const next = addMinutes(cursor, dur); + slots.push({ start: cursor.toISOString(), end: next.toISOString() }); + cursor = next; + } } - curDate = curDate.plus({ days: 1 }); + currDate.setUTCDate(currDate.getUTCDate() + 1); } return slots; diff --git a/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_0.7.js b/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_0.7.js index 6705133..e7a37d5 100644 --- a/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_0.7.js +++ b/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_0.7.js @@ -1,50 +1,59 @@ -const findAvailableSlots = async (calA, calB, constraints) => { - const { DateTime: D } = await import('https://cdn.jsdelivr.net/npm/luxon@3.4.4/+esm'); - const { durationMinutes: dur, searchRange: rng, workHours: wh } = constraints; - - const utc = { zone: 'utc' }; - const parse = s => D.fromISO(s, utc); - const durMs = dur * 60000; - - const busy = [...calA, ...calB] - .map(x => ({ s: parse(x.start).valueOf(), e: parse(x.end).valueOf() })) - .sort((a, b) => a.s - b.s) - .reduce((acc, cur) => { - const last = acc.at(-1); - if (last && cur.s <= last.e) last.e = Math.max(last.e, cur.e); - else acc.push(cur); - return acc; - }, []); +export const findAvailableSlots = async (calA, calB, { durationMinutes: dur, searchRange: range, workHours: wh }) => { + const { default: d } = await import('https://esm.sh/dayjs@1.11.10'); + const { default: u } = await import('https://esm.sh/dayjs@1.11.10/plugin/utc'); + d.extend(u); - const slots = []; - const rangeStart = parse(rng.start).valueOf(); - const rangeEnd = parse(rng.end).valueOf(); - const [wsH, wsM] = wh.start.split(':').map(Number); - const [weH, weM] = wh.end.split(':').map(Number); + const D = t => d.utc(t); + const rS = D(range.start), rE = D(range.end); + const setT = (dt, t) => { + const [h, m] = t.split(':'); + return dt.hour(h).minute(m).second(0).millisecond(0); + }; - let currDay = parse(rng.start).startOf('day'); + // 1. Merge and Sort Busy Slots + let busy = [...calA, ...calB] + .map(x => ({ s: D(x.start), e: D(x.end) })) + .filter(x => x.e > rS && x.s < rE) + .sort((a, b) => a.s - b.s); - while (currDay.valueOf() < rangeEnd) { - const wStart = Math.max(currDay.set({ hour: wsH, minute: wsM }).valueOf(), rangeStart); - const wEnd = Math.min(currDay.set({ hour: weH, minute: weM }).valueOf(), rangeEnd); - - if (wStart < wEnd) { - let ptr = wStart; - for (const b of busy) { - if (b.e <= ptr) continue; - if (b.s >= wEnd) break; - while (ptr + durMs <= b.s) { - slots.push({ start: D.fromMillis(ptr, utc).toISO(), end: D.fromMillis(ptr + durMs, utc).toISO() }); - ptr += durMs; - } - ptr = Math.max(ptr, b.e); - } - while (ptr + durMs <= wEnd) { - slots.push({ start: D.fromMillis(ptr, utc).toISO(), end: D.fromMillis(ptr + durMs, utc).toISO() }); - ptr += durMs; - } + let merged = [], curr = busy[0]; + if (curr) { + for (let i = 1; i < busy.length; i++) { + if (busy[i].s < curr.e) curr.e = busy[i].e > curr.e ? busy[i].e : curr.e; + else { merged.push(curr); curr = busy[i]; } + } + merged.push(curr); + } + + // 2. Identify Free Gaps within Search Range + let gaps = [], ptr = rS; + for (const b of merged) { + if (b.s > ptr) gaps.push({ s: ptr, e: b.s }); + ptr = b.e > ptr ? b.e : ptr; + } + if (ptr < rE) gaps.push({ s: ptr, e: rE }); + + // 3. Generate Slots intersecting Work Hours + const slots = []; + for (const g of gaps) { + let day = g.s.clone().startOf('day'); + const endDay = g.e.clone().endOf('day'); + + while (day <= endDay) { + const wS = setT(day, wh.start), wE = setT(day, wh.end); + // Intersection of Gap and Work Hours + const start = g.s > wS ? g.s : wS; + const end = g.e < wE ? g.e : wE; + + if (start < end) { + let s = start; + while (s.add(dur, 'm') <= end) { + slots.push({ start: s.toISOString(), end: s.add(dur, 'm').toISOString() }); + s = s.add(dur, 'm'); + } + } + day = day.add(1, 'd'); } - currDay = currDay.plus({ days: 1 }); } return slots; diff --git a/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_0.8.js b/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_0.8.js index d115862..5717487 100644 --- a/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_0.8.js +++ b/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_0.8.js @@ -1,53 +1,45 @@ -export const findAvailableSlots = async (cal1, cal2, { durationMinutes: dur, searchRange: rng, workHours: wh }) => { - const [djs, utc] = await Promise.all([ - import('https://esm.sh/dayjs@1.11.10'), - import('https://esm.sh/dayjs@1.11.10/plugin/utc') - ]); - const dayjs = djs.default; - dayjs.extend(utc.default); - - const parse = d => dayjs(d).utc(); - const [wsH, wsM] = wh.start.split(':').map(Number); - const [weH, weM] = wh.end.split(':').map(Number); +const findAvailableSlots = async (cal1, cal2, { durationMinutes: dur, searchRange: range, workHours: work }) => { + const { parseISO } = await import('https://esm.sh/date-fns@2.30.0') + const toMs = d => parseISO(d).getTime() - let now = parse(rng.start); - const endLimit = parse(rng.end); - const slots = []; - const busy = [...cal1, ...cal2] - .map(s => ({ s: parse(s.start), e: parse(s.end) })) + .map(c => ({ s: toMs(c.start), e: toMs(c.end) })) .sort((a, b) => a.s - b.s) .reduce((acc, c) => { - const last = acc.at(-1); - if (last && c.s <= last.e) last.e = c.e > last.e ? c.e : last.e; - else acc.push(c); - return acc; - }, []); + const last = acc[acc.length - 1] + if (last && c.s < last.e) last.e = Math.max(last.e, c.e) + else acc.push(c) + return acc + }, []) - while (now.add(dur, 'm') <= endLimit) { - const wStart = now.hour(wsH).minute(wsM).second(0).millisecond(0); - const wEnd = now.hour(weH).minute(weM).second(0).millisecond(0); + const start = toMs(range.start), end = toMs(range.end), ms = dur * 60000 + const [sh, sm] = work.start.split(':'), [eh, em] = work.end.split(':') + const slots = [] - if (now < wStart) now = wStart; - - const next = now.add(dur, 'm'); + for (let d = new Date(start); d < end; d.setUTCDate(d.getUTCDate() + 1)) { + d.setUTCHours(0, 0, 0, 0) + const y = d.getUTCFullYear(), m = d.getUTCMonth(), day = d.getUTCDate() + const wStart = Math.max(Date.UTC(y, m, day, sh, sm), start) + const wEnd = Math.min(Date.UTC(y, m, day, eh, em), end) - if (next > wEnd) { - now = wStart.add(1, 'd'); - continue; + if (wStart >= wEnd) continue + + let ptr = wStart + for (const b of busy) { + if (b.e <= ptr) continue + if (b.s >= wEnd) break + while (ptr + ms <= b.s) { + slots.push({ start: new Date(ptr).toISOString(), end: new Date(ptr + ms).toISOString() }) + ptr += ms + } + ptr = Math.max(ptr, b.e) } - if (next > endLimit) break; - - const clash = busy.find(b => now < b.e && next > b.s); - - if (clash) { - now = clash.e; - } else { - slots.push({ start: now.toISOString(), end: next.toISOString() }); - now = next; + while (ptr + ms <= wEnd) { + slots.push({ start: new Date(ptr).toISOString(), end: new Date(ptr + ms).toISOString() }) + ptr += ms } } - - return slots; -}; + + return slots +} export default findAvailableSlots; \ No newline at end of file diff --git a/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_0.9.js b/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_0.9.js index 9ac53a8..af9796f 100644 --- a/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_0.9.js +++ b/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_0.9.js @@ -1,59 +1,32 @@ const findAvailableSlots = async (calA, calB, { durationMinutes, searchRange, workHours }) => { - const { parseISO, formatISO, addMinutes } = await import('https://cdn.jsdelivr.net/npm/date-fns@3.6.0/+esm'); - - const rangeStart = parseISO(searchRange.start).getTime(); - const rangeEnd = parseISO(searchRange.end).getTime(); - const durationMs = durationMinutes * 60 * 1000; + const { DateTime, Interval } = await import('https://cdn.jsdelivr.net/npm/luxon@3/+esm'); + const z = { zone: 'utc' }; + const parse = t => DateTime.fromISO(t, z); + const range = Interval.fromDateTimes(parse(searchRange.start), parse(searchRange.end)); + const [wsH, wsM] = workHours.start.split(':'); + const [weH, weM] = workHours.end.split(':'); const busy = [...calA, ...calB] - .map(s => ({ start: parseISO(s.start).getTime(), end: parseISO(s.end).getTime() })) - .sort((a, b) => a.start - b.start); - - const merged = []; - if (busy.length) { - let curr = busy[0]; - for (const next of busy.slice(1)) { - if (curr.end >= next.start) { - curr.end = Math.max(curr.end, next.end); - } else { - merged.push(curr); - curr = next; - } - } - merged.push(curr); - } + .map(s => Interval.fromDateTimes(parse(s.start), parse(s.end))) + .filter(i => i.isValid) + .sort((a, b) => a.start - b.start) + .reduce((acc, cur) => { + const last = acc[acc.length - 1]; + return last && last.end >= cur.start ? (acc[acc.length - 1] = last.union(cur), acc) : [...acc, cur]; + }, []); const slots = []; - let now = rangeStart; - - while (now + durationMs <= rangeEnd) { - const currentDate = new Date(now); - const dateStr = currentDate.toISOString().split('T')[0]; - const workStart = parseISO(`${dateStr}T${workHours.start}:00Z`).getTime(); - const workEnd = parseISO(`${dateStr}T${workHours.end}:00Z`).getTime(); - - if (now < workStart) { - now = workStart; - continue; - } - - if (now + durationMs > workEnd) { - now = addMinutes(workStart, 24 * 60).getTime(); - continue; - } - - const conflict = merged.find(b => now < b.end && (now + durationMs) > b.start); - - if (conflict) { - now = conflict.end; - } else { - const start = new Date(now); - const end = new Date(now + durationMs); - slots.push({ start: formatISO(start), end: formatISO(end) }); - now += durationMs; + for (const free of range.difference(...busy)) { + let cur = free.start; + while (cur < free.end) { + const next = cur.plus({ minutes: durationMinutes }); + if (next > free.end) break; + const ws = cur.set({ hour: wsH, minute: wsM, second: 0, millisecond: 0 }); + const we = cur.set({ hour: weH, minute: weM, second: 0, millisecond: 0 }); + if (cur >= ws && next <= we) slots.push({ start: cur.toISO(), end: next.toISO() }); + cur = next; } } - return slots; }; export default findAvailableSlots; \ No newline at end of file diff --git a/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_1.1.js b/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_1.1.js index c34ca29..4c43ccf 100644 --- a/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_1.1.js +++ b/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_1.1.js @@ -1,49 +1,33 @@ -const findAvailableSlots = async (calendarA, calendarB, constraints) => { - const { default: d } = await import('https://esm.sh/dayjs@1.11.10'); - const { default: u } = await import('https://esm.sh/dayjs@1.11.10/plugin/utc'); - d.extend(u); +const findAvailableSlots = async (calA, calB, { durationMinutes: dur, searchRange: rng, workHours: wh }) => { + const { addMinutes: add, parseISO: prs, isBefore: isB, isAfter: isA, isEqual: isE } = await import('https://cdn.jsdelivr.net/npm/date-fns@2.30.0/esm/index.js'); + + const [rS, rE] = [prs(rng.start), prs(rng.end)]; + const busy = [...calA, ...calB] + .map(x => ({ s: prs(x.start), e: prs(x.end) })) + .filter(x => isB(x.s, rE) && isA(x.e, rS)) + .sort((a, b) => a.s - b.s); - const D = d.utc; - const ms = constraints.durationMinutes * 60000; - const rangeS = D(constraints.searchRange.start); - const rangeE = D(constraints.searchRange.end); - const [wS_H, wS_M] = constraints.workHours.start.split(':').map(Number); - const [wE_H, wE_M] = constraints.workHours.end.split(':').map(Number); + let ptr = rS, res = []; + const [wsH, wsM] = wh.start.split(':'), [weH, weM] = wh.end.split(':'); - const busy = [...calendarA, ...calendarB] - .map(x => ({ s: D(x.start).valueOf(), e: D(x.end).valueOf() })) - .sort((a, b) => a.s - b.s) - .reduce((acc, c) => { - const l = acc[acc.length - 1]; - if (l && c.s < l.e) l.e = Math.max(l.e, c.e); - else acc.push(c); - return acc; - }, []); + for (const b of [...busy, { s: rE, e: rE }]) { + if (isA(b.s, ptr)) { + let cur = ptr; + while (true) { + const nxt = add(cur, dur); + if (isA(nxt, b.s)) break; + + const uDay = new Date(Date.UTC(cur.getUTCFullYear(), cur.getUTCMonth(), cur.getUTCDate())); + const wS = add(uDay, wsH * 60 + +wsM), wE = add(uDay, weH * 60 + +weM); - const slots = []; - let curr = rangeS.startOf('day'); - const endDay = rangeE.endOf('day'); - - while (curr.isBefore(endDay)) { - let sTime = curr.hour(wS_H).minute(wS_M).second(0).millisecond(0); - let eTime = curr.hour(wE_H).minute(wE_M).second(0).millisecond(0); - - const sVal = Math.max(sTime.valueOf(), rangeS.valueOf()); - const eVal = Math.min(eTime.valueOf(), rangeE.valueOf()); - - let ptr = sVal; - while (ptr + ms <= eVal) { - const conflict = busy.find(b => b.s < ptr + ms && b.e > ptr); - if (conflict) { - ptr = conflict.e; - } else { - slots.push({ start: D(ptr).format(), end: D(ptr + ms).format() }); - ptr += ms; + if ((isA(cur, wS) || isE(cur, wS)) && (isB(nxt, wE) || isE(nxt, wE))) { + res.push({ start: cur.toISOString(), end: nxt.toISOString() }); + } + cur = nxt; } } - curr = curr.add(1, 'day'); + ptr = isA(b.e, ptr) ? b.e : ptr; } - - return slots; + return res; }; export default findAvailableSlots; \ No newline at end of file diff --git a/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_1.2.js b/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_1.2.js new file mode 100644 index 0000000..9356733 --- /dev/null +++ b/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_1.2.js @@ -0,0 +1,32 @@ +export const findAvailableSlots = async (calA, calB, { durationMinutes: dur, searchRange: sRange, workHours: wh }) => { + const { DateTime: D, Interval: I } = await import('https://cdn.skypack.dev/luxon'); + const Z = { zone: 'utc' }; + const toD = t => D.fromISO(t, Z); + const mkI = (s, e) => I.fromDateTimes(s, e); + + const busy = I.merge([...calA, ...calB].map(x => mkI(toD(x.start), toD(x.end)))); + const search = mkI(toD(sRange.start), toD(sRange.end)); + const [hS, mS] = wh.start.split(':'); + const [hE, mE] = wh.end.split(':'); + const res = []; + + let curr = search.start.startOf('day'); + while (curr < search.end) { + const wWin = mkI(curr.set({ hour: hS, minute: mS }), curr.set({ hour: hE, minute: mE })).intersection(search); + if (wWin?.isValid) { + let free = [wWin]; + busy.forEach(b => free = free.flatMap(s => s.difference(b))); + free.forEach(s => { + let t = s.start; + while (t.plus({ minutes: dur }) <= s.end) { + const next = t.plus({ minutes: dur }); + res.push({ start: t.toISO(), end: next.toISO() }); + t = next; + } + }); + } + curr = curr.plus({ days: 1 }); + } + return res; +}; +export default findAvailableSlots; \ No newline at end of file diff --git a/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_1.3.js b/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_1.3.js new file mode 100644 index 0000000..230d943 --- /dev/null +++ b/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_1.3.js @@ -0,0 +1,58 @@ +export const findAvailableSlots = async (calA, calB, { durationMinutes: dur, searchRange: range, workHours: work }) => { + const { addMinutes, parseISO } = await import('https://cdn.jsdelivr.net/npm/date-fns@4.1.0/+esm'); + + const toTime = d => d.getTime(); + const toISO = d => d.toISOString(); + + const startLimit = parseISO(range.start); + const endLimit = parseISO(range.end); + + let busy = [...calA, ...calB] + .map(c => ({ s: toTime(parseISO(c.start)), e: toTime(parseISO(c.end)) })) + .sort((a, b) => a.s - b.s) + .reduce((acc, c) => { + const last = acc[acc.length - 1]; + if (last && c.s < last.e) last.e = Math.max(last.e, c.e); + else acc.push(c); + return acc; + }, []); + + const slots = []; + let currDate = new Date(Date.UTC(startLimit.getUTCFullYear(), startLimit.getUTCMonth(), startLimit.getUTCDate())); + + while (toTime(currDate) <= toTime(endLimit)) { + const dateStr = currDate.toISOString().split('T')[0]; + const workStart = new Date(`${dateStr}T${work.start}:00Z`); + const workEnd = new Date(`${dateStr}T${work.end}:00Z`); + + let ptr = toTime(workStart) < toTime(startLimit) ? startLimit : workStart; + const winEnd = toTime(workEnd) > toTime(endLimit) ? endLimit : workEnd; + const winEndT = toTime(winEnd); + + let bIdx = 0; + + while (toTime(ptr) + (dur * 60000) <= winEndT) { + const slotEnd = addMinutes(ptr, dur); + const ptrT = toTime(ptr); + const slotEndT = toTime(slotEnd); + + // Fast-forward busy index + while (busy[bIdx] && busy[bIdx].e <= ptrT) bIdx++; + + const conflict = busy[bIdx]; + + if (!conflict || conflict.s >= slotEndT) { + slots.push({ start: toISO(ptr), end: toISO(slotEnd) }); + ptr = slotEnd; + } else { + // Overlap detected, jump to end of busy slot + // Ensure we reconstruct Date from timestamp correctly + ptr = new Date(conflict.e); + } + } + currDate.setUTCDate(currDate.getUTCDate() + 1); + } + + return slots; +}; +export default findAvailableSlots; \ No newline at end of file diff --git a/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_1.4.js b/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_1.4.js new file mode 100644 index 0000000..0fb223d --- /dev/null +++ b/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_1.4.js @@ -0,0 +1,52 @@ +const findAvailableSlots = async (calA, calB, { durationMinutes: dur, searchRange: rng, workHours: wh }) => { + const { parseISO, formatISO } = await import('https://esm.sh/date-fns@2.30.0'); + + const toMs = (d) => parseISO(d).getTime(); + const [wSh, wSm] = wh.start.split(':').map(Number); + const [wEh, wEm] = wh.end.split(':').map(Number); + + const busy = [...calA, ...calB] + .map(x => ({ s: toMs(x.start), e: toMs(x.end) })) + .sort((a, b) => a.s - b.s) + .reduce((acc, c) => { + const last = acc[acc.length - 1]; + if (last && c.s < last.e) last.e = Math.max(last.e, c.e); + else acc.push(c); + return acc; + }, []); + + const res = []; + const limit = toMs(rng.end); + let curr = toMs(rng.start); + const msDur = dur * 60000; + + while (curr + msDur <= limit) { + const slotEnd = curr + msDur; + const d = new Date(curr); + + const dayS = Date.UTC(d.getUTCFullYear(), d.getUTCMonth(), d.getUTCDate(), wSh, wSm); + const dayE = Date.UTC(d.getUTCFullYear(), d.getUTCMonth(), d.getUTCDate(), wEh, wEm); + + if (curr < dayS) { + curr = dayS; + continue; + } + + if (slotEnd > dayE) { + curr = dayS + 86400000; + continue; + } + + const clash = busy.find(b => curr < b.e && slotEnd > b.s); + if (clash) { + curr = clash.e; + continue; + } + + res.push({ start: formatISO(curr), end: formatISO(slotEnd) }); + curr = slotEnd; + } + + return res; +}; +export default findAvailableSlots; \ No newline at end of file diff --git a/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_1.5.js b/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_1.5.js new file mode 100644 index 0000000..3b2856a --- /dev/null +++ b/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_1.5.js @@ -0,0 +1,65 @@ +const findAvailableSlots = async (cal1, cal2, constraints) => { + const { parseISO, formatISO } = await import('https://cdn.jsdelivr.net/npm/date-fns@3.6.0/+esm'); + + const D = constraints.durationMinutes; + const MS = D * 60000; + const sDate = parseISO(constraints.searchRange.start).getTime(); + const eDate = parseISO(constraints.searchRange.end).getTime(); + + const [wsH, wsM] = constraints.workHours.start.split(':').map(Number); + const [weH, weM] = constraints.workHours.end.split(':').map(Number); + const wsMin = wsH * 60 + wsM; + const weMin = weH * 60 + weM; + + const busy = [...cal1, ...cal2] + .map(x => ({ s: parseISO(x.start).getTime(), e: parseISO(x.end).getTime() })) + .filter(x => x.e > sDate && x.s < eDate) + .sort((a, b) => a.s - b.s); + + const res = []; + let curr = sDate; + let bIdx = 0; + + while (curr + MS <= eDate) { + // 1. Jump overlapping busy slots + let collision = false; + while (bIdx < busy.length && busy[bIdx].e <= curr) bIdx++; // Fast forward past busy + + for (let i = bIdx; i < busy.length; i++) { + if (busy[i].s >= curr + MS) break; // Future busy slot + if (curr < busy[i].e && (curr + MS) > busy[i].s) { // Overlap + curr = busy[i].e; + collision = true; + break; + } + } + if (collision) continue; + + // 2. Validate/Adjust Work Hours (UTC) + const d = new Date(curr); + const dMin = d.getUTCHours() * 60 + d.getUTCMinutes(); + + // Calc end time min (handling day boundaries carefully) + const endD = new Date(curr + MS); + const endMin = endD.getUTCHours() * 60 + endD.getUTCMinutes(); + const diffDays = endD.getUTCDate() !== d.getUTCDate(); + + if (dMin < wsMin) { + // Too early: Jump to start of work day + d.setUTCHours(wsH, wsM, 0, 0); + curr = d.getTime(); + } else if (diffDays || endMin > weMin || (endMin === 0 && diffDays)) { // endMin 0 is midnight next day + // Too late: Jump to start of next work day + d.setUTCDate(d.getUTCDate() + 1); + d.setUTCHours(wsH, wsM, 0, 0); + curr = d.getTime(); + } else { + // Valid slot + res.push({ start: formatISO(curr), end: formatISO(curr + MS) }); + curr += MS; + } + } + + return res; +}; +export default findAvailableSlots; \ No newline at end of file diff --git a/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_1.6.js b/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_1.6.js new file mode 100644 index 0000000..b516c55 --- /dev/null +++ b/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_1.6.js @@ -0,0 +1,49 @@ +export const findAvailableSlots = async (cal1, cal2, { durationMinutes: dur, searchRange: range, workHours: wh }) => { + const { parseISO, addMinutes } = await import('https://cdn.jsdelivr.net/npm/date-fns@3.3.1/+esm'); + + const toTime = (d) => parseISO(d).getTime(); + const rStart = toTime(range.start); + const rEnd = toTime(range.end); + + const [wStart, wEnd] = [wh.start, wh.end].map(t => t.split(':').reduce((h, m) => h * 60 + +m, 0)); + const getMins = (d) => d.getUTCHours() * 60 + d.getUTCMinutes(); + + const busy = [...cal1, ...cal2] + .map(x => ({ s: Math.max(rStart, toTime(x.start)), e: Math.min(rEnd, toTime(x.end)) })) + .filter(x => x.s < x.e) + .sort((a, b) => a.s - b.s); + + const merged = []; + if (busy.length) { + let curr = busy[0]; + for (const b of busy) { + if (b.s <= curr.e) curr.e = Math.max(curr.e, b.e); + else { merged.push(curr); curr = b; } + } + merged.push(curr); + } + + const slots = []; + let cursor = rStart; + const blocks = [...merged, { s: rEnd, e: rEnd }]; + + for (const b of blocks) { + while (cursor + dur * 60000 <= b.s) { + const start = new Date(cursor); + const end = addMinutes(start, dur); + + if (start.getUTCDay() === end.getUTCDay()) { + const sM = getMins(start); + const eM = getMins(end); + if (sM >= wStart && eM <= wEnd) { + slots.push({ start: start.toISOString(), end: end.toISOString() }); + } + } + cursor = end.getTime(); + } + cursor = Math.max(cursor, b.e); + } + + return slots; +}; +export default findAvailableSlots; \ No newline at end of file diff --git a/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_1.7.js b/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_1.7.js new file mode 100644 index 0000000..8d3454d --- /dev/null +++ b/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_1.7.js @@ -0,0 +1,43 @@ +export const findAvailableSlots = async (calA, calB, { durationMinutes, searchRange, workHours }) => { + const { DateTime, Interval } = await import('https://cdn.jsdelivr.net/npm/luxon@3.4.4/+esm'); + const zone = 'utc'; + const toDt = (iso) => DateTime.fromISO(iso, { zone }); + const totalRange = Interval.fromDateTimes(toDt(searchRange.start), toDt(searchRange.end)); + const busy = Interval.merge([...calA, ...calB].map(({ start, end }) => Interval.fromDateTimes(toDt(start), toDt(end)))); + + const results = []; + let cursor = totalRange.start.startOf('day'); + + while (cursor < totalRange.end) { + const [startH, startM] = workHours.start.split(':'); + const [endH, endM] = workHours.end.split(':'); + + const dailyWork = Interval.fromDateTimes( + cursor.set({ hour: +startH, minute: +startM }), + cursor.set({ hour: +endH, minute: +endM }) + ); + + const effective = dailyWork.intersection(totalRange); + + if (effective?.isValid && !effective.isEmpty()) { + let available = [effective]; + for (const b of busy) { + if (b.overlaps(effective)) { + available = available.flatMap(a => a.difference(b)); + } + } + + for (const period of available) { + period.splitBy({ minutes: durationMinutes }).forEach(slot => { + if (slot.isValid && slot.toDuration('minutes').minutes === durationMinutes) { + results.push({ start: slot.start.toISO(), end: slot.end.toISO() }); + } + }); + } + } + cursor = cursor.plus({ days: 1 }); + } + + return results; +}; +export default findAvailableSlots; \ No newline at end of file diff --git a/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_1.8.js b/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_1.8.js new file mode 100644 index 0000000..467ca2a --- /dev/null +++ b/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_1.8.js @@ -0,0 +1,45 @@ +const findAvailableSlots = async (c1, c2, { durationMinutes: d, searchRange: r, workHours: wh }) => { + const { addMinutes } = await import('https://esm.sh/date-fns@3.6.0'); + const toMs = x => new Date(x).getTime(); + const [rangeStart, rangeEnd] = [toMs(r.start), toMs(r.end)]; + + const busy = [...c1, ...c2] + .map(x => ({ s: toMs(x.start), e: toMs(x.end) })) + .sort((a, b) => a.s - b.s) + .reduce((acc, c) => { + const last = acc.at(-1); + if (last && c.s <= last.e) last.e = Math.max(last.e, c.e); + else acc.push(c); + return acc; + }, []); + + const slots = [], dm = d * 6e4; + let walker = new Date(rangeStart), bIdx = 0; + walker.setUTCHours(0, 0, 0, 0); + + const [wsH, wsM] = wh.start.split(':'), [weH, weM] = wh.end.split(':'); + + while (walker.getTime() <= rangeEnd) { + const wStart = new Date(walker).setUTCHours(wsH, wsM, 0, 0); + const wEnd = new Date(walker).setUTCHours(weH, weM, 0, 0); + let cur = Math.max(wStart, rangeStart), lim = Math.min(wEnd, rangeEnd); + + while (cur + dm <= lim) { + const next = cur + dm; + while (bIdx < busy.length && busy[bIdx].e <= cur) bIdx++; + + if (bIdx < busy.length && busy[bIdx].s < next) { + cur = busy[bIdx].e; + } else { + slots.push({ + start: new Date(cur).toISOString(), + end: addMinutes(new Date(cur), d).toISOString() + }); + cur = next; + } + } + walker.setUTCDate(walker.getUTCDate() + 1); + } + return slots; +}; +export default findAvailableSlots; \ No newline at end of file diff --git a/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_1.9.js b/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_1.9.js new file mode 100644 index 0000000..f42f34a --- /dev/null +++ b/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_1.9.js @@ -0,0 +1,57 @@ +export const findAvailableSlots = async (cal1, cal2, { durationMinutes, searchRange, workHours }) => { + const { parseISO } = await import('https://cdn.jsdelivr.net/npm/date-fns@3.6.0/+esm'); + const toMs = (d) => parseISO(d).getTime(); + const toIso = (ms) => new Date(ms).toISOString(); + const rangeStart = toMs(searchRange.start); + const rangeEnd = toMs(searchRange.end); + const durMs = durationMinutes * 60000; + + // Merge and Sort Busy Intervals + const busy = [...cal1, ...cal2] + .map(({ start, end }) => ({ s: toMs(start), e: toMs(end) })) + .sort((a, b) => a.s - b.s) + .reduce((acc, cur) => { + const last = acc[acc.length - 1]; + if (last && cur.s < last.e) last.e = Math.max(last.e, cur.e); + else acc.push(cur); + return acc; + }, []); + + const slots = []; + // Iterate strictly by days in UTC to determine work hours + const cursor = new Date(rangeStart); + cursor.setUTCHours(0, 0, 0, 0); + + while (cursor.getTime() < rangeEnd) { + const dateIso = cursor.toISOString().slice(0, 10); + // Determine available window for this day + const workStart = Date.parse(`${dateIso}T${workHours.start}:00Z`); + const workEnd = Date.parse(`${dateIso}T${workHours.end}:00Z`); + const wStart = Math.max(rangeStart, workStart); + const wEnd = Math.min(rangeEnd, workEnd); + + if (wStart < wEnd) { + let ptr = wStart; + // Subtract busy times from the day's window + for (const b of busy) { + if (b.e <= ptr) continue; + if (b.s >= wEnd) break; + + // Generate slots in the free interval [ptr, b.s] + while (ptr + durMs <= b.s) { + slots.push({ start: toIso(ptr), end: toIso(ptr += durMs) }); + } + ptr = Math.max(ptr, b.e); + if (ptr >= wEnd) break; + } + // Fill remaining time in the day + while (ptr + durMs <= wEnd) { + slots.push({ start: toIso(ptr), end: toIso(ptr += durMs) }); + } + } + cursor.setUTCDate(cursor.getUTCDate() + 1); + } + + return slots; +}; +export default findAvailableSlots; \ No newline at end of file diff --git a/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_1.js b/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_1.js index 4261060..e196eaf 100644 --- a/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_1.js +++ b/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_1.js @@ -1,47 +1,53 @@ -const findAvailableSlots = async (calA, calB, { durationMinutes: dur, searchRange: rng, workHours: wh }) => { - const { addMinutes } = await import('https://cdn.jsdelivr.net/npm/date-fns@3.6.0/+esm'); - const parse = d => new Date(d).getTime(); - const toIso = t => new Date(t).toISOString(); +const findAvailableSlots = async (calendarA, calendarB, { durationMinutes, searchRange, workHours }) => { + const { addMinutes, formatISO } = await import('https://cdn.jsdelivr.net/npm/date-fns@3.6.0/+esm'); + const T = (d) => new Date(d).getTime(); + const durMs = durationMinutes * 60000; + const rangeEnd = T(searchRange.end); - const [rStart, rEnd] = [parse(rng.start), parse(rng.end)]; - const msDur = dur * 60000; - - const busy = [...calA, ...calB] - .map(x => ({ s: parse(x.start), e: parse(x.end) })) + const busy = [...calendarA, ...calendarB] + .map(s => ({ s: T(s.start), e: T(s.end) })) .sort((a, b) => a.s - b.s) .reduce((acc, c) => { - const last = acc[acc.length - 1]; - if (last && c.s < last.e) last.e = Math.max(last.e, c.e); - else acc.push({ ...c }); + if (acc.length && c.s < acc[acc.length - 1].e) { + acc[acc.length - 1].e = Math.max(acc[acc.length - 1].e, c.e); + } else { + acc.push(c); + } return acc; }, []); const slots = []; - let curr = new Date(rStart); - curr.setUTCHours(0, 0, 0, 0); + let currentDay = new Date(searchRange.start); + currentDay.setUTCHours(0, 0, 0, 0); - while (curr.getTime() < rEnd) { - const [wsH, wsM] = wh.start.split(':'), [weH, weM] = wh.end.split(':'); - const wStart = new Date(curr).setUTCHours(+wsH, +wsM, 0, 0); - const wEnd = new Date(curr).setUTCHours(+weH, +weM, 0, 0); - - const winStart = Math.max(wStart, rStart); - const winEnd = Math.min(wEnd, rEnd); + while (currentDay.getTime() < rangeEnd) { + const dateStr = currentDay.toISOString().split('T')[0]; + const workStart = T(`${dateStr}T${workHours.start}:00Z`); + const workEnd = T(`${dateStr}T${workHours.end}:00Z`); + + const winStart = Math.max(workStart, T(searchRange.start)); + const winEnd = Math.min(workEnd, rangeEnd); if (winStart < winEnd) { - let t = winStart; - while (t + msDur <= winEnd) { - const tEnd = addMinutes(t, dur).getTime(); - const clash = busy.find(b => t < b.e && tEnd > b.s); - - if (clash) t = clash.e; - else { - slots.push({ start: toIso(t), end: toIso(tEnd) }); - t = tEnd; + let cursor = winStart; + + for (const b of busy) { + if (b.e <= cursor) continue; + if (b.s >= winEnd) break; + + while (cursor + durMs <= b.s) { + slots.push({ start: formatISO(cursor), end: formatISO(addMinutes(cursor, durationMinutes)) }); + cursor += durMs; } + cursor = Math.max(cursor, b.e); + } + + while (cursor + durMs <= winEnd) { + slots.push({ start: formatISO(cursor), end: formatISO(addMinutes(cursor, durationMinutes)) }); + cursor += durMs; } } - curr.setUTCDate(curr.getUTCDate() + 1); + currentDay.setUTCDate(currentDay.getUTCDate() + 1); } return slots; diff --git a/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_2.js b/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_2.js new file mode 100644 index 0000000..cfd5a1b --- /dev/null +++ b/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_2.js @@ -0,0 +1,50 @@ +export const findAvailableSlots = async (calA, calB, { durationMinutes: dur, searchRange: range, workHours: work }) => { + const { formatISO, addMinutes } = await import('https://esm.sh/date-fns@3.6.0'); + const toMs = (d) => new Date(d).getTime(); + const slotMs = dur * 6e4; + const limit = toMs(range.end); + + const parseTime = t => t.split(':').reduce((h, m) => h * 60 + +m, 0); + const [wStart, wEnd] = [work.start, work.end].map(parseTime); + + const busy = [...calA, ...calB] + .map(x => ({ s: toMs(x.start), e: toMs(x.end) })) + .sort((a, b) => a.s - b.s) + .reduce((a, c) => { + const l = a.at(-1); + (l && c.s <= l.e) ? l.e = Math.max(l.e, c.e) : a.push(c); + return a; + }, []); + + let now = toMs(range.start); + let bIdx = 0; + const res = []; + + while (now + slotMs <= limit) { + const d = new Date(now); + const dayBase = Date.UTC(d.getUTCFullYear(), d.getUTCMonth(), d.getUTCDate()); + const [dayStart, dayEnd] = [dayBase + wStart * 6e4, dayBase + wEnd * 6e4]; + + if (now < dayStart) { + now = dayStart; + continue; + } + if (now + slotMs > dayEnd) { + now = dayStart + 864e5; + continue; + } + + while (busy[bIdx] && busy[bIdx].e <= now) bIdx++; + const b = busy[bIdx]; + + if (b && b.s < now + slotMs) { + now = b.e; + } else { + res.push({ start: formatISO(now), end: formatISO(addMinutes(now, dur)) }); + now += slotMs; + } + } + + return res; +}; +export default findAvailableSlots; \ No newline at end of file diff --git a/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_0.1.js b/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_0.1.js index 6c0d5c2..1695c69 100644 --- a/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_0.1.js +++ b/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_0.1.js @@ -1,14 +1,11 @@ const validateJSON = async (data, schema) => { - try { - const { default: Ajv } = await import('https://esm.sh/ajv@8.17.1'); - const v = new Ajv({ allErrors: true }).compile(schema); - const valid = v(data); - return { - valid, - errors: valid ? [] : v.errors.map(e => `${e.instancePath} ${e.message}`.trim()) - }; - } catch (e) { - return { valid: false, errors: [e.message] }; - } + const { default: Ajv } = await import('https://esm.sh/ajv@8.17.1'); + const ajv = new Ajv({ allErrors: true }); + const validate = ajv.compile(schema); + const valid = validate(data); + return { + valid, + errors: valid ? [] : validate.errors.map(e => `${e.instancePath} ${e.message}`.trim()) + }; }; export default validateJSON; \ No newline at end of file diff --git a/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_0.2.js b/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_0.2.js index 8726972..ab2e05c 100644 --- a/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_0.2.js +++ b/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_0.2.js @@ -1,10 +1,14 @@ -const validateJSON = async (d, s) => { - const { default: A } = await import('https://esm.sh/ajv@8.17.1'); - const v = new A({ allErrors: true }).compile(s); - const b = v(d); - return { - valid: b, - errors: b ? [] : v.errors.map(e => `${e.instancePath} ${e.message}`.trim()) - }; +const validateJSON = async (data, schema) => { + try { + const { default: Ajv } = await import('https://esm.sh/ajv@8.17.1'); + const validate = new Ajv({ allErrors: true }).compile(schema); + const valid = validate(data); + return { + valid, + errors: valid ? [] : validate.errors.map(e => `${e.instancePath} ${e.message}`.trim()) + }; + } catch (e) { + return { valid: false, errors: [e.message] }; + } }; export default validateJSON; \ No newline at end of file diff --git a/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_0.3.js b/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_0.3.js index d3f2edb..b16e250 100644 --- a/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_0.3.js +++ b/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_0.3.js @@ -1,7 +1,15 @@ const validateJSON = async (data, schema) => { - const { default: Ajv } = await import('https://esm.sh/ajv@8') - const validate = new Ajv({ allErrors: true }).compile(schema) - const valid = validate(data) - return { valid, errors: valid ? [] : validate.errors.map(e => `${e.instancePath} ${e.message}`.trim()) } + try { + const { default: Ajv } = await import('https://esm.sh/ajv@8.17.1') + const ajv = new Ajv({ allErrors: !0 }) + const validate = ajv.compile(schema) + const valid = validate(data) + return { + valid, + errors: valid ? [] : validate.errors.map(e => `${e.instancePath} ${e.message}`.trim()) + } + } catch (e) { + return { valid: !1, errors: [e.message] } + } } export default validateJSON; \ No newline at end of file diff --git a/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_0.4.js b/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_0.4.js index bcaa335..43ed913 100644 --- a/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_0.4.js +++ b/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_0.4.js @@ -1,11 +1,7 @@ const validateJSON = async (data, schema) => { - try { - const { default: Ajv } = await import('https://esm.sh/ajv@8.17.1') - const validate = new Ajv({ allErrors: true }).compile(schema) - const valid = validate(data) - return { valid, errors: valid ? [] : validate.errors.map(e => `${e.instancePath} ${e.message}`.trim()) } - } catch (err) { - return { valid: false, errors: [err.message] } - } + const { default: Ajv } = await import('https://esm.sh/ajv@8.17.1') + const validate = new Ajv({ allErrors: !0 }).compile(schema) + const valid = validate(data) + return { valid, errors: valid ? [] : validate.errors.map(e => `${e.instancePath} ${e.message}`.trim()) } } export default validateJSON; \ No newline at end of file diff --git a/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_0.5.js b/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_0.5.js index e3c89d0..53aac6c 100644 --- a/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_0.5.js +++ b/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_0.5.js @@ -1,7 +1,10 @@ const validateJSON = async (data, schema) => { - const Ajv = (await import('https://esm.sh/ajv@8.17.1')).default + const { default: Ajv } = await import('https://esm.sh/ajv@8') const validate = new Ajv({ allErrors: true }).compile(schema) const valid = validate(data) - return { valid, errors: validate.errors?.map(e => e.message) ?? [] } + return { + valid, + errors: valid ? [] : validate.errors.map(e => `${e.instancePath} ${e.message}`.trim()) + } } export default validateJSON; \ No newline at end of file diff --git a/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_0.6.js b/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_0.6.js index 9f2a0fb..272d54a 100644 --- a/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_0.6.js +++ b/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_0.6.js @@ -1,10 +1,7 @@ +let a const validateJSON = async (d, s) => { - const { default: A } = await import('https://esm.sh/ajv@8.17.1'); - const v = new A({ allErrors: true }).compile(s); - const r = v(d); - return { - valid: r, - errors: r ? [] : v.errors.map(e => `${e.instancePath} ${e.message}`.trim()) - }; -}; + a ??= new (await import('https://esm.sh/ajv@8')).default({ allErrors: !0 }) + const v = a.compile(s), r = v(d) + return { valid: r, errors: r ? [] : v.errors.map(e => `${e.instancePath} ${e.message}`.trim()) } +} export default validateJSON; \ No newline at end of file diff --git a/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_0.7.js b/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_0.7.js index 29fd7aa..e57785f 100644 --- a/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_0.7.js +++ b/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_0.7.js @@ -1,7 +1,7 @@ -const validateJSON = async (data, schema) => { - const { default: Ajv } = await import('https://esm.sh/ajv@8.17.1'); - const v = new Ajv({ allErrors: true }).compile(schema); - const valid = v(data); - return { valid, errors: valid ? [] : v.errors.map(e => `${e.instancePath} ${e.message}`.trim()) }; -}; +const validateJSON = async (d, s) => { + const { default: A } = await import('https://esm.sh/ajv@8') + const v = new A({ allErrors: true }).compile(s) + const r = v(d) + return { valid: r, errors: r ? [] : v.errors.map(e => e.message) } +} export default validateJSON; \ No newline at end of file diff --git a/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_0.8.js b/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_0.8.js index c0facbc..71f5450 100644 --- a/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_0.8.js +++ b/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_0.8.js @@ -1,7 +1,14 @@ -const validateJSON = async (data, schema) => { - const { default: Ajv } = await import('https://esm.sh/ajv@8.17.1') - const validate = new Ajv({ allErrors: true }).compile(schema) - const valid = validate(data) - return { valid, errors: valid ? [] : validate.errors.map(e => `${e.instancePath} ${e.message}`.trim()) } +const validateJSON = async (json, schema) => { + try { + const { default: Ajv } = await import('https://esm.sh/ajv@8.12.0') + const validate = new Ajv({ allErrors: true }).compile(schema) + const valid = validate(json) + return { + valid, + errors: valid ? [] : validate.errors.map(e => `${e.instancePath} ${e.message}`.trim()) + } + } catch (error) { + return { valid: false, errors: [error.message] } + } } export default validateJSON; \ No newline at end of file diff --git a/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_0.9.js b/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_0.9.js index 4c5075b..72f984e 100644 --- a/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_0.9.js +++ b/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_0.9.js @@ -1,14 +1,10 @@ -const validateJSON = async (d, s) => { - try { - const Ajv = (await import('https://esm.sh/ajv@8.17.1')).default; - const v = new Ajv({ allErrors: true }).compile(s); - const b = v(d); - return { - valid: b, - errors: b ? [] : v.errors.map(e => `${e.instancePath} ${e.message}`.trim()) - }; - } catch (e) { - return { valid: false, errors: [e.message] }; - } +const validateJSON = async (data, schema) => { + const { default: Ajv } = await import('https://esm.sh/ajv@8.17.1'); + const validate = new Ajv({ allErrors: true }).compile(schema); + const valid = validate(data); + return { + valid, + errors: valid ? [] : validate.errors.map(e => `${e.instancePath} ${e.message}`.trim()) + }; }; export default validateJSON; \ No newline at end of file diff --git a/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_1.1.js b/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_1.1.js index 2d98fe6..70ae7fa 100644 --- a/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_1.1.js +++ b/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_1.1.js @@ -1,14 +1,7 @@ const validateJSON = async (data, schema) => { - try { - const { default: Ajv } = await import('https://esm.sh/ajv@8.17.1') - const validate = new Ajv({ allErrors: true }).compile(schema) - const valid = validate(data) - return { - valid, - errors: valid ? [] : validate.errors.map(e => `${e.instancePath} ${e.message}`.trim()) - } - } catch (e) { - return { valid: false, errors: [e.message] } - } + const { default: A } = await import('https://esm.sh/ajv@8.17.1') + const v = new A({ allErrors: true }).compile(schema) + const valid = v(data) + return { valid, errors: valid ? [] : v.errors.map(e => `${e.instancePath} ${e.message}`.trim()) } } export default validateJSON; \ No newline at end of file diff --git a/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_1.2.js b/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_1.2.js new file mode 100644 index 0000000..4ae3526 --- /dev/null +++ b/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_1.2.js @@ -0,0 +1,10 @@ +const validateJSON = async (data, schema) => { + const { default: Ajv } = await import('https://esm.sh/ajv@8.17.1') + const v = new Ajv({ allErrors: true }).compile(schema) + const valid = v(data) + return { + valid, + errors: v.errors?.map(e => `${e.instancePath} ${e.message}`.trim()) || [] + } +} +export default validateJSON; \ No newline at end of file diff --git a/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_1.3.js b/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_1.3.js new file mode 100644 index 0000000..a555c06 --- /dev/null +++ b/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_1.3.js @@ -0,0 +1,7 @@ +const validateJSON = async (d, s) => { + const { default: A } = await import('https://esm.sh/ajv@8.17.1') + const v = new A({ allErrors: !0 }).compile(s) + const r = v(d) + return { valid: r, errors: r ? [] : v.errors } +} +export default validateJSON; \ No newline at end of file diff --git a/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_1.4.js b/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_1.4.js new file mode 100644 index 0000000..422aea1 --- /dev/null +++ b/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_1.4.js @@ -0,0 +1,7 @@ +const validateJSON = async (d, s) => { + const { default: A } = await import('https://esm.sh/ajv@8.12.0') + const v = new A({ allErrors: true }).compile(s) + const b = v(d) + return { valid: b, errors: b ? [] : v.errors.map(e => e.message) } +} +export default validateJSON; \ No newline at end of file diff --git a/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_1.5.js b/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_1.5.js new file mode 100644 index 0000000..43f854f --- /dev/null +++ b/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_1.5.js @@ -0,0 +1,10 @@ +const validateJSON = async (d, s) => { + const { default: A } = await import('https://esm.sh/ajv@8.17.1') + const v = new A({ allErrors: !0 }).compile(s) + const r = v(d) + return { + valid: r, + errors: r ? [] : v.errors.map(e => `${e.instancePath} ${e.message}`.trim()) + } +} +export default validateJSON; \ No newline at end of file diff --git a/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_1.6.js b/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_1.6.js new file mode 100644 index 0000000..f6fabab --- /dev/null +++ b/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_1.6.js @@ -0,0 +1,14 @@ +const validateJSON = async (data, schema) => { + try { + const { default: Ajv } = await import('https://esm.sh/ajv'); + const validate = new Ajv({ allErrors: !0 }).compile(schema); + const valid = validate(data); + return { + valid, + errors: valid ? [] : validate.errors.map(e => `${e.instancePath} ${e.message}`.trim()) + }; + } catch (e) { + return { valid: !1, errors: [e.message] }; + } +}; +export default validateJSON; \ No newline at end of file diff --git a/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_1.7.js b/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_1.7.js new file mode 100644 index 0000000..75978bb --- /dev/null +++ b/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_1.7.js @@ -0,0 +1,6 @@ +const validateJSON = async (data, schema) => { + const { default: Ajv } = await import('https://esm.sh/ajv@8') + const v = new Ajv({ allErrors: !0 }).compile(schema) + return { valid: v(data), errors: v.errors || [] } +} +export default validateJSON; \ No newline at end of file diff --git a/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_1.8.js b/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_1.8.js new file mode 100644 index 0000000..4adf663 --- /dev/null +++ b/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_1.8.js @@ -0,0 +1,10 @@ +export const validateJSON = async (d, s) => { + const { default: A } = await import('https://esm.sh/ajv@8.17.1'); + const v = new A({ allErrors: true }).compile(s); + const valid = v(d); + return { + valid, + errors: valid ? [] : v.errors.map(e => `${e.instancePath} ${e.message}`.trim()) + }; +}; +export default validateJSON; \ No newline at end of file diff --git a/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_1.9.js b/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_1.9.js new file mode 100644 index 0000000..12ca35d --- /dev/null +++ b/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_1.9.js @@ -0,0 +1,10 @@ +const validateJSON = async (data, schema) => { + const { default: Ajv } = await import('https://esm.sh/ajv@8.17.1') + const validate = new Ajv({ allErrors: true }).compile(schema) + const valid = validate(data) + return { + valid, + errors: valid ? [] : validate.errors.map(({ instancePath, message }) => `${instancePath} ${message}`.trim()) + } +} +export default validateJSON; \ No newline at end of file diff --git a/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_1.js b/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_1.js index fcc739d..b9370a9 100644 --- a/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_1.js +++ b/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_1.js @@ -1,10 +1,10 @@ const validateJSON = async (data, schema) => { - const { default: Ajv } = await import('https://esm.sh/ajv@8.17.1') - const validator = new Ajv({ allErrors: true }).compile(schema) - const valid = validator(data) + const { default: Ajv } = await import('https://esm.sh/ajv') + const validate = new Ajv({ allErrors: true }).compile(schema) + const valid = validate(data) return { valid, - errors: valid ? [] : validator.errors.map(e => `${e.instancePath || 'root'} ${e.message}`) + errors: valid ? [] : validate.errors.map(e => `${e.instancePath} ${e.message}`.trim()) } } export default validateJSON; \ No newline at end of file diff --git a/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_2.js b/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_2.js new file mode 100644 index 0000000..1976237 --- /dev/null +++ b/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_2.js @@ -0,0 +1,6 @@ +const validateJSON = async (d, s) => { + const { default: A } = await import('https://esm.sh/ajv@8') + const v = new A({ allErrors: !0 }).compile(s), r = v(d) + return { valid: r, errors: r ? [] : v.errors.map(e => e.message) } +} +export default validateJSON; \ No newline at end of file diff --git a/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_0.1.js b/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_0.1.js index d4dd175..51f23c0 100644 --- a/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_0.1.js +++ b/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_0.1.js @@ -1,28 +1,20 @@ -export const createStreamVisualizer = async (src, { maxPoints: m, alpha: a, width: w, height: h, yDomain: yD }) => { - const data = []; - let ema; +const createStreamVisualizer = async (src, { maxPoints: m, alpha: a, width: w, height: h, yDomain: yd }) => { + const { scaleLinear, line } = await import('https://esm.sh/d3@7'); + const D = []; + let e; for await (const { timestamp: t, value: v } of src) { - ema = ema == null ? v : a * v + (1 - a) * ema; - data.push({ timestamp: t, value: v, ema }); - if (data.length > m) data.shift(); + e = e === undefined ? v : a * v + (1 - a) * e; + D.push({ timestamp: t, value: v, ema: e }); + if (D.length > m) D.shift(); } - if (!data.length) return { data, path: '' }; + if (!D.length) return { data: D, path: '' }; - const { scaleLinear, line } = await import('d3'); - - const x = scaleLinear() - .domain([data[0].timestamp, data[data.length - 1].timestamp]) - .range([0, w]); + const x = scaleLinear().domain([D[0].timestamp, D[D.length - 1].timestamp]).range([0, w]); + const y = scaleLinear().domain(yd).range([h, 0]); + const l = line().x(d => x(d.timestamp)).y(d => y(d.ema)); - const y = scaleLinear() - .domain(yD) - .range([h, 0]); - - return { - data, - path: line().x(d => x(d.timestamp)).y(d => y(d.ema))(data) - }; + return { data: D, path: l(D) }; }; export default createStreamVisualizer; \ No newline at end of file diff --git a/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_0.2.js b/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_0.2.js index 177de09..6f8dbf0 100644 --- a/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_0.2.js +++ b/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_0.2.js @@ -1,14 +1,20 @@ -export const createStreamVisualizer = async (iter, { maxPoints: M, alpha: A, width: W, height: H, yDomain: Y }) => { - const { scaleLinear, line } = await import('https://cdn.jsdelivr.net/npm/d3/+esm') - let D = [], E +const createStreamVisualizer = async (iter, { maxPoints: M, alpha: A, width: W, height: H, yDomain: Y }) => { + const { scaleLinear, line } = await import('https://cdn.jsdelivr.net/npm/d3@7/+esm') + const D = [] + let E + for await (const { timestamp: t, value: v } of iter) { - E = E == null ? v : A * v + (1 - A) * E + E = E === undefined ? v : A * v + (1 - A) * E D.push({ timestamp: t, value: v, ema: E }) - D.length > M && D.shift() + if (D.length > M) D.shift() } - if (!D.length) return { data: [], path: "" } - const x = scaleLinear().domain([D[0].timestamp, D.at(-1).timestamp]).range([0, W]), - y = scaleLinear().domain(Y).range([H, 0]) - return { data: D, path: line().x(d => x(d.timestamp)).y(d => y(d.ema))(D) } + + if (!D.length) return { data: D, path: '' } + + const x = scaleLinear().domain([D[0].timestamp, D.at(-1).timestamp]).range([0, W]) + const y = scaleLinear().domain(Y).range([H, 0]) + const l = line().x(d => x(d.timestamp)).y(d => y(d.ema)) + + return { data: D, path: l(D) } } export default createStreamVisualizer; \ No newline at end of file diff --git a/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_0.3.js b/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_0.3.js index 41da658..9b8a448 100644 --- a/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_0.3.js +++ b/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_0.3.js @@ -1,20 +1,29 @@ -export const createStreamVisualizer = async (stream, { maxPoints: M, alpha: A, width: W, height: H, yDomain: Y }) => { +export const createStreamVisualizer = async (feed, { maxPoints, alpha, width, height, yDomain }) => { const { scaleLinear, line } = await import('https://esm.sh/d3@7'); const data = []; - let ema; + let prev; - for await (const { timestamp: t, value: v } of stream) { - ema = ema === undefined ? v : A * v + (1 - A) * ema; - data.push({ timestamp: t, value: v, ema }); - if (data.length > M) data.shift(); + for await (const { timestamp, value } of feed) { + const ema = prev == null ? value : alpha * value + (1 - alpha) * prev; + prev = ema; + data.push({ timestamp, value, ema }); + if (data.length > maxPoints) data.shift(); } - if (!data.length) return { data, path: '' }; + if (!data.length) return { data, path: "" }; - const x = scaleLinear().domain([data[0].timestamp, data.at(-1).timestamp]).range([0, W]); - const y = scaleLinear().domain(Y).range([H, 0]); - const gen = line().x(d => x(d.timestamp)).y(d => y(d.ema)); + const x = scaleLinear() + .domain([data[0].timestamp, data.at(-1).timestamp]) + .range([0, width]); - return { data, path: gen(data) }; + const y = scaleLinear() + .domain(yDomain) + .range([height, 0]); + + const pathGen = line() + .x(d => x(d.timestamp)) + .y(d => y(d.ema)); + + return { data, path: pathGen(data) }; }; export default createStreamVisualizer; \ No newline at end of file diff --git a/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_0.4.js b/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_0.4.js index c432bc7..5b70672 100644 --- a/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_0.4.js +++ b/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_0.4.js @@ -1,20 +1,28 @@ -export const createStreamVisualizer = async (src, { maxPoints: M, alpha: A, width: W, height: H, yDomain: YD }) => { +const createStreamVisualizer = async (feed, { maxPoints, alpha, width, height, yDomain }) => { const { scaleLinear, line } = await import('https://esm.sh/d3@7'); - const D = []; - let E; + const data = []; + let ema; - for await (const { timestamp: t, value: v } of src) { - E = E == null ? v : A * v + (1 - A) * E; - D.push({ timestamp: t, value: v, ema: E }); - if (D.length > M) D.shift(); + for await (const { timestamp, value } of feed) { + ema = ema == null ? value : alpha * value + (1 - alpha) * ema; + data.push({ timestamp, value, ema }); + if (data.length > maxPoints) data.shift(); } - if (!D.length) return { data: [], path: '' }; + if (!data.length) return { data, path: '' }; - const x = scaleLinear().domain([D[0].timestamp, D.at(-1).timestamp]).range([0, W]); - const y = scaleLinear().domain(YD).range([H, 0]); - const l = line().x(d => x(d.timestamp)).y(d => y(d.ema)); + const x = scaleLinear() + .domain([data[0].timestamp, data.at(-1).timestamp]) + .range([0, width]); - return { data: D, path: l(D) }; + const y = scaleLinear() + .domain(yDomain) + .range([height, 0]); + + const path = line() + .x(d => x(d.timestamp)) + .y(d => y(d.ema))(data); + + return { data, path: path || '' }; }; export default createStreamVisualizer; \ No newline at end of file diff --git a/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_0.5.js b/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_0.5.js index 630be77..446d853 100644 --- a/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_0.5.js +++ b/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_0.5.js @@ -1,29 +1,27 @@ -export const createStreamVisualizer = async (iter, { maxPoints, alpha, width, height, yDomain }) => { - const { scaleTime, scaleLinear, line } = await import('https://esm.sh/d3@7'); - const data = []; - let prev; +export const createStreamVisualizer = async (feed, { maxPoints: m, alpha: a, width: w, height: h, yDomain: yd }) => { + const { scaleLinear, line } = await import('https://esm.sh/d3'); + let data = [], ema; - for await (const { timestamp, value } of iter) { - const ema = prev == null ? value : alpha * value + (1 - alpha) * prev; - prev = ema; - data.push({ timestamp, value, ema }); - if (data.length > maxPoints) data.shift(); + for await (const { timestamp: t, value: v } of feed) { + ema = ema == null ? v : a * v + (1 - a) * ema; + data.push({ timestamp: t, value: v, ema }); + if (data.length > m) data.shift(); } if (!data.length) return { data, path: "" }; - const x = scaleTime() + const x = scaleLinear() .domain([data[0].timestamp, data.at(-1).timestamp]) - .range([0, width]); + .range([0, w]); const y = scaleLinear() - .domain(yDomain) - .range([height, 0]); + .domain(yd) + .range([h, 0]); - const d = line() - .x(p => x(p.timestamp)) - .y(p => y(p.ema))(data); + const gen = line() + .x(d => x(d.timestamp)) + .y(d => y(d.ema)); - return { data, path: d }; + return { data, path: gen(data) }; }; export default createStreamVisualizer; \ No newline at end of file diff --git a/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_0.6.js b/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_0.6.js index 099c2c6..c0f3f4d 100644 --- a/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_0.6.js +++ b/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_0.6.js @@ -1,19 +1,27 @@ -export const createStreamVisualizer = async (stream, { maxPoints, alpha, width, height, yDomain }) => { - const { scaleLinear, line } = await import('https://esm.sh/d3'); - const data = []; +const createStreamVisualizer = async (feed, { maxPoints: max, alpha, width, height, yDomain }) => { + const d3 = await import('https://esm.sh/d3'); + let data = [], ema; - for await (const { timestamp: t, value: v } of stream) { - const prev = data.at(-1); - data.push({ timestamp: t, value: v, ema: prev ? alpha * v + (1 - alpha) * prev.ema : v }); - if (data.length > maxPoints) data.shift(); + for await (const { timestamp, value } of feed) { + ema = ema == null ? value : alpha * value + (1 - alpha) * ema; + data.push({ timestamp, value, ema }); + if (data.length > max) data.shift(); } - if (!data.length) return { data, path: '' }; + if (!data.length) return { data, path: "" }; - const x = scaleLinear().domain([data[0].timestamp, data.at(-1).timestamp]).range([0, width]); - const y = scaleLinear().domain(yDomain).range([height, 0]); - const gen = line().x(d => x(d.timestamp)).y(d => y(d.ema)); + const x = d3.scaleLinear() + .domain([data[0].timestamp, data.at(-1).timestamp]) + .range([0, width]); - return { data, path: gen(data) }; + const y = d3.scaleLinear() + .domain(yDomain) + .range([height, 0]); + + const path = d3.line() + .x(d => x(d.timestamp)) + .y(d => y(d.ema))(data); + + return { data, path }; }; export default createStreamVisualizer; \ No newline at end of file diff --git a/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_0.7.js b/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_0.7.js index e46ddca..26e61a0 100644 --- a/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_0.7.js +++ b/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_0.7.js @@ -1,29 +1,20 @@ -const createStreamVisualizer = async (feed, { maxPoints, alpha, width, height, yDomain }) => { - const { scaleLinear, line } = await import('https://esm.sh/d3'); +export const createStreamVisualizer = async (src, { maxPoints: m, alpha: a, width: w, height: h, yDomain: yd }) => { + const { scaleLinear, line } = await import('https://esm.sh/d3@7'); const data = []; - let prev; + let ema; - for await (const { timestamp, value } of feed) { - const ema = prev == null ? value : alpha * value + (1 - alpha) * prev; - prev = ema; - data.push({ timestamp, value, ema }); - if (data.length > maxPoints) data.shift(); + for await (const { timestamp: t, value: v } of src) { + ema = ema === undefined ? v : a * v + (1 - a) * ema; + data.push({ timestamp: t, value: v, ema }); + if (data.length > m) data.shift(); } if (!data.length) return { data, path: '' }; - const x = scaleLinear() - .domain([data[0].timestamp, data.at(-1).timestamp]) - .range([0, width]); + const x = scaleLinear().domain([data[0].timestamp, data.at(-1).timestamp]).range([0, w]); + const y = scaleLinear().domain(yd).range([h, 0]); + const d = line().x(p => x(p.timestamp)).y(p => y(p.ema))(data); - const y = scaleLinear() - .domain(yDomain) - .range([height, 0]); - - const generator = line() - .x(d => x(d.timestamp)) - .y(d => y(d.ema)); - - return { data, path: generator(data) || '' }; + return { data, path: d || '' }; }; export default createStreamVisualizer; \ No newline at end of file diff --git a/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_0.8.js b/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_0.8.js index 29cfa09..46c5da7 100644 --- a/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_0.8.js +++ b/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_0.8.js @@ -1,10 +1,10 @@ -export const createStreamVisualizer = async (iter, { maxPoints, alpha, width, height, yDomain }) => { - const { scaleLinear, line } = await import('https://esm.sh/d3'); +export const createStreamVisualizer = async (stream, { maxPoints, alpha, width, height, yDomain }) => { + const { scaleLinear, line } = await import('d3'); const data = []; let ema; - for await (const { timestamp, value } of iter) { - ema = ema == null ? value : alpha * value + (1 - alpha) * ema; + for await (const { timestamp, value } of stream) { + ema = (ema ?? value) * (1 - alpha) + value * alpha; data.push({ timestamp, value, ema }); if (data.length > maxPoints) data.shift(); } @@ -19,10 +19,10 @@ export const createStreamVisualizer = async (iter, { maxPoints, alpha, width, he .domain(yDomain) .range([height, 0]); - const path = line() + const pathGen = line() .x(d => x(d.timestamp)) - .y(d => y(d.ema))(data); + .y(d => y(d.ema)); - return { data, path }; + return { data, path: pathGen(data) }; }; export default createStreamVisualizer; \ No newline at end of file diff --git a/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_0.9.js b/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_0.9.js index d88e53a..f6fe1e9 100644 --- a/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_0.9.js +++ b/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_0.9.js @@ -1,28 +1,20 @@ -export const createStreamVisualizer = async (stream, { maxPoints, alpha, width, height, yDomain }) => { - const d3 = await import('https://cdn.jsdelivr.net/npm/d3@7/+esm'); +export const createStreamVisualizer = async (src, { maxPoints: max, alpha: a, width: w, height: h, yDomain: yD }) => { + const { scaleTime, scaleLinear, line } = await import('https://esm.sh/d3'); const data = []; let ema; - for await (const { timestamp, value } of stream) { - ema = ema === undefined ? value : alpha * value + (1 - alpha) * ema; - data.push({ timestamp, value, ema }); - if (data.length > maxPoints) data.shift(); + for await (const { timestamp: t, value: v } of src) { + ema = ema == null ? v : a * v + (1 - a) * ema; + data.push({ timestamp: t, value: v, ema }); + if (data.length > max) data.shift(); } if (!data.length) return { data, path: '' }; - const x = d3.scaleLinear() - .domain([data[0].timestamp, data.at(-1).timestamp]) - .range([0, width]); + const x = scaleTime().domain([data[0].timestamp, data.at(-1).timestamp]).range([0, w]); + const y = scaleLinear().domain(yD).range([h, 0]); + const path = line().x(d => x(d.timestamp)).y(d => y(d.ema))(data); - const y = d3.scaleLinear() - .domain(yDomain) - .range([height, 0]); - - const path = d3.line() - .x(d => x(d.timestamp)) - .y(d => y(d.ema))(data); - - return { data, path }; + return { data, path: path || '' }; }; export default createStreamVisualizer; \ No newline at end of file diff --git a/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_1.1.js b/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_1.1.js index ae27e9c..98072ad 100644 --- a/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_1.1.js +++ b/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_1.1.js @@ -1,28 +1,28 @@ -const createStreamVisualizer = async (stream, { maxPoints, alpha, width, height, yDomain }) => { - const { scaleLinear, line } = await import('https://esm.sh/d3@7'); +export const createStreamVisualizer = async (stream, { maxPoints, alpha, width, height, yDomain }) => { + const { scaleLinear, line } = await import('https://esm.sh/d3'); const data = []; - let ema; for await (const { timestamp, value } of stream) { - ema = data.length ? alpha * value + (1 - alpha) * ema : value; + const prev = data.at(-1); + const ema = prev ? alpha * value + (1 - alpha) * prev.ema : value; data.push({ timestamp, value, ema }); if (data.length > maxPoints) data.shift(); } - if (!data.length) return { data, path: '' }; + if (!data.length) return { data, path: null }; const x = scaleLinear() .domain([data[0].timestamp, data.at(-1).timestamp]) .range([0, width]); - + const y = scaleLinear() .domain(yDomain) .range([height, 0]); - const pathGen = line() + const generator = line() .x(d => x(d.timestamp)) .y(d => y(d.ema)); - return { data, path: pathGen(data) }; + return { data, path: generator(data) }; }; export default createStreamVisualizer; \ No newline at end of file diff --git a/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_1.2.js b/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_1.2.js new file mode 100644 index 0000000..21b32bb --- /dev/null +++ b/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_1.2.js @@ -0,0 +1,25 @@ +export const createStreamVisualizer = async ( + stream, + { maxPoints: M, alpha: A, width: W, height: H, yDomain: Y } +) => { + const { scaleLinear, line } = await import("https://esm.sh/d3@7"); + const data = []; + let ema; + + for await (const { timestamp: t, value: v } of stream) { + ema = ema == null ? v : A * v + (1 - A) * ema; + data.push({ timestamp: t, value: v, ema }); + if (data.length > M) data.shift(); + } + + if (!data.length) return { data, path: "" }; + + const x = scaleLinear() + .domain([data[0].timestamp, data.at(-1).timestamp]) + .range([0, W]); + const y = scaleLinear().domain(Y).range([H, 0]); + const path = line().x(d => x(d.timestamp)).y(d => y(d.ema))(data); + + return { data, path }; +}; +export default createStreamVisualizer; \ No newline at end of file diff --git a/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_1.3.js b/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_1.3.js new file mode 100644 index 0000000..5bd7b2e --- /dev/null +++ b/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_1.3.js @@ -0,0 +1,29 @@ +export const createStreamVisualizer = async (feed, { maxPoints, alpha, width, height, yDomain }) => { + const { scaleLinear, line } = await import('https://cdn.jsdelivr.net/npm/d3@7/+esm') + const data = [] + let prev = null + + for await (const { timestamp, value } of feed) { + const ema = prev === null ? value : alpha * value + (1 - alpha) * prev + prev = ema + data.push({ timestamp, value, ema }) + if (data.length > maxPoints) data.shift() + } + + if (!data.length) return { data, path: '' } + + const x = scaleLinear() + .domain([data[0].timestamp, data.at(-1).timestamp]) + .range([0, width]) + + const y = scaleLinear() + .domain(yDomain) + .range([height, 0]) + + const gen = line() + .x(d => x(d.timestamp)) + .y(d => y(d.ema)) + + return { data, path: gen(data) } +} +export default createStreamVisualizer; \ No newline at end of file diff --git a/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_1.4.js b/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_1.4.js new file mode 100644 index 0000000..bf6bbc5 --- /dev/null +++ b/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_1.4.js @@ -0,0 +1,14 @@ +export const createStreamVisualizer = async (stream, { maxPoints, alpha, width, height, yDomain }) => { + const { scaleLinear, line } = await import('https://cdn.jsdelivr.net/npm/d3@7/+esm') + let data = [], ema + for await (const { timestamp: t, value: v } of stream) { + ema = ema === undefined ? v : alpha * v + (1 - alpha) * ema + data.push({ timestamp: t, value: v, ema }) + if (data.length > maxPoints) data.shift() + } + if (!data.length) return { data, path: '' } + const x = scaleLinear().domain([data[0].timestamp, data.at(-1).timestamp]).range([0, width]) + const y = scaleLinear().domain(yDomain).range([height, 0]) + return { data, path: line().x(d => x(d.timestamp)).y(d => y(d.ema))(data) } +} +export default createStreamVisualizer; \ No newline at end of file diff --git a/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_1.5.js b/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_1.5.js new file mode 100644 index 0000000..d1a6aed --- /dev/null +++ b/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_1.5.js @@ -0,0 +1,32 @@ +export const createStreamVisualizer = async ( + source, + { maxPoints: max, alpha, width, height, yDomain } +) => { + const { scaleTime, scaleLinear, line } = await import('https://cdn.jsdelivr.net/npm/d3@7/+esm'); + + let data = [], prev; + + for await (const { timestamp: t, value: v } of source) { + const ema = prev === undefined ? v : alpha * v + (1 - alpha) * prev; + prev = ema; + data.push({ timestamp: t, value: v, ema }); + if (data.length > max) data.shift(); + } + + if (!data.length) return { data, path: "" }; + + const x = scaleTime() + .domain([data[0].timestamp, data.at(-1).timestamp]) + .range([0, width]); + + const y = scaleLinear() + .domain(yDomain) + .range([height, 0]); + + const pathGen = line() + .x(d => x(d.timestamp)) + .y(d => y(d.ema)); + + return { data, path: pathGen(data) }; +}; +export default createStreamVisualizer; \ No newline at end of file diff --git a/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_1.6.js b/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_1.6.js new file mode 100644 index 0000000..b190a9e --- /dev/null +++ b/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_1.6.js @@ -0,0 +1,20 @@ +export const createStreamVisualizer = async (stream, { maxPoints, alpha, width, height, yDomain }) => { + const { scaleTime, scaleLinear, line } = await import('https://esm.sh/d3@7'); + const data = []; + let ema; + + for await (const { timestamp, value } of stream) { + ema = alpha * value + (1 - alpha) * (ema ?? value); + data.push({ timestamp, value, ema }); + if (data.length > maxPoints) data.shift(); + } + + if (!data.length) return { data, path: '' }; + + const getX = scaleTime().domain([data[0].timestamp, data.at(-1).timestamp]).range([0, width]); + const getY = scaleLinear().domain(yDomain).range([height, 0]); + const gen = line().x(d => getX(d.timestamp)).y(d => getY(d.ema)); + + return { data, path: gen(data) }; +}; +export default createStreamVisualizer; \ No newline at end of file diff --git a/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_1.7.js b/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_1.7.js new file mode 100644 index 0000000..815625e --- /dev/null +++ b/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_1.7.js @@ -0,0 +1,21 @@ +const createStreamVisualizer = async (feed, { maxPoints: M, alpha: A, width: W, height: H, yDomain: Y }) => { + const { scaleLinear: S, line: L } = await import('https://cdn.jsdelivr.net/npm/d3@7/+esm') + const data = []; let ema + + for await (const { timestamp: t, value: v } of feed) { + ema = ema == null ? v : A * v + (1 - A) * ema + data.push({ timestamp: t, value: v, ema }) + if (data.length > M) data.shift() + } + + if (!data.length) return { data, path: '' } + + const x = S().domain([data[0].timestamp, data.at(-1).timestamp]).range([0, W]) + const y = S().domain(Y).range([H, 0]) + + return { + data, + path: L().x(d => x(d.timestamp)).y(d => y(d.ema))(data) + } +} +export default createStreamVisualizer; \ No newline at end of file diff --git a/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_1.8.js b/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_1.8.js new file mode 100644 index 0000000..b244080 --- /dev/null +++ b/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_1.8.js @@ -0,0 +1,31 @@ +export const createStreamVisualizer = async ( + stream, + { maxPoints, alpha, width, height, yDomain } +) => { + const { scaleLinear, line } = await import('https://esm.sh/d3@7') + const data = [] + let prev + + for await (const { timestamp, value } of stream) { + const ema = prev == null ? value : alpha * value + (1 - alpha) * prev + prev = ema + if (data.push({ timestamp, value, ema }) > maxPoints) data.shift() + } + + if (!data.length) return { data, path: '' } + + const xScale = scaleLinear() + .domain([data[0].timestamp, data.at(-1).timestamp]) + .range([0, width]) + + const yScale = scaleLinear() + .domain(yDomain) + .range([height, 0]) + + const generator = line() + .x(d => xScale(d.timestamp)) + .y(d => yScale(d.ema)) + + return { data, path: generator(data) } +} +export default createStreamVisualizer; \ No newline at end of file diff --git a/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_1.9.js b/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_1.9.js new file mode 100644 index 0000000..365737c --- /dev/null +++ b/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_1.9.js @@ -0,0 +1,29 @@ +export const createStreamVisualizer = async (stream, { maxPoints, alpha, width, height, yDomain }) => { + const data = []; + let prev; + + for await (const { timestamp, value } of stream) { + prev = prev ?? value; + const ema = prev = alpha * value + (1 - alpha) * prev; + data.push({ timestamp, value, ema }); + if (data.length > maxPoints) data.shift(); + } + + const { scaleLinear, line } = await import('https://cdn.jsdelivr.net/npm/d3@7/+esm'); + + if (!data.length) return { data, path: '' }; + + const x = scaleLinear() + .domain([data[0].timestamp, data.at(-1).timestamp]) + .range([0, width]); + + const y = scaleLinear() + .domain(yDomain) + .range([height, 0]); + + return { + data, + path: line().x(d => x(d.timestamp)).y(d => y(d.ema))(data) + }; +}; +export default createStreamVisualizer; \ No newline at end of file diff --git a/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_1.js b/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_1.js index 72a7205..c6e633b 100644 --- a/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_1.js +++ b/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_1.js @@ -1,28 +1,23 @@ -export const createStreamVisualizer = async (stream, { maxPoints: M, alpha: A, width: W, height: H, yDomain: Y }) => { - const { scaleLinear, line } = await import('https://esm.sh/d3'); +export const createStreamVisualizer = async (iter, { maxPoints: max, alpha, width: w, height: h, yDomain }) => { + const { scaleTime, scaleLinear, line } = await import('https://esm.sh/d3'); const data = []; - let ema; + let prev; - for await (const { timestamp: t, value: v } of stream) { - ema = ema == null ? v : A * v + (1 - A) * ema; + for await (const { timestamp: t, value: v } of iter) { + const ema = prev == null ? v : alpha * v + (1 - alpha) * prev; data.push({ timestamp: t, value: v, ema }); - if (data.length > M) data.shift(); + if (data.length > max) data.shift(); + prev = ema; } - if (!data.length) return { data, path: null }; + if (!data.length) return { data, path: '' }; - const x = scaleLinear() - .domain([data[0].timestamp, data.at(-1).timestamp]) - .range([0, W]); + const x = scaleTime().domain([data[0].timestamp, data.at(-1).timestamp]).range([0, w]); + const y = scaleLinear().domain(yDomain).range([h, 0]); - const y = scaleLinear() - .domain(Y) - .range([H, 0]); - - const gen = line() - .x(d => x(d.timestamp)) - .y(d => y(d.ema)); - - return { data, path: gen(data) }; + return { + data, + path: line().x(d => x(d.timestamp)).y(d => y(d.ema))(data) + }; }; export default createStreamVisualizer; \ No newline at end of file diff --git a/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_2.js b/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_2.js new file mode 100644 index 0000000..973fa16 --- /dev/null +++ b/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_2.js @@ -0,0 +1,22 @@ +export const createStreamVisualizer = async (stream, { maxPoints: max, alpha, width, height, yDomain }) => { + const { scaleLinear, line } = await import('https://esm.sh/d3'); + let data = [], prev; + + for await (const { timestamp, value } of stream) { + const ema = prev == null ? value : alpha * value + (1 - alpha) * prev; + data.push({ timestamp, value, ema }); + if (data.length > max) data.shift(); + prev = ema; + } + + if (!data.length) return { data, path: "" }; + + const x = scaleLinear().domain([data[0].timestamp, data.at(-1).timestamp]).range([0, width]); + const y = scaleLinear().domain(yDomain).range([height, 0]); + + return { + data, + path: line().x(d => x(d.timestamp)).y(d => y(d.ema))(data) + }; +}; +export default createStreamVisualizer; \ No newline at end of file