mirror of
https://github.com/multipleof4/lynchmark.git
synced 2026-03-17 11:21:00 +00:00
Docs: Update benchmark for anthropic/claude-sonnet-4.6
This commit is contained in:
26
tests/2_convex_hull/outputs/anthropic_claude-sonnet-4.6.js
Normal file
26
tests/2_convex_hull/outputs/anthropic_claude-sonnet-4.6.js
Normal file
@@ -0,0 +1,26 @@
|
||||
async function findConvexHull(points) {
|
||||
const { default: _ } = await import("https://cdn.skypack.dev/lodash");
|
||||
|
||||
const unique = _.uniqWith(points, _.isEqual);
|
||||
const sorted = _.sortBy(unique, ["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 buildHalf = (pts) =>
|
||||
pts.reduce((hull, p) => {
|
||||
while (hull.length >= 2 && cross(hull.at(-2), hull.at(-1), p) <= 0)
|
||||
hull.pop();
|
||||
return [...hull, p];
|
||||
}, []);
|
||||
|
||||
const lower = buildHalf(sorted);
|
||||
const upper = buildHalf([...sorted].reverse());
|
||||
|
||||
return [...lower.slice(0, -1), ...upper.slice(0, -1)];
|
||||
}
|
||||
export default findConvexHull;
|
||||
// Generation time: 3.848s
|
||||
// Result: PASS
|
||||
Reference in New Issue
Block a user