change map support for large #'s of snakes (#92)
* change map support for large #'s of snakes * test square board fn * format comment * add whitespace * better support large #'s of snakes on small boards * include an intermediate xlarge size
This commit is contained in:
parent
08cb7ae61d
commit
663c377cc4
10 changed files with 174 additions and 101 deletions
|
|
@ -42,6 +42,19 @@ func AnySize() sizes {
|
|||
return sizes{Dimensions{Width: 0, Height: 0}}
|
||||
}
|
||||
|
||||
// OddSizes generates square (width = height) board sizes with an odd number of positions
|
||||
// in the vertical and horizontal directions.
|
||||
// Examples:
|
||||
// - OddSizes(11,21) produces [(11,11), (13,13), (15,15), (17,17), (19,19), (21,21)]
|
||||
func OddSizes(min, max uint) sizes {
|
||||
var s sizes
|
||||
for i := min; i <= max; i += 2 {
|
||||
s = append(s, Dimensions{Width: i, Height: i})
|
||||
}
|
||||
|
||||
return s
|
||||
}
|
||||
|
||||
// FixedSizes creates dimensions for a board that has 1 or more fixed sizes.
|
||||
// Examples:
|
||||
// - FixedSizes(Dimension{9,11}) supports only a width of 9 and a height of 11.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue