Draw a Houndstooth Pattern

Pyth, 61 60 55 49 bytes

j*vwmjk*Qd++Rm012Jmms}k++Rhd5U-d4T=T13+Lm1T_mP_dJ

Try it online: Demonstration

edit 1: Combine the two statements generating the band and the triangle (see below)

edit 2: Didn't saw that we can use any symbols. Saved 5 bytes edit

edit 3: @Calvin'sHobbies allowed translating the base image. Since my approach was based on this idea, this helped quite a lot. -6 bytes

And for the Cookie bonus:

.w*vw*RQ++Rm012Jmm*K255}k++Rhd5U-d4T=T13+LmKT_mP_dJ

This is only 2 bytes longer (51 bytes) and generates the file o.png. For the input 5\n4 it generates the following picture:

Houndstooth Pattern

Explanation:

The Houndstooth Pattern looks really quite irregular. But if we bring the left 7 columns to the right and the top 5 rows to the botton we get a much nicer pattern:

.#####...................
..#####..................
...#####.................
....#####................
.....#####...............
#.....#####..............
##.....#####.............
###.....#####............
####.....####............
#####.....###............
######.....##............
#######.....#............
########.................
#############.....#######
##############.....######
###############.....#####
################.....####
#################.....###
##################.....##
#############.#####.....#
#############..#####.....
#############...#####....
#############....#####...
#############.....#####..
#############......#####.
#############.......#####

First I produce the top-left 13x13 block:

.#####.......
..#####......
...#####.....
....#####....
.....#####...
#.....#####..
##.....#####.
###.....#####
####.....####
#####.....###
######.....##
#######.....#
########.....

There are 2 simple inequalities, that describe the two #-areas. The band can be described by y + 1 <= x <= y + 5 and the triangle can be described by x <= y - 5. I`ve combined these two conditions:

Jmms}k++Rhd5U-d4T=T13
                 =T13   T = 13
 m               T      map each d of [0, 1, ..., 12] to: 
                           the list produced by
  m             T          map each k of [0, 1, ..., 12] to:
       +Rhd5                  the list [d+1, d+2, ..., d+5]
      +                       extended by 
            U-d4              the list [0, 1, ..., d - 5]
    }k                        test if k is in the list
   s                          and convert the boolean result to 1 or 0
J                       assign this 13x13 block to J

Then +Rm012 adds 12 zeros at the end of each row , to get the upper 25x13 block.

The lower 25x13 block is now really simple:

+Lm1T_mP_dJ
      m   J    map each row d of J to:
       P_d        reverse the row and pop the last element
     _         reverse the order the rows
+Lm1T          add T ones at the beginning of each row. 

All now left is to repeating the pattern and print it

j*vwmjk*Qd+upperlower   implicit: Q = first input number
          +upperlower   combine the two blocks to a 25x26 block
    m                   map each row d to:
       *Qd                 repeat d Q times
     jk                    and join to a string
 *vw                    read another number from input and repeat
j                       join by newlines and print

The difference to the Cookie bonus code:

  • 255 instead of 1
  • instead of mjk*Qd I use *RQ, since I don't want a string
  • .w saves this 2D-array to file (converts it to png implicitly)

CJam, 106 73 71 bytes

0000000: 71 7e 22 04 94 51 af 40 6e 73 b2 68 3a e1 7e 13 f2 a1  q~"[email protected]:.~...
0000012: 3e 1d de f5 64 9c 6b 0f 27 4c 36 d7 81 3d 30 35 56 f8  >...d.k.'L6..=05V.
0000024: cd e8 cd 7c dc 90 31 59 40 8b 8c 22 32 35 36 62 32 32  ...|..1Y@.."256b22
0000036: 62 41 73 33 39 2a 2e 2a 73 32 35 2f 2a 66 2a 4e 2a     bAs39*.*s25/*f*N*

Prints 1 and 0 instead of . and #. Try it online in the CJam interpreter.

How it works

q~      e# Read and evaluate all input. This pushes W and H.
"…"     e# Push an encoding of run lengths of the characters in the output.
256b22b e# Convert from base 256 to base 22.
As39*   e# Push "10" and repeat it 39 times.
.*      e# Vectorized character repetition; multiply each base 22 digit (run
        e# length) by the corresponding character of "10…10".
s25/    e# Flatten and split into chunks of length 25.
*       e# Repeat the resulting array of rows H times.
f*      e# Repeat each row W times.
N*      e# Join the rows, separating by linefeeds.

Cookie bonus

0000000: 27 50 6f 31 70 71 7e 5d 5f 5b 32 35 5f 29 5d 2e 2a 5c  'Po1pq~]_[25_)].*\
0000012: 7e 22 04 94 51 af 40 6e 73 b2 68 3a e1 7e 13 f2 a1 3e  ~"[email protected]:.~...>
0000024: 1d de f5 64 9c 6b 0f 27 4c 36 d7 81 3d 30 35 56 f8 cd  ...d.k.'L6..=05V..
0000036: e8 cd 7c dc 90 31 59 40 8b 8c 22 32 35 36 62 32 32 62  ..|..1Y@.."256b22b
0000048: 41 73 33 39 2a 2e 2a 73 32 35 2f 2a 66 2a 73 2b 4e 2a  As39*.*s25/*f*s+N*

prints a Portable BitMap instead of ASCII art.

Below is the output for input 24 13, converted to PNG:

output


Befunge-93, 2120 1967 bytes

Here's some high quality befunge, with exception-handling for debugging!

&&00p10pv
v       <
    >94+2*20p        v
>00g|   >                v
    @                >10g>0020gv-1:<
                               >:0`|
                     ,       v    $<
                     +        >v>v>v>v>v>v>v>v>v>v>v>v>v>v>v>v>v>v>v>v>v>v>v>v>v>v>v
 v_$1-:#^_$20g1-20p55^       >|>|>|>|>|>|>|>|>|>|>|>|>|>|>|>|>|>|>|>|>|>|>|>|>|>|>|>"!DAB"....@
 ,:
 >^".......#.....#####......."                                                    <
  ^".......##.....#####......"                                                  <
  ^".......###.....#####....."                                                <
  ^".......####.....####....."                                              <
  ^".......#####.....###....."                                            <
  ^".......######.....##....."                                          <
  ^".......#######.....#....."                                        <
  ^".......########.........."                                      <
  ^"####################....."                                    <
  ^".####################...."                                  <
  ^"..####################..."                                <
  ^"...####################.."                              <
  ^"....####################."                            <
  ^".....####################"                          <
  ^"#.....##############.####"                        <
  ^"##.....#############..###"                      <
  ^"###....#############...##"                    <
  ^"####...#############....#"                  <
  ^"#####..#############....."                <
  ^".#####.#############....."              <
  ^"..##################....."            <
  ^"........#####............"          <
  ^".........#####..........."        <
  ^"..........#####.........."      <
  ^"...........#####........."    <
  ^"............#####........"  <
^                     p00-1g00<

(Obviously, this is still very golfable. I just wanted to get an answer up here for now)

So, this is made up of different parts.

&&00p10p

This is just the initializer, it takes in the values and stores them

    >94+2*20p
>00g|      > 
    @  

This section resets the row count, so we can print out another (width) pictures side by side. 94+2* is calculating 26, the number of rows. Also, if the height is zero, the program will terminate.

>10g

This gets the width on the stack so we know how many to print

0020gv-1:<
     >:0`|
         $

This adds two dummy values to the stack to tell when we've finished an operation, as well as what row (n) we're on. This then adds n values to the stack

>v>v>v>v>v>v>v>v>v>v>v>v>v>v>v>v>v>v>v>v>v>v>v>v>v>v>v
|>|>|>|>|>|>|>|>|>|>|>|>|>|>|>|>|>|>|>|>|>|>|>|>|>|>|>"!DAB"....@

                                                    <
                                                  <
                                                <
                                              <
                                            <
                                          <
                                        <
                                      <
                                    <
                                  <
                                <
                              <
                            <
                          <
                        <
                      <
                    <
                  <
                <
              <
            <
          <
        <
      <
    <
  <
<

This is a control section that will to the (26-n) row. This is the easiest way i could figure out how to do it.

".......#.....#####......."
".......##.....#####......"
".......###.....#####....."
".......####.....####....."
".......#####.....###....."
".......######.....##....."
".......#######.....#....."
".......########.........."
"####################....."
".####################...."
"..####################..."
"...####################.."
"....####################."
".....####################"
"#.....##############.####"
"##.....#############..###"
"###....#############...##"
"####...#############....#"
"#####..#############....."
".#####.#############....."
"..##################....."
"........#####............"
".........#####..........."
"..........#####.........."
"...........#####........."
"............#####........"

This, obviously, is read and will pop whatever row is read onto the stack backwards. This means when we pop it off, it will print properly.

v_
,:
>^

This will print until the stack hits a 0, which we left on earlier.

1-:#^_

This takes 1 off of the number of the specific line to print, then checks if it's zero or not. If it's non-zero, we go back to the fourth block of code.

          ,
          +
20g1-20p55^

This subtracts 1 from the row (n), prints a newline, and goes back to block 3

p00-1g00

Once of all of the rows have printed, this subtracts one from the initial height and goes back to block 2.

All the rest of the code is either control flow or stack management. Writing this mas more than I thought it would be, but I'm satisfied with how it looks. It's much more golfable, and that will likely remain a project for another day.

2120 -> 1967: trimmed up some lines with a lot of wasted spaces