-
Notifications
You must be signed in to change notification settings - Fork 51
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
Snail mode #98
Snail mode #98
Conversation
- Ensure that no more than 7 hazards are added to a square. This fixes a bug where some squares were getting way too many hazards applied to them. There must be some other bug at work here as well. - Change author names to be github usernames instead of first names
- Ensure that hazard snail-trail is not added for eliminated snakes
* main: DEV-1558-healing-pools-map (BattlesnakeOfficial#94) DEV-1556-sinkholes-map (BattlesnakeOfficial#96) CLI support for handling invalid responses (BattlesnakeOfficial#95)
Added comments to most functions and important bits of code Also changed the map so that instead of a fixed number of 7 hazards, we add hazards equal to the length of the snake.
Thanks for building and submitting this! Just tested it out locally and it looks awesome 🚀 |
Hey @jlafayette and @coreyja - sorry about the delay on this one! I just added some basic tagging support for maps. Would you mind adding the |
maps/snail_mode.go
Outdated
// that uniquely identifies the point given the current board size | ||
func hash(point rules.Point, height int) int { | ||
return point.X + point.Y*height | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's probably not worth changing, but you can actually use a rules.Point
as a map key! I think a few other maps use this to look up tables of locations for a given WxH board.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't know that was possible to use a struct as a map key - thanks!
@jlafayette Thanks for getting this updated! 💜 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the updates @jlafayette!
Add a new "Snail Mode" map where snakes leave a trail of hazards behind them.
The stack of hazards left behind is based on the length of the snake. Hazard-stack counts decrement each turn so the trails fade over time.
This uses a hacky approach of storing state between turns by using off-board hazards. Hopefully this doesn't break too many snakes - also totally open to using a different approach if something else would work better.
This map does not generate a hazard when tail chasing since placing a hazard directly on the head of a snake doesn't damage it and looks confusing in the viewer.