# Build me a brick wall!

## Challenge

I need help building a brick wall! Throw together some code for me using no input and produce the following output wall shown below:

_|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|
___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|__
_|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|
___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|__
_|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|
___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|__
_|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|
___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|__
_|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|
___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|__


Now, this wall is exactly 10 characters high and 70 characters wide.

As stated above, no inputs, only code. Least amount of bytes, we have to efficiently build this brick wall. Obviously, this program has to function to get the wall built..? or it obviously won't build itself! Good luck!

## Winner

The winner goes to Marinus using the APL language, requiring a whole 12 bytes! https://codegolf.stackexchange.com/a/99028/61857

Thank you everyone for participating!

• – FlipTack Nov 8 '16 at 18:42
• Also Related. (odd that this should come up today, haha) – Conor O'Brien Nov 8 '16 at 18:43
• That's OK. I'll let you know when I have a working interpreter. I'm working on it right now, actually :) – ETHproductions Nov 10 '16 at 14:20
• – RudolfJelin Nov 10 '16 at 17:49
• For bonus points, make Mexico pay for it. – Dawood ibn Kareem Nov 11 '16 at 8:26

# R, 78 bytes

    strwrap(gsub('(.{70})','\\1 ',paste(rep('___|',175),collapse='')),70)


How?

    x=paste(rep('___|',175),collapse='')   #Creates string on 1 line
y=gsub('(.{70})','\\1 ',x)             #Adds spaces every 70 characters
z=strwrap(y,70)                        #Creates a new line every space
z                                      #Print the finished product


# C, 61 bytes

TCC Version

main(i){for(;i+699;)printf("\n%c"+(--i%70||!i),"___|"[i&3]);}


GCC Version

main(i){for(;i+699;)printf("\n%c"+(i%70||!i),"___|"[--i&3]);}

• Welcome to the site! – James Nov 11 '16 at 17:29

# Befunge-93, 42 bytes

:4%1g,1+:"F"%!#v_0#@_
_|__~>:+#5,#:4#<1g*^


Try it online!

• Nice answer. Welcome to the site! – James Nov 12 '16 at 1:43

# Retina, 2321 20 bytes


175$*_ _|_ !.{70}  Try it online • Use !.{70} to split the string at the end. – Martin Ender Nov 9 '16 at 13:59 • You can save another byte like this: retina.tryitonline.net/… – Martin Ender Nov 15 '16 at 21:15 # Python 3, 40 bytes p="_|__"*17 print((p+"_|\n__"+p+"\n")*5)  # Python 2, 50 48 bytes for b in range(10):print('_|__'*175)[b*70:][:70]  2 saved with thanks to @xnor but also thanks to @Shebang for the suggestion :) • b*70+70 -> -~b*70 saves a byte :) – Kade Nov 8 '16 at 18:33 • Or [b*70:][:70]. – xnor Nov 8 '16 at 18:34 • Thanks @xnor. Didn't know you could do that. may well go back and trim a couple off some of my other recent answers :) – ElPedro Nov 8 '16 at 18:41 # Jolf, 17 bytes RZc*"_|__"Τ755@FS  Try it here! ## Explanation RZc*"_|__"Τ755@FS *"_|__" repeat this string: Τ755 7*5*5 = 175 times Zc @F chop into groups of 70 (F's charcode) R S join by newlines  # SOML, 16 bytes _|__”’ø*L{:jjp»»  explanation: _|__” push "_|__" ’ø push 18 * repeat the "_|__" 18 times L{ repeat 10 times: : duplicate the sting jj pop the last 2 letters off p output it »» put the last 2 characters at the start  ## GolfSharp, 38 bytes c(r(175).s(n=>"_|__").j().S(70).j(N));  # Pyth, 2423 22 bytes VT:*175"_|__"J*70N+70J  OK, I'm still learning. Any hints gratefully received :) Edit Saved a byte by moving the assignment of J to first use ## Racket 159 bytes (let p((n 2)(x 0)(t 0)(d display))(when(> x 69)(d"\n")(set! x 0))(cond[(> t 699) (d"\n")][(> n 2)(d"|")(p 0(+ 1 x)(+ 1 t)d)][(d"_")(p(+ 1 n)(+ 1 x)(+ 1 t)d)]))  Ungolfed: (define (f) (let loop ((n 2) (x 0) (t 0) (d display)) (when (> x 69) (d "\n") (set! x 0)) (cond [(> t 699) (d "\n")] [(> n 2) (d "|") (loop 0 (+ 1 x) (+ 1 t) d)] [else (d "_") (loop (+ 1 n) (+ 1 x) (+ 1 t) d)] )))  Testing: (f)  Output: _|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___| ___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|__ _|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___| ___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|__ _|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___| ___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|__ _|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___| ___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|__ _|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___| ___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|__  # Ruby, 89807776725347 42 Bytes puts (%w[___]*176*?|)[2..-1].scan(/.{70}/)  Demo: >> puts (%w[___]*176*?|)[2..-1].scan(/.{70}/) _|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___| ___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|__ _|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___| ___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|__ _|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___| ___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|__ _|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___| ___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|__ _|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___| ___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|__  Update: I didn’t see there’s already an answer with 30 bytes. # PHP, 46 bytes <?=wordwrap(str_repeat('_|__',175),70,"\n",1);  Output: C:\PHP>php build-me-a-brick-wall.php _|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___| ___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|__ _|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___| ___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|__ _|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___| ___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|__ _|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___| ___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|__ _|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___| ___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|__  • I think wordwrap()'s 3rd parameter should be "\n" as this currently keeps the string unwrapped in PHP 5.6. – manatwork Nov 9 '16 at 14:29 • @manatwork In the "test online" link you can check the various versions of PHP, it seems working fine in PHP all versions. – Mario Nov 9 '16 at 14:37 • Correct, “seems”. But the output is wrapped by the sandbox site, not by PHP. See with “Output: Raw”. – manatwork Nov 9 '16 at 14:49 • @manatwork I thought the textbox output is acceptable too. I tryed with <?=wordwrap(str_repeat('_|__',175),70,"\n",1);  and still no wraps in Raw output while it works fine if you save it in a PHP file and run in a browser. – Mario Nov 9 '16 at 14:58 • Well, relying on the sandbox sounds similar to what was discussed in When is code that requires a REPL acceptable?. So if you add it to the post title, should be fine. (Honestly, I still not like the idea.) BTW, you can just wrap the line in that place instead of writing \n, to keep the code size at original 45. – manatwork Nov 9 '16 at 15:04 ## Java 8, 128 This code directly calculates each character and has no imports or dependencies. Golfed: ()->{String s="";for(int x,y=0;y<10;++y){for(x=0;x<70;++x)s+=((y%2<1&(x+3)%4<1)|(y%2>0&(x+1)%4<1))?"|":"_";s+="\n";}return s;}  Ungolfed: () -> { String s = ""; for (int x, y = 0; y < 10; ++y) { for (x = 0; x < 70; ++x) s += ((y % 2 < 1 & (x + 3) % 4 < 1) | (y % 2 > 0 & (x + 1) % 4 < 1)) ? "|" : "_"; s += "\n"; } return s; }  # Swift 3, 69 bytes (3...702).map{print($0%4<1 ?"|":"_",terminator:($0-2)%70<1 ?"\n":"")}  Output after compiling and running: _|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___| ___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|__ _|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___| ___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|__ _|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___| ___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|__ _|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___| ___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|__ _|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___| ___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|__  Try online here (In this tool it run as script so it will produce a warning due the map result is unused. ## Clojure, 117 110 bytes (fn[](println(apply str(map #(str(apply str %)"\n")(partition 70(subs(apply str(repeat 175 "_|__"))0 700))))))  Basically creates a long string of "_|__"s 700 characters long, cuts it every 70 characters, then joins them with newline. Managed to get rid of the calls to join! Ungolfed: (defn build-wall [] (println (apply str (map #(str (apply str %) "\n") (partition 70 (subs (apply str (repeat 175 "_|__")) 0 700))))))  # C#, 106102101118107106100 96 bytes Thanks shebang for saving 2 bytes and pointing out a mistake, Yodle for saving 6 bytes and Link Ng for saving 4 bytes. var a="";int i;for(;i++<175;)a+="_|__";for(i=0;i<10;)Console.Write(a.Substring(i++*10,70)+"\n");  You can test it directly on http://csharppad.com/. • Change the a%2==0 to a%2<1 to save a byte :) – Kade Nov 8 '16 at 18:39 • Also, you can remove the a++ in the for definition and change a%2 to a++%2! – Kade Nov 8 '16 at 18:41 • You can save 4 bytes by declaring i outside the loop, incrementing i within the condition i<175, and using i in the second loop instead of a new integer b. – Yodle Nov 8 '16 at 19:45 • @Yodle I could save 6 bytes by doing so (and not 4), thanks! – Ave Nov 8 '16 at 19:48 • Ahh I guess they have a default value of 0 :P. In VS it won't let you declare local variables without initializing them, so the =0 made it only 4 for me. – Yodle Nov 8 '16 at 19:50 # Java 8 + Guava, 81 106 bytes 25 bytes for import: com.google.common.base.*; Lambda that takes no input and returns the required wall. ()->String.join("\n",Splitter.fixedLength(70).split(Strings.repeat("_|__",175)));  Same as many other solutions. Takes a repeating string of "_|__" 175 times, splits it into lengths of 70, then joins them on newline. ## SAS, 68 option linesize=70;data;length w$700;w=repeat('_|__',174);put w;run;


The 174 is not a typo - in SAS the repeat function rather pedantically returns the original string plus n repeats.

## Python 3, 43

print(("_|__"*17+"_|\n"+"__|_"*17+"_\n")*5)


Fixed to be more Trump-like.

# Kotlin, 99 bytes

fun main(a:Array<String>){"_|__".repeat(999).split(Regex("(?<=\\G.{70})")).take(10).map(::println)}


Regex taken from here. First ever golf, done in 10 minutes, probably improvable..

• Welcome to PPCG! Can you remove some of the spaces? Like a:Array<String>? – Rɪᴋᴇʀ Nov 11 '16 at 17:48
• How'd I miss that...thanks. – F. George Nov 11 '16 at 17:50
• @mEQ5aNLrK3lqs3kfSa5HbvsTWe0nIu What does your name mean? – Oliver Ni Nov 11 '16 at 18:04
• I use random usernames everywhere, I don't like the possibility of somebody googling my nick and finding out everything about my online life. – F. George Nov 11 '16 at 18:07

# Lua, 54 bytes

w=("_|__"):rep(17)print((w.."_|\n__"..w.."\n"):rep(5))


No fancy splits for Lua, but it does have an easy repeat.

# bash 36 Byte

printf '_|__%.0s' {1..175}|fold -w70


OUtput:

_|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|
___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|__
_|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|
___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|__
_|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|
___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|__
_|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|
___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|__
_|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|
___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|__


# Python 2, 46 bytes

import textwrap as t;print t.fill('_|__'*175)


I was going to do an exec loop similar to @xnor's one alternate solution but he/she got to it before me. I guess I'll just have to let Python do the dirty work for me.

# R, 62 bytes

Don't have the rep to comment, so posting as an answer: @user3297046's answer can be golfed-down to 62 bytes:

cat(gsub('(.{70})','\\1
',paste(rep('_|__',175),collapse='')))


which results in

_|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|
___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|__
_|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|
___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|__
_|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|
___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|__
_|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|
___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|__
_|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|
___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|__


## PHP, 56 bytes

Although I know it can be done smaller using wordwrap or string splits, I prefer more hacky solutions.

for($i=0;$i<700;$i++){echo($i%70?'':'
').'_|___'[$i%4];}  # Symbolic Python, 69 bytes Outputs as a list of lines. _=-~(_==_) __=-~_*-~_*_ _=[('_|__'*__)[:-_],('___|'*__)[:-_]]*-~(_*_)  Try it online! Alternatively, for 16 more bytes, we can print the wall: _=-~(_==_) __=-~_*-~_*_ _=(('_|__'*__)[:-_]+""" """+('___|'*__)[:-_]+""" """)*-~(_*_)  Try it online! # Tcl, 847877 76 bytes time {append a [expr [incr i]%4-2?"_":"|"];if$i%70<1 {puts $a;unset a}} 700  Try it online! • Interesting trick of append and unset! – sergiol Nov 30 '18 at 1:46 • @sergiol you sure took your time to reply :P also haven't been using tcl lately. idk if i should start using it again – ASCII-only Dec 5 '18 at 11:37 # Perl, 37 bytes print$_.$/x!(++$i%35)for('_|',__)x175


Ungolfed:

my $i = 0; print($_, "\n" x !(++$i % 35)) for ('_|', '__') x 175;  ## Lithp, 72 bytes #::((print (replace (repeat "_|__" 175) (regex "(.{70})" "g") "$1\n"))))


Sample usage:

% wall.lithp
(
(def x #::((print (replace (repeat "_|__" 175) (regex "(.{70})" "g") "$1\n")))) (x) )  Output: $ ./run.js wall.lithp
_|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|
___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|__
_|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|
___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|__
_|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|
___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|__
_|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|
___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|__
_|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|
___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|__
`