Rivers and Bridges map refactor (#103)
* Separated out rivers and bridges into its own file with three map variants * fixing tags * removed extra 4 starting positions from the medium map since it only supports 8 players * update GetUnoccupiedPoints to consider hazards with a flag * use new utility method to fine unoccupied points and enforce map sizes * changed up casting to make IsAllowable() more usable
This commit is contained in:
parent
7d769b01b6
commit
f82cfe5309
10 changed files with 484 additions and 347 deletions
|
|
@ -44,6 +44,20 @@ func (d sizes) IsUnlimited() bool {
|
|||
return len(d) == 1 && d[0].Width == 0
|
||||
}
|
||||
|
||||
func (d sizes) IsAllowable(Width int, Height int) bool {
|
||||
if d.IsUnlimited() {
|
||||
return true
|
||||
}
|
||||
|
||||
for _, size := range d {
|
||||
if size.Width == uint(Width) && size.Height == uint(Height) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
// AnySize creates sizes for a board that has no fixed sizes (supports unlimited sizes).
|
||||
func AnySize() sizes {
|
||||
return sizes{Dimensions{Width: 0, Height: 0}}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue