Repository navigation
Add CI, Makefile, README updates, Go 1.22 and AI-controlled paddle - #2
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 42259be0ec
ℹ️ 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".
| targetX := p.x + paddleWidth/2 | ||
| if p.player == leftPlayer { | ||
| targetX += ballRadius | ||
| } else { | ||
| targetX -= ballRadius | ||
| } |
There was a problem hiding this comment.
Mirror right-paddle X target in AI prediction
For the right-side computer paddle, targetX resolves to p.x here, but the actual contact/reset position for right-paddle hits in update is p.x - paddleWidth/2 - ballRadius. That 20px mismatch makes timeToReach too large, so predicted Y is systematically off; in AI-vs-AI mode this causes avoidable misses when the ball has meaningful vertical speed.
Useful? React with 👍 / 👎.
Motivation
maketargets.Description
/.github/workflows/ci.ymlthat checks formatting withgofmtand runsmake testonubuntu-latest, including installation of required native libs.Makefilewith common targets:run,build,test,tidy, andfmt.README.mdto reflectGo 1.22+, use the Ebitengine name and provide run/install/make instructions and controls.goversion to1.22ingo.modand add several indirect module requirements.game/paddle.gowith a new predictive computer paddle implementation includingupdateComputer,nextAITargetY,predictBallY,isBallApproaching,randomError, and aclamphelper, plus configurable AI parameters and RNG seeding.Testing
gofmt -l main.go game/*.goandmake testas automated checks.make fmtandgo test ./..., and the tests completed successfully.Codex Task