Skip to content

Add CI, Makefile, README updates, Go 1.22 and AI-controlled paddle - #2

Merged
jenska merged 1 commit into
masterfrom
codex/update-code-for-new-api-endpoint
Mar 29, 2026
Merged

jenska merged 1 commit into
masterfrom
codex/update-code-for-new-api-endpoint

Conversation

@jenska

@jenska jenska commented Mar 29, 2026

Copy link
Copy Markdown
Owner

Motivation

  • Provide automated CI and development tooling for the project.
  • Make it easier to run, build and test the game with standard make targets.
  • Improve the single-player experience by replacing the naive computer paddle with a predictive AI.
  • Update module settings and docs for modern Go and the correct engine name.

Description

  • Add a GitHub Actions workflow /.github/workflows/ci.yml that checks formatting with gofmt and runs make test on ubuntu-latest, including installation of required native libs.
  • Add a Makefile with common targets: run, build, test, tidy, and fmt.
  • Update README.md to reflect Go 1.22+, use the Ebitengine name and provide run/install/make instructions and controls.
  • Bump go version to 1.22 in go.mod and add several indirect module requirements.
  • Replace the simple AI in game/paddle.go with a new predictive computer paddle implementation including updateComputer, nextAITargetY, predictBallY, isBallApproaching, randomError, and a clamp helper, plus configurable AI parameters and RNG seeding.

Testing

  • The CI workflow will run gofmt -l main.go game/*.go and make test as automated checks.
  • Local development targets were exercised with make fmt and go test ./..., and the tests completed successfully.
  • Formatting verification is enforced in CI to prevent unformatted changes from merging.

Codex Task

@jenska
jenska merged commit 039b0cc into master Mar 29, 2026
1 check passed
@jenska
jenska deleted the codex/update-code-for-new-api-endpoint branch March 29, 2026 19:14

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

Copy link
Copy Markdown

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: 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".

Comment thread game/paddle.go
Comment on lines +155 to +160
targetX := p.x + paddleWidth/2
if p.player == leftPlayer {
targetX += ballRadius
} else {
targetX -= ballRadius
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant