func (b Board) CanMoveTiles(tilePositions map[tile.ID]tile.Position) bool {
	ids := make(map[tile.ID]struct{}, len(tilePositions))
	positions := make(map[tile.X]map[tile.Y]struct{}, len(b.UsedTileLocs))
	for _, tp := range tilePositions {
		// ensure the tile position and id is valid
		switch {
		case tp.X < 0, tp.Y < 0, int(tp.X) >= b.Config.NumCols, int(tp.Y) >= b.Config.NumRows,
			!b.hasTile(tp.Tile):
			return false
		}
		ids[tp.Tile.ID] = struct{}{}
		// ensure no other tile is moved to the same spot
		if _, ok := positions[tp.X]; !ok {
			positions[tp.X] = make(map[tile.Y]struct{}, 1)
		} else if _, ok := positions[tp.X][tp.Y]; ok {
			return false
		}
		positions[tp.X][tp.Y] = struct{}{}
	}
	return b.canLeaveUsedTiles(ids, positions)
}
// CanMoveTiles determines if the player's tiles can be moved to/in the used area
// without overlapping any other tiles
CanMoveTiles determines if the player's tiles can be moved to/in the used area
without overlapping any other tiles
// CanMoveTiles determines if the player ' s tiles can be moved to / in the used area // without overlapping any other tiles
func (b Board) CanMoveTiles(tilePositions map[tile.ID]tile.Position) bool {
	ids := make(map[tile.ID]struct{}, len(tilePositions))
	positions := make(map[tile.X]map[tile.Y]struct{}, len(b.UsedTileLocs))
	for _, tp := range tilePositions {
		switch {
		case tp.X < 0, tp.Y < 0, int(tp.X) >= b.Config.NumCols, int(tp.Y) >= b.Config.NumRows,
			!b.hasTile(tp.Tile):
			return false
		}
		ids[tp.Tile.ID] = struct{}{}
		if _, ok := positions[tp.X]; !ok {
			positions[tp.X] = make(map[tile.Y]struct{}, 1)
		} else if _, ok := positions[tp.X][tp.Y]; ok {
			return false
		}
		positions[tp.X][tp.Y] = struct{}{}
	}
	return b.canLeaveUsedTiles(ids, positions)
}
func ( b Board ) CanMoveTiles ( tilePositions map [ tile . ID ] tile . Position ) bool { ids := make ( map [ tile . ID ] struct { } , len ( tilePositions ) ) positions := make ( map [ tile . X ] map [ tile . Y ] struct { } , len ( b . UsedTileLocs ) ) for _ , tp := range tilePositions { switch { case tp . X < 0 , tp . Y < 0 , int ( tp . X ) >= b . Config . NumCols , int ( tp . Y ) >= b . Config . NumRows , ! b . hasTile ( tp . Tile ) : return false } ids [ tp . Tile . ID ] = struct { } { } if _ , ok := positions [ tp . X ] ; ! ok { positions [ tp . X ] = make ( map [ tile . Y ] struct { } , 1 ) } else if _ , ok := positions [ tp . X ] [ tp . Y ] ; ok { return false } positions [ tp . X ] [ tp . Y ] = struct { } { } } return b . canLeaveUsedTiles ( ids , positions ) }
CanMoveTiles determines if the player's tiles can be moved to/in the used area
without overlapping any other tiles
CanMoveTiles determines if the player ' s tiles can be moved to / in the used area without overlapping any other tiles
// ensure the tile position and id is valid // ensure no other tile is moved to the same spot