Add live screen capture, mouse execution, and heuristic shot ranking#23
Open
RiqueAlvess wants to merge 2 commits into
Open
Add live screen capture, mouse execution, and heuristic shot ranking#23RiqueAlvess wants to merge 2 commits into
RiqueAlvess wants to merge 2 commits into
Conversation
1. video_analysis.py: add analyse_live() using mss to capture the screen frame-by-frame instead of reading an MP4 file. 2. input_executor.py (new): translates the chosen shot (white-ball and target-hit positions) into a pyautogui click-drag to control the game. 3. shot_scorer.py (new): heuristic ranker that scores every valid shot by cue-ball travel distance, pocket distance, and cue/target alignment angle, then returns the lowest-cost candidate. 4. ball_path.py: add find_ranked_path() that enumerates all geometrically valid shots, scores them with ShotScorer, and returns the best path. bot.py: prefer ranked path, fall back to Dijkstra when scorer finds none. 5. start.py / options.py: new --live flag switches to screen-capture mode; -m/-reg control the capture region; -exec/-delay control shot execution. 6. requirements.txt: pin mss, pyautogui, opencv-python-headless, numpy. https://claude.ai/code/session_019wN53sCVTU15P3MRGVMb3d
…ay, fix aiming - requirements.txt: opencv-python replaces opencv-python-headless so cv2.imshow works on Windows (Snapdragon X compatible). - video_analysis.py analyse_live(): remove all drawing/imshow code. The live loop now only does capture → detect holes (once) → detect balls → find path → execute shot. No display window needed. - input_executor.py: redesign shot execution for desktop 8 Ball Pool. Step 1: hover mouse to the aim position (AIM_DISTANCE px behind white ball, opposite to shot direction) so the game registers the cue angle. Step 2: mouseDown → drag further back proportional to shot distance → mouseUp to release the shot. https://claude.ai/code/session_019wN53sCVTU15P3MRGVMb3d
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
video_analysis.py: add analyse_live() using mss to capture the screen frame-by-frame instead of reading an MP4 file.
input_executor.py (new): translates the chosen shot (white-ball and target-hit positions) into a pyautogui click-drag to control the game.
shot_scorer.py (new): heuristic ranker that scores every valid shot by cue-ball travel distance, pocket distance, and cue/target alignment angle, then returns the lowest-cost candidate.
ball_path.py: add find_ranked_path() that enumerates all geometrically valid shots, scores them with ShotScorer, and returns the best path. bot.py: prefer ranked path, fall back to Dijkstra when scorer finds none.
start.py / options.py: new --live flag switches to screen-capture mode; -m/-reg control the capture region; -exec/-delay control shot execution.
requirements.txt: pin mss, pyautogui, opencv-python-headless, numpy.
https://claude.ai/code/session_019wN53sCVTU15P3MRGVMb3d