Skip to content

Replace magic number with GRASS_PATTERN_WIDTH constant#2

Merged
atarukun merged 2 commits into
junglefrom
copilot/sub-pr-1
Oct 29, 2025
Merged

Replace magic number with GRASS_PATTERN_WIDTH constant#2
atarukun merged 2 commits into
junglefrom
copilot/sub-pr-1

Conversation

Copilot AI commented Oct 29, 2025

Copy link
Copy Markdown

Addresses feedback to replace the magic number 8 in the grass pattern rendering code with a named constant for clarity.

Changes

  • Added GRASS_PATTERN_WIDTH = 8 constant with descriptive comment
  • Replaced hardcoded 8 values in grass pattern loop with the constant
# Before
for i in range(0, WIDTH, 8):
    offset = (state["scroll_offset"] + i) % 8

# After
for i in range(0, WIDTH, GRASS_PATTERN_WIDTH):
    offset = (state["scroll_offset"] + i) % GRASS_PATTERN_WIDTH

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: atarukun <6511495+atarukun@users.noreply.github.com>
Copilot AI changed the title [WIP] WIP address feedback on Jungle game PR Replace magic number with GRASS_PATTERN_WIDTH constant Oct 29, 2025
Copilot AI requested a review from atarukun October 29, 2025 22:03

@atarukun atarukun left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

LGTM

@atarukun
atarukun marked this pull request as ready for review October 29, 2025 22:04
Copilot AI review requested due to automatic review settings October 29, 2025 22:04
@atarukun
atarukun merged commit eb485e1 into jungle Oct 29, 2025
4 checks passed
@atarukun
atarukun deleted the copilot/sub-pr-1 branch October 29, 2025 22:04

Copilot AI 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.

Pull Request Overview

This PR refactors the grass pattern drawing code by extracting the magic number 8 into a named constant GRASS_PATTERN_WIDTH. This improves code maintainability by making the purpose of the value clear and centralizing its definition.

Key Changes:

  • Added GRASS_PATTERN_WIDTH = 8 constant definition
  • Replaced hardcoded 8 values in grass pattern loop with the new constant

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

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.

3 participants