Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow initial food placement for 8 snakes on 7x7 board #87

Merged
merged 4 commits into from
Jun 22, 2022

Conversation

torbensky
Copy link
Collaborator

@torbensky torbensky commented Jun 22, 2022

Food placement logic is altered such that small boards (7x7 or smaller) that have > 4 snakes will only spawn food in the center. This avoids a possible edge case in the original logic where the food placement for nearby snakes can overlap and throw an error.

@torbensky
Copy link
Collaborator Author

My bad, I see there are some failing tests. I'll fix those

@torbensky torbensky removed the request for review from robbles June 22, 2022 15:05
@torbensky
Copy link
Collaborator Author

Also realized I had misunderstood the ticket.

@torbensky torbensky requested a review from robbles June 22, 2022 15:23
{snakeHead.X + 1, snakeHead.Y - 1},
{snakeHead.X + 1, snakeHead.Y + 1},
}
isSmallBoard := b.Width*b.Height <= BoardSizeSmall*BoardSizeSmall
Copy link
Collaborator Author

@torbensky torbensky Jun 22, 2022

Choose a reason for hiding this comment

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

Wasn't totally sure about this. I felt like boards smaller than 7x7 shouldn't be included either though.

Copy link
Contributor

@robbles robbles left a comment

Choose a reason for hiding this comment

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

Looks good, and worked as expected when I tested a few combinations of board size and snakes.

@robbles robbles merged commit f58df66 into main Jun 22, 2022
@robbles robbles deleted the DEV-1235-fix-placement-7x7-8snake branch June 22, 2022 23:14
coreyja added a commit to coreyja/rules that referenced this pull request Jun 26, 2022
* main:
  allow initial food placement for 8 snakes on 7x7 board (BattlesnakeOfficial#87)
  fix for readme, install as go package. go get is no longer supported (BattlesnakeOfficial#86)
  Add player and board size meta data to all game maps (BattlesnakeOfficial#84)
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