4 added 403 characters in body
source | link

J, 85 bytes

Let g = gcd(w,h). The function fills the elements of a w/g by h/g matrix with g by g tiles, having /'s and \'s in their diagonal and anti-diagonal. The resulting 4D array is raveled into a 2D one (the inside of the box) then surrounded with #'s. (The numbers 0 1 2 3 are used instead of [space] / \ # and the numbers are changed to characters at the end.)

A direct position based computation of inside coordinate could maybe yield a bit shorter solution.

' \/#'echo@:{~3,.~3,.3,~3,,$[:,[:,"%.0 2 1 3|:((,:2*|.)@=@i.@+.){~[:(2&|@+/&:i.)/,%+.

Uses some array juggling. Will golf more and add some explanation soon.

Usage:

   6 (' \/#'echo@:{~3,.~3,.3,~3,,$[:,[:,"%.0 2 1 3|:((,:2*|.)@=@i.@+.){~[:(2&|@+/&:i.)/,%+.) 22
########################
#\  /\  /\  /\  /\  /\ #
# \/  \/  \/  \/  \/  \#
# /\  /\  /\  /\  /\  /#
#/  \/  \/  \/  \/  \/ #
#\  /\  /\  /\  /\  /\ #
# \/  \/  \/  \/  \/  \#
########################

Try it online here.

J, 85 bytes

' \/#'echo@:{~3,.~3,.3,~3,,$[:,[:,"%.0 2 1 3|:((,:2*|.)@=@i.@+.){~[:(2&|@+/&:i.)/,%+.

Uses some array juggling. Will golf more and add some explanation soon.

Usage:

   6 (' \/#'echo@:{~3,.~3,.3,~3,,$[:,[:,"%.0 2 1 3|:((,:2*|.)@=@i.@+.){~[:(2&|@+/&:i.)/,%+.) 22
########################
#\  /\  /\  /\  /\  /\ #
# \/  \/  \/  \/  \/  \#
# /\  /\  /\  /\  /\  /#
#/  \/  \/  \/  \/  \/ #
#\  /\  /\  /\  /\  /\ #
# \/  \/  \/  \/  \/  \#
########################

Try it online here.

J, 85 bytes

Let g = gcd(w,h). The function fills the elements of a w/g by h/g matrix with g by g tiles, having /'s and \'s in their diagonal and anti-diagonal. The resulting 4D array is raveled into a 2D one (the inside of the box) then surrounded with #'s. (The numbers 0 1 2 3 are used instead of [space] / \ # and the numbers are changed to characters at the end.)

A direct position based computation of inside coordinate could maybe yield a bit shorter solution.

' \/#'echo@:{~3,.~3,.3,~3,,$[:,[:,"%.0 2 1 3|:((,:2*|.)@=@i.@+.){~[:(2&|@+/&:i.)/,%+.

Usage:

   6 (' \/#'echo@:{~3,.~3,.3,~3,,$[:,[:,"%.0 2 1 3|:((,:2*|.)@=@i.@+.){~[:(2&|@+/&:i.)/,%+.) 22
########################
#\  /\  /\  /\  /\  /\ #
# \/  \/  \/  \/  \/  \#
# /\  /\  /\  /\  /\  /#
#/  \/  \/  \/  \/  \/ #
#\  /\  /\  /\  /\  /\ #
# \/  \/  \/  \/  \/  \#
########################

Try it online here.

3 edited body
source | link

J, 85 bytes

' \/#'#'echo@:{~3,.~3,.3,~3,[:,.2 0 1|$[:,[:,"%.0 2 1 3|:((,:2*|.)@=@i.@+.){~[:(2&|@+/&:i.)/,%+.

Uses some array juggling. Will golf more and add some explanation soon.

Usage:

   226 (' \/#'#'echo@:{~3,.~3,.3,~3,[:,.2 0 1|$[:,[:,"%.0 2 1 3|:((,:2*|.)@=@i.@+.){~[:(2&|@+/&:i.)/,%+.) 622
########################
#\  /\  /\  /\  /\  /\ #
# \/  \/  \/  \/  \/  \#
# /\  /\  /\  /\  /\  /#
#/  \/  \/  \/  \/  \/ #
#\  /\  /\  /\  /\  /\ #
# \/  \/  \/  \/  \/  \#
########################

Try it online here.

J, 85 bytes

' \/#'{~3,.~3,.3,~3,[:,.2 0 1|:[:,"%.0 2 1 3|:((,:2*|.)@=@i.@+.){~[:(2&|@+/&:i.)/,%+.

Uses some array juggling. Will golf more and add some explanation soon.

Usage:

   22 (' \/#'{~3,.~3,.3,~3,[:,.2 0 1|:[:,"%.0 2 1 3|:((,:2*|.)@=@i.@+.){~[:(2&|@+/&:i.)/,%+.) 6
########################
#\  /\  /\  /\  /\  /\ #
# \/  \/  \/  \/  \/  \#
# /\  /\  /\  /\  /\  /#
#/  \/  \/  \/  \/  \/ #
#\  /\  /\  /\  /\  /\ #
# \/  \/  \/  \/  \/  \#
########################

Try it online here.

J, 85 bytes

' \/#'echo@:{~3,.~3,.3,~3,,$[:,[:,"%.0 2 1 3|:((,:2*|.)@=@i.@+.){~[:(2&|@+/&:i.)/,%+.

Uses some array juggling. Will golf more and add some explanation soon.

Usage:

   6 (' \/#'echo@:{~3,.~3,.3,~3,,$[:,[:,"%.0 2 1 3|:((,:2*|.)@=@i.@+.){~[:(2&|@+/&:i.)/,%+.) 22
########################
#\  /\  /\  /\  /\  /\ #
# \/  \/  \/  \/  \/  \#
# /\  /\  /\  /\  /\  /#
#/  \/  \/  \/  \/  \/ #
#\  /\  /\  /\  /\  /\ #
# \/  \/  \/  \/  \/  \#
########################

Try it online here.

2 deleted 6 characters in body
source | link

J, 9185 bytes

' \/#'{~3,.~3,0|:.3,~3,[:,.2 0 1|:[:,"%.0 2 1 3|:((,:2*|.)@=@i.@+.){~(]%+.)~[:(2&|@+/&:i.)([%+/,%+.)

Uses some array juggling. Will golf more and add some explanation soon.

Usage:

   22 (' \/#'{~3,.~3,0|:.3,~3,[:,.2 0 1|:[:,"%.0 2 1 3|:((,:2*|.)@=@i.@+.){~(]%+.)~[:(2&|@+/&:i.)([%+/,%+.)) 6
########################
#\  /\  /\  /\  /\  /\ #
# \/  \/  \/  \/  \/  \#
# /\  /\  /\  /\  /\  /#
#/  \/  \/  \/  \/  \/ #
#\  /\  /\  /\  /\  /\ #
# \/  \/  \/  \/  \/  \#
########################

Try it online here.

J, 91 bytes

' \/#'{~3,~3,0|:3,~3,[:,.2 0 1|:[:,"%.0 2 1 3|:((,:2*|.)@=@i.@+.){~(]%+.)(2&|@+/&:i.)([%+.)

Uses some array juggling. Will golf more and add some explanation soon.

Usage:

   22 (' \/#'{~3,~3,0|:3,~3,[:,.2 0 1|:[:,"%.0 2 1 3|:((,:2*|.)@=@i.@+.){~(]%+.)(2&|@+/&:i.)([%+.)) 6
########################
#\  /\  /\  /\  /\  /\ #
# \/  \/  \/  \/  \/  \#
# /\  /\  /\  /\  /\  /#
#/  \/  \/  \/  \/  \/ #
#\  /\  /\  /\  /\  /\ #
# \/  \/  \/  \/  \/  \#
########################

Try it online here.

J, 85 bytes

' \/#'{~3,.~3,.3,~3,[:,.2 0 1|:[:,"%.0 2 1 3|:((,:2*|.)@=@i.@+.){~[:(2&|@+/&:i.)/,%+.

Uses some array juggling. Will golf more and add some explanation soon.

Usage:

   22 (' \/#'{~3,.~3,.3,~3,[:,.2 0 1|:[:,"%.0 2 1 3|:((,:2*|.)@=@i.@+.){~[:(2&|@+/&:i.)/,%+.) 6
########################
#\  /\  /\  /\  /\  /\ #
# \/  \/  \/  \/  \/  \#
# /\  /\  /\  /\  /\  /#
#/  \/  \/  \/  \/  \/ #
#\  /\  /\  /\  /\  /\ #
# \/  \/  \/  \/  \/  \#
########################

Try it online here.

1
source | link