Skip to content

Fix Tray Return Uncle placement and stat precision - #117

Merged
candour merged 2 commits into
mainfrom
fix-tray-uncle-placement-and-stat-precision-1761859171012070732
May 3, 2026
Merged

Fix Tray Return Uncle placement and stat precision#117
candour merged 2 commits into
mainfrom
fix-tray-uncle-placement-and-stat-precision-1761859171012070732

Conversation

@candour

@candour candour commented May 3, 2026

Copy link
Copy Markdown
Owner

I fixed two bugs:

  1. The Tray Return Uncle "last empty space" rule was too restrictive, only allowing FLOOR tiles as valid neighbors. I expanded this to include START and END tiles, which are also valid release points for the Uncle's displacement mechanic.
  2. Floating-point stats like Range and Radius were accumulating precision errors over multiple upgrades. I added explicit rounding to 1 decimal place to ensure consistency and clean data.

I've also added a new unit test TrayUncleRuleTest.kt to verify the fix for the Tray Return Uncle placement rule.


PR created automatically by Jules for task 1761859171012070732 started by @candour

Summary by CodeRabbit

  • Bug Fixes

    • Stall placement near Uncle tiles now treats START and GOAL tiles as valid neighbors, allowing more flexible placement and correct release positioning.
    • Upgrade calculations quantize Range and Radius to one decimal place for consistent stat progression.
  • Tests

    • Added tests validating stall placement behavior adjacent to Uncle tiles and deterministic coroutine handling.

- Updated `MainViewModel.onCellClick` to allow `START` and `END` tiles as valid release points for the Tray Return Uncle "last empty space" check.
- Added explicit rounding to 1 decimal place for `Range` and `Radius` stats in `StallUpgradeManager.kt` to prevent floating-point precision drift.
- Added a regression test `TrayUncleRuleTest.kt` to verify the placement logic.

Co-authored-by: candour <4670475+candour@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@coderabbitai

coderabbitai Bot commented May 3, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d61ab548-39ba-4d1b-b642-30d2e193c87b

📥 Commits

Reviewing files that changed from the base of the PR and between bb84200 and 5316574.

📒 Files selected for processing (2)
  • app/src/main/java/com/messark/hawker/MainViewModel.kt
  • app/src/test/java/com/messark/hawker/TrayUncleRuleTest.kt
✅ Files skipped from review due to trivial changes (1)
  • app/src/test/java/com/messark/hawker/TrayUncleRuleTest.kt

📝 Walkthrough

Walkthrough

MainViewModel placement and enemy-release logic for StallType.TRAY_RETURN_UNCLE now treat adjacent TileType.START and TileType.GOAL_TABLE as acceptable walkable neighbors in addition to TileType.FLOOR. StallUpgradeManager.calculateValue now rounds Range and Radius to one decimal. A unit test (TrayUncleRuleTest) was added to validate placement behavior.

Changes

Tray-Uncle placement & release

Layer / File(s) Summary
Core Logic
app/src/main/java/com/messark/hawker/MainViewModel.kt
TRAY_RETURN_UNCLE's neighbor filter in onCellClick now accepts TileType.START and TileType.GOAL_TABLE as valid uncle-neighbor locations alongside unblocked TileType.FLOOR. The releaseEnemy selection now computes walkability via !blocked && tile.type != PILLAR && !edge and allows TileType.START and TileType.GOAL_TABLE as valid release tiles.
Tests
app/src/test/java/com/messark/hawker/TrayUncleRuleTest.kt
New test sets Dispatchers.Main to a StandardTestDispatcher, constructs a map with an Uncle tile adjacent to a floor and a START tile, verifies pathfinding excluding the Uncle tile, selects a CHICKEN_RICE stall, clicks the floor hex via onCellClick, and asserts a stall is placed.

Stall upgrade quantization

Layer / File(s) Summary
Core Calculation
app/src/main/java/com/messark/hawker/utils/StallUpgradeManager.kt
calculateValue now rounds computed Range and Radius to one decimal place during milestone/level upgrades using (current * 10).roundToInt() / 10.0.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 16.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the two main bug fixes in the changeset: relaxed Uncle placement validation and stat precision rounding.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-tray-uncle-placement-and-stat-precision-1761859171012070732

Review rate limit: 9/10 reviews remaining, refill in 6 minutes.

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

github-actions Bot commented May 3, 2026

Copy link
Copy Markdown

Build Successful! 🚀

Download APK

Note: This link will be removed when the PR is closed.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 0392027c-5c31-4434-9f8f-215b929e6e76

📥 Commits

Reviewing files that changed from the base of the PR and between 55e606a and bb84200.

📒 Files selected for processing (3)
  • app/src/main/java/com/messark/hawker/MainViewModel.kt
  • app/src/main/java/com/messark/hawker/utils/StallUpgradeManager.kt
  • app/src/test/java/com/messark/hawker/TrayUncleRuleTest.kt

Comment thread app/src/main/java/com/messark/hawker/MainViewModel.kt Outdated
@candour
candour enabled auto-merge (squash) May 3, 2026 05:24
- Updated `MainViewModel.onCellClick` to allow `START` and `GOAL_TABLE` tiles as valid release points for the Tray Return Uncle "last empty space" check. (Note: `GOAL_TABLE` is the actual target tile used by the map generator).
- Updated `MainViewModel.releaseEnemy` to include `START` and `GOAL_TABLE` as valid release points.
- Added explicit rounding to 1 decimal place for `Range` and `Radius` stats in `StallUpgradeManager.kt` to prevent floating-point precision drift.
- Added a regression test `TrayUncleRuleTest.kt` to verify the placement logic, using `GOAL_TABLE` as the objective.

Co-authored-by: candour <4670475+candour@users.noreply.github.com>
@candour
candour merged commit 6c50a6b into main May 3, 2026
3 checks passed
@candour
candour deleted the fix-tray-uncle-placement-and-stat-precision-1761859171012070732 branch May 3, 2026 05:34
@github-actions

github-actions Bot commented May 3, 2026

Copy link
Copy Markdown

Build Successful! 🚀

Download APK

Note: This link will be removed when the PR is closed.

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.

1 participant