Skip to content

Automated pr 1782069385155 - #4090

Open
jonasvanleeuwen19 wants to merge 3 commits into
hackclub:mainfrom
jonasvanleeuwen19:Automated-PR-1782069385155
Open

Automated pr 1782069385155#4090
jonasvanleeuwen19 wants to merge 3 commits into
hackclub:mainfrom
jonasvanleeuwen19:Automated-PR-1782069385155

Conversation

@jonasvanleeuwen19

Copy link
Copy Markdown

Author name

Author: jonasvanleeuwen19

About your game

What is your game about?
This is the iconic snake game for sprig, complete with sound effects and background music!

How do you play your game?
Use WASD to move the snake
You can press J to restart

Copilot AI review requested due to automatic review settings July 27, 2026 21:28
@vercel

vercel Bot commented Jul 27, 2026

Copy link
Copy Markdown

@jonasvanleeuwen19 is attempting to deploy a commit to the Hack Club Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions

Copy link
Copy Markdown

[Auto Triage] PR detected. Apply submission label to run validation.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds a new Sprig game, “just_snake”, implementing a classic Snake experience with custom sprites, sound effects, background music, wall boundaries, scoring, and restart controls.

Changes:

  • Introduces games/JustSnake.js with snake movement, collision detection, apple spawning, and score display.
  • Adds SFX (eat/lose/restart) and looping BGM playback.
  • Implements restart-on-J and timed movement via setInterval.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread games/JustSnake.js Outdated
Comment thread games/JustSnake.js
Comment on lines +189 to +190
function startGame() {
playTune(restartSfx)
Comment thread games/JustSnake.js
Comment on lines +299 to +301
clearText()
playback.end()
addText("GAME OVER", { x: 5, y: 0, color: color`2` })
Comment thread games/JustSnake.js
Comment on lines +221 to +234
function spawnApple() {
while (true) {
let x = Math.floor(Math.random() * width())
let y = Math.floor(Math.random() * height())

let occupied = snake.some(s => s.x === x && s.y === y)
let wallHere = getTile(x, y).some(s => s.type === wall)

if (!occupied && !wallHere) {
addSprite(x, y, apple)
break
}
}
}
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 27, 2026 22:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 2 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (3)

games/JustSnake.js:190

  • Restarting the game while a round is still running starts a new background-music playback without stopping the previous one, which can result in overlapping audio. End any existing playback before starting a new game (and consider guarding playback.end() calls).
function startGame() {
  playTune(restartSfx)

games/JustSnake.js:300

  • playback.end() will throw if playback is undefined (e.g., if audio is unavailable or if lose() is called before startGame() completes). Guard the call to avoid a hard crash on loss.
  playback.end()

games/JustSnake.js:223

  • spawnApple() uses an unbounded while (true) loop. If the board fills up (or there’s no available non-wall tile), this will spin forever and freeze the game.
function spawnApple() {
  while (true) {
    let x = Math.floor(Math.random() * width())

Comment thread games/JustSnake.js
Comment on lines +274 to +285
if (snake.some(s => s.x === newHead.x && s.y === newHead.y))
return lose()

snake.unshift(newHead)

if (getTile(newHead.x, newHead.y).some(s => s.type === apple)) {
getAll(apple).forEach(a => a.remove())
playTune(eatSfx)
spawnApple()
} else {
snake.pop()
}
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.

2 participants