-
Notifications
You must be signed in to change notification settings - Fork 53
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
Rivers and Bridges map refactor #103
Conversation
# Conflicts: # maps/hazards.go
…supports 8 players
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.
Looks good, and works for me locally. Just have a couple of optional suggestions.
maps/rivers_and_bridges.go
Outdated
globalRegistry.RegisterMap("hz_rivers_bridges_xl", RiverAndBridgesExtraLargeHazardsMap{}) | ||
} | ||
|
||
func getUnoccupiedPoints(lastBoardState *rules.BoardState) []rules.Point { |
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 think it's a little confusing having two similarly named functions in the rules and maps packages, where one actually wraps the other. Maybe either:
- rename to
getUnoccupiedPointsWithHazards
- add a boolean param to
rules.GetUnoccupiedPoints
that makes it exclude hazards as well, and use that instead?
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'm open to either option. Feels like we may want to do this more often so maybe #2 makes the most sense?
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 think we want to move towards providing more reusable utilities for maps to do common operations like this, so 2 is probably better.
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.
ok, i'll take a swing at this and see if I can figure out how rules.GetUnoccupiedPoints() works
} | ||
} | ||
|
||
func (m RiverAndBridgesMediumHazardsMap) SetupBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error { |
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.
We might want to have these return an error if the board size isn't the supported one. Otherwise it draws the map regardless of whether it fits on the 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 was wondering about this, i didn't know if the map system had that built in or if we need to do standard checks at the start of SetupBoard() on every map
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 not built in currently. Right now it's sort of the maps choice whether to enforce the supported sizes and validate settings.
I think if it's going to produce "wrong" behaviour like off-grid hazards vs. just "funny-looking" games, that might be the reason to enforce it in the map. Unless something's changed, the error message should be passed back to the play UI, so you can at least see why a game wasn't created.
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.
Looks good!
maps/game_map.go
Outdated
} | ||
|
||
for _, size := range d { | ||
if size.Width == Width && size.Height == 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.
Might be a little nicer to cast to uint
internally here so that most calls to IsAllowable
don't need to cast int -> uint.
* castle_wall map Wall of hazards around the board with dangerous bridges. - add support for all standard board sizes - hazard placement for all board sizes * passage food placement for all board sizes * 4 snake starting positions for all maps * only one food can spawn on a bridge * support 8 snakes for all board sizes support 12 snakes on XLarge and XXLarge board sizes * max 2 food sm/med/lg and max 4 food on xlg/xxlg no food in the first 10 turns * sort generated hazard positions * remove 'uninteresting' castle wall map board sizes * refactor castle wall map to align with #103 * align map castle wall meta Name with ID * set MinPlayers to 1 for castle wall map * pass max snake/food and startPosition to priv func * fix castle wall food placement and refactor tests * avoid food spawn by snake heads on castle wall map - fixes forced food spawning infront of snake issue on large & xlarge maps with double walls
Breaking the river and bridges map into three maps, each focusing on a single map size