Implement spiral pattern for mass room creation#11
Draft
Conversation
- Add spiral state variables to RoomSpace structure - Add spiral direction lookup table (N, E, S, W) - Modify keeper_build_roomspace() to initialize spiral from center - Modify keeper_sell_roomspace() to initialize spiral from center - Replace sequential room placement logic with spiral pattern in keeper_update_roomspace() - Spiral starts from center and spirals outward clockwise, matching AI behavior Co-authored-by: Cerwym <1760289+Cerwym@users.noreply.github.com>
- Add advance_spiral() helper function to eliminate code duplication - Clean up keeper_update_roomspace() logic - Improve code readability and maintainability Co-authored-by: Cerwym <1760289+Cerwym@users.noreply.github.com>
- Add SPIRAL_NUM_DIRECTIONS and SPIRAL_DIRECTION_MASK constants - Improve comments explaining spiral pattern progression - Document the safety limit multiplier for spiral search - Replace magic numbers with named constants for better readability Co-authored-by: Cerwym <1760289+Cerwym@users.noreply.github.com>
- Fix spiral initialization to start with steps=0 - Fix turn counting to increment on odd turns (1st, 3rd, 5th...) - Add initialize_spiral_state() helper to eliminate duplication - Improve comments to explain spiral progression - Pattern: Center first, then 1E, 1S, 2W, 2N, 3E, 3S, 4W, 4N... Co-authored-by: Cerwym <1760289+Cerwym@users.noreply.github.com>
- Update comments to accurately reflect pattern: center, then 1E, 1S, 2W, 2N, 3E, 3S... - Clarify that center is built on first call before any spiral movement - Improve documentation of the spiral algorithm flow Co-authored-by: Cerwym <1760289+Cerwym@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Update mass room creation pattern to spiral
Implement spiral pattern for mass room creation
Jan 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Mass room creation currently uses sequential placement (left-to-right, top-to-bottom). This changes it to use a spiral pattern starting from center, matching AI/computer assistance behavior.
Changes
Data Structure
RoomSpace:forward_direction,turns_made,steps_to_take_before_turning,steps_remaining_before_turn{(0,-1), (1,0), (0,1), (-1,0)}Algorithm
initialize_spiral_state(): Positions at center withsteps_remaining=0to trigger immediate setupadvance_spiral(): Decrements steps, rotates direction on turn, increments step count every 2 turns (odd turns), then movesModified Functions
keeper_build_roomspace(): Initialize spiral from center instead of top-leftkeeper_sell_roomspace(): Initialize spiral from center instead of drag startkeeper_update_roomspace(): Replace sequential traversal (4 directional switch cases) with single spiral loopThe spiral algorithm matches the AI implementation in
player_comptask.cexactly, using the same turn logic and step progression.Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.