Draw the national flag of France
Pure Bash (on OSX), 84
The default OSX terminal supports full colour emojis. Not sure if this counts as text or graphical output.
printf -vs %26s
for i in {1..26}
do echo ${s// /}${s// /⚪️}${s// /}
done
Output looks like:
Alternatively:
Bash with OSX utilities, 56
yes `dc -e3do26^d1-dn2/*p|tr 201 ⚪️`|sed 26q
The dc
expression:
- calculates
3^26-1
and prints it in ternary22222222222222222222222222
- divides this by 2, then multiplies by
3^26
. Output in ternary this is1111111111111111111111111100000000000000000000000000
tr
then translates the 210 characters to ⚪️.
yes
outputs this line indefinitely.
sed 26q
halts output at 26 lines.
Python 2, 47 bytes
s="[3%smF";print(s%4*26+s%7*26+s%1*26+"\n")*30
Contains unprintables - here's a hexdump (reversible with xxd -r
):
00000000: 733d 221b 5b33 2573 3b31 6d46 223b 7072 s=".[3%s;1mF";pr
00000010: 696e 7428 7325 342a 3236 2b73 2537 2a32 int(s%4*26+s%7*2
00000020: 362b 7325 312a 3236 2b22 5c6e 2229 2a33 6+s%1*26+"\n")*3
00000030: 30 0
Uses ANSI escape codes to print colored characters to STDOUT - I chose "F" for France. No online link because ideone doesn't support ANSI escape codes in output.
Thanks to Dennis and xnor for some great tips.
Screenshot from xterm:
Desmos, 30 12 bytes
3x>10
3x<-10
Try it online.
I'm not entirely sure if this is valid, please let me know if there are any issues.