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

Snail mode #98

Merged
merged 8 commits into from
Aug 19, 2022
Merged

Snail mode #98

merged 8 commits into from
Aug 19, 2022

Conversation

jlafayette
Copy link
Contributor

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.

jlafayette and others added 5 commits July 24, 2022 12:19
- 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.
@robbles
Copy link
Contributor

robbles commented Aug 9, 2022

Thanks for building and submitting this! Just tested it out locally and it looks awesome 🚀
We're still discussing how best to handle the off-board hazard state, but I'll try to get back to you this week so this PR isn't left in limbo.

@robbles
Copy link
Contributor

robbles commented Aug 17, 2022

Hey @jlafayette and @coreyja - sorry about the delay on this one!
The current plan is to mark this map as experimental and merge it so that everyone can try it out, but we'll hold off on adding it to the custom game page and Battlegrounds until we figure out how we want to provide state storage to maps.

I just added some basic tagging support for maps. Would you mind adding the TAG_EXPERIMENTAL and TAG_HAZARD_PLACEMENT tags to this map before we merge it?

// that uniquely identifies the point given the current board size
func hash(point rules.Point, height int) int {
return point.X + point.Y*height
}
Copy link
Contributor

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.

Copy link
Contributor Author

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!

@coreyja
Copy link
Member

coreyja commented Aug 19, 2022

@jlafayette Thanks for getting this updated! 💜

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.

Thanks for the updates @jlafayette!

@robbles robbles merged commit fbbec6a into BattlesnakeOfficial:main Aug 19, 2022
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