func (l *Layer) fill(tile rune) {
	for y := 0; y < l.Height; y++ {
		for x := 0; x < l.Width; x++ {
			l.setTile(x, y, tile)
		}
	}
}
Fill the map with a single tile type
package gmgmap
import (
	"fmt"
	"math/rand"
	"github.com/beefsack/go-astar"
)
type Layer struct {
	Name   string
	Tiles  []rune
	Width  int
	Height int
}
type Map struct {
	Layers []*Layer
	Width  int
	Height int
}
const (
	nothing    = ' '
	floor      = 'f'
	floor2     = 'F'
	road       = 'r'
	road2      = 'R'
	wall       = 'w'
	wall2      = 'W'
	room       = '.'
	room2      = '#'
	door       = '+'
	doorLocked = 'x'
	stairsUp   = '<'
	stairsDown = '>'
	tree       = 'T'
	grass      = 'g'
	sign       = 's'
	hanging    = 'h'  
	window     = 'o'
	counter    = '_'
	shopkeeper = 'A'
	shelf      = 'S'
	stock      = ')'
	table      = 't'
	chair      = 'c'
	rug        = '~'
	pot        = '{'
	assistant  = 'a'
	player     = '@'
	flower     = 'v'
	key        = '('
)
func NewMap(width, height int) *Map {
	m := new(Map)
	m.Width = width
	m.Height = height
	return m
}
func newLayer(name string, width, height int) *Layer {
	l := new(Layer)
	l.Name = name
	l.Width, l.Height = width, height
	l.Tiles = make([]rune, width*height)
	l.fill(nothing)
	return l
}
func (m *Map) Layer(name string) *Layer {
	for _, l := range m.Layers {
		if l.Name == name {
			return l
		}
	}
	m.Layers = append(m.Layers, newLayer(name, m.Width, m.Height))
	return m.Layers[len(m.Layers)-1]
}
func (m *Map) removeLayer(name string) {
	for i, l := range m.Layers {
		if l.Name == name {
			m.Layers = append(m.Layers[:i], m.Layers[i+1:]...)
			return
		}
	}
}
func (l Layer) getTile(x, y int) rune {
	if x < 0 || x >= l.Width || y < 0 || y >= l.Height {
		return rune(0)
	}
	return l.Tiles[x+y*l.Width]
}
func (l *Layer) setTile(x, y int, tile rune) {
	l.Tiles[x+y*l.Width] = tile
}
func (l *Layer) setTileInAreaIfEmpty(r rect, tile rune) {
	for i := 0; i < 100; i++ {
		x := rand.Intn(r.w) + r.x
		y := rand.Intn(r.h) + r.y
		if l.getTile(x, y) == nothing {
			l.setTile(x, y, tile)
			break
		}
	}
}
func (l Layer) isIn(x, y int) bool {
	return x >= 0 && x < l.Width && y >= 0 && y < l.Height
}