Skip to content

search#2

Merged
beackers merged 10 commits intomainfrom
search
Feb 4, 2026
Merged

search#2
beackers merged 10 commits intomainfrom
search

Conversation

@beackers
Copy link
Owner

@beackers beackers commented Feb 4, 2026

  • saving before deleting, just so I know how bad it was
  • resetting
  • define states module
  • added canonical states, min heap, priority queue
  • optimizations
  • change tests
  • Improve search performance and operations

added branching within bounds, fixed strange sorting due to storing
results by state key instead of number, fixed targeting error
(half-width instead of midpoint)
…eration-solutions

Improve heap performance, add integer-only ops and exponent support, and safer reachability pruning
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 77125a3938

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

states.lua Outdated
Comment on lines +130 to +136
local sumAbs = 0
for _, v in ipairs(state.raw) do
sumAbs = sumAbs + math.abs(v)
end
local lower = -sumAbs
local upper = sumAbs
return not (max < lower or min > upper)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Fix pruning that rejects reachable targets

The canReach heuristic assumes all intermediate results stay within [-sumAbs, sumAbs], but this is false once multiplication or exponentiation is allowed. For example, with numbers [6, 6] and a target range of 36..36, sumAbs is 12 so min > upper prunes the state even though 6*6 reaches 36. This causes the search to return empty results for valid targets above the sum of absolute values, so any inputs where the target exceeds sumAbs can be incorrectly skipped.

Useful? React with 👍 / 👎.

@beackers beackers merged commit e2b8221 into main Feb 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant