|
@@ -41,7 +41,7 @@ func New(width, height int) *Board {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func NewRegion(startX, startY, width, height, totalWidth, totalHeight int) *Board {
|
|
func NewRegion(startX, startY, width, height, totalWidth, totalHeight int) *Board {
|
|
|
- r := rand.New(rand.NewSource(time.Now().UnixNano() + int64(startY*startY)))
|
|
|
|
|
|
|
+ r := rand.New(rand.NewSource(time.Now().UnixNano() + int64(startX*startY)))
|
|
|
return newRegion(startX, startY, width, height, totalWidth, totalHeight, r)
|
|
return newRegion(startX, startY, width, height, totalWidth, totalHeight, r)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -215,7 +215,7 @@ func ReadJSON(ofsetX, ofsetY int, reader io.Reader) *Board {
|
|
|
jsonBoard := new(boardJSON)
|
|
jsonBoard := new(boardJSON)
|
|
|
json.Unmarshal(b, &jsonBoard)
|
|
json.Unmarshal(b, &jsonBoard)
|
|
|
board := newBlank(jsonBoard.Width, jsonBoard.Height)
|
|
board := newBlank(jsonBoard.Width, jsonBoard.Height)
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
for _, t := range jsonBoard.Tiles {
|
|
for _, t := range jsonBoard.Tiles {
|
|
|
board.Set(t.X-ofsetX, t.Y-ofsetY, FromName(t.Type))
|
|
board.Set(t.X-ofsetX, t.Y-ofsetY, FromName(t.Type))
|
|
|
}
|
|
}
|
|
@@ -268,7 +268,7 @@ func newRegion(startX, startY, width, height, totalWidth, totalHeight int, r *ra
|
|
|
leftLimit := (totalWidth-maxIceWidth)/2 - startX
|
|
leftLimit := (totalWidth-maxIceWidth)/2 - startX
|
|
|
rightLimit := totalWidth/2 + maxIceWidth/2 - startX
|
|
rightLimit := totalWidth/2 + maxIceWidth/2 - startX
|
|
|
mid := totalWidth/2 - startX
|
|
mid := totalWidth/2 - startX
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
log.Printf("Creating new region width %v height %v", width, height)
|
|
log.Printf("Creating new region width %v height %v", width, height)
|
|
|
for y := 0; y < height; y++ {
|
|
for y := 0; y < height; y++ {
|
|
|
for x := 0; x < width; x++ {
|
|
for x := 0; x < width; x++ {
|