[Question]
  [
**Closed**. This question needs to be more [focused](/help/closed-questions). It is not currently accepting answers.
 
 
---
**Want to improve this question?** Update the question so it focuses on one problem only by [editing this post](/posts/19123/edit).
Closed 3 years ago.
[Improve this question](/posts/19123/edit) 
# Challenge
Draw a Heart shape
![enter image description here](https://i.stack.imgur.com/gXjjm.jpg)
...as ASCII art!
Your art doesn't have to look exactly like mine, but it has to look like a Heart Shape.
The inside of of the heart has to contain the words "Love" at least 20 times
# Rules
* The program must write the art to the console.
* Shortest code (in bytes, any language) wins.
The winner will be chosen on February 14th on Valentines Day
  
[Answer]
## JavaScript [160 bytes]
The following code seems to be **160 bytes** unformatted.
```
   ('l2v2l6v2'+  'e1l1v3l2'+
 'v3e1v7e1v7e1v7e1l2v6e1l4v5'+
'e1l6v4e1l8v3e1l7l3v2e1l9l3v1')
 .replace(/[lve]\d/g,function
   (c){return Array(-~c[1]).
      join({l:' ',v:'Love'
         ,e:'\n'}[c[0
             ]])})
```
Simply run this in the browser console (e.g. in Firebug or Chrome Dev Tools).
[Answer]
## GolfScript: ~~62~~ ~~57~~ 54 characters
```
4 1.5\.5,+{.5\-\2*\0.}/]4/{[32'LOVE']2*]zip{(*}%''+}%~
```
Output:
```
    LOVE    LOVE
  LOVELOVELOVELOVE
LOVELOVELOVELOVELOVE
  LOVELOVELOVELOVE
    LOVELOVELOVE
      LOVELOVE
        LOVE
```
Or, for some added love, and the obligatory abuse of whitespace insignificance (for 84 characters):
```
    5 1       .8\
  .)...5   ,{.5\-\3
 *\0.}/]4 /{[32[9829
  :x.'LOVE'\]''+]2
    *[@;]zip{(*}%
     ''+}%~' '15
        *x[]+
          +
```
Output:
```
     ♥LOVE♥        ♥LOVE♥
  ♥LOVE♥♥LOVE♥  ♥LOVE♥♥LOVE♥
♥LOVE♥♥LOVE♥♥LOVE♥♥LOVE♥♥LOVE♥
   ♥LOVE♥♥LOVE♥♥LOVE♥♥LOVE♥
      ♥LOVE♥♥LOVE♥♥LOVE♥
         ♥LOVE♥♥LOVE♥
            ♥LOVE♥
               ♥
```
[Answer]
# C - 183 bytes
Not a winner, but a whole lotta love. Can you figure out how it works?
```
#include <stdio.h>
#define C(a) ((a)*(a)*(a))
int main(){int x,y;for(y=9;y>-6;y--){for(x=-8;x<9;x++)putchar(C(x*x+y*y-25)<25*x*x*y*y*y?"LOVE"[(x+10)%4]:'-');putchar('\n');}return 0;}
```
Output:
```
-----------------
--LOVE-----OVEL--
-ELOVEL---LOVELO-
-ELOVELO-ELOVELO-
-ELOVELO-ELOVELO-
-ELOVELOVELOVELO-
--LOVELOVELOVEL--
--LOVELOVELOVEL--
---OVELOVELOVE---
----VELOVELOV----
----VELOVELOV----
------LOVEL------
-------OVE-------
--------V--------
-----------------
```
[Answer]
## Scala - 273 Characters
Well, I certainly don't expect to win for brevity, but I wanted to see if I could do it in Scala. A smarter golfer could probably shave several bytes off, but here's what I got:
```
type D=Double;def w(x:D,y:D,a:D)={val(i,j)=(x-a,y-8);Math.sqrt(i*i+j*j)< 8};val l:Stream[Char]="love".toStream#:::l;val c=l.toIterator;def p(b:Boolean)=print(if(b)c.next else' ');for(y<-0 to 24){for(x<-0 to 32){if(y>7)p((16-x).abs< 24-y)else p(w(x,y,8)|w(x,y,24))};println}
```
Or, if you prefer (still valid code!)
```
  type D=      Double 
def w(x:D,    y:D,a:D)=
{val(i,j)=   (x-a,y -8);
Math.sqrt(i* i+j*j)< 8};
val l : Stream [Char] =
"love".toStream#:::l;val
 c= l .toIterator;def p
  (b:Boolean) =print(if
   (b)c.next else' ');
    for (y <-0 to 24) 
     { for (x<- 0 to
      32){if(y >7)
        p((16-x).
          abs < 
          24-y)
         else
        p(w
       (x,
       y,
      8
      )
      |
      w(
       x,
         y,
           24)
              )}
                 println}
```
Prints out two semicircles and a triangle to the screen, making a pretty decent facsimile of a heart.![Picture of heart.scala output](https://i.stack.imgur.com/XypzQ.png)
Needs to be run with the scala interpreter (compiling would require adding some extra cruft for `object Main { def main(args: Array[String]) = { ... } }` and I'm just havin' none of that.
[Answer]
## Python, 210 characters
Of course, this won't win because it is a code golf, but I wanted to be creative and I have **not** used the word `Love` in my source code:
```
import gzip
print(gzip.decompress(b'\x1f\x8b\x08\x00\x95\x10\xe0R\x02\xffSPP\xf0\xc9/KU\x80\x03\x10\x8f\x0bB\xa1c.l\x82dJ\xe0\xb0\x01\xe6\x02\x0cATa.T\xf7\x02\x00\xd9\x91g\x05\xc5\x00\x00\x00').decode('ascii'))
```
This is the output:
```
   Love          Love
  LoveLoveLoveLoveLove
LoveLoveLoveLoveLoveLove
LoveLoveLoveLoveLoveLove
LoveLoveLoveLoveLoveLove
  LoveLoveLoveLoveLove
    LoveLoveLoveLove
      LoveLoveLove
          Love
```
[Answer]
## Python 2, 117
prints exactly 20 `love`s horizontally.
```
x="love";print"   x    x\nx xx x\nx   x   x".replace("x",x)
for i in range(5):print" "*i+x+" "*(9-i*2),x
print" "*6,x
```
output:
```
   love    love
love lovelove love
love   love   love
love          love
 love        love
  love      love
   love    love
    love  love
       love
```
[Answer]
## Perl - 36 bytes
```
  open    0;s
/\S.?/Lo.ve
  /ge,print
    , , for
        <0>
```
Output:
```
  LoveLove    LoveLove
LoveLoveLoveLoveLoveLove
  LoveLoveLoveLoveLove
    LoveLoveLoveLove
        LoveLove
```
This is a bit of a cheat; it will print `Love` once for every two non-white space characters in the source code. With the required whitespace to make the heart shape, the code is *61* bytes in length: flattened it is only *36* bytes:
```
open 0;s/\S.?/Lo.ve/ge,print,,for<0>
```
---
## Perl - 60 bytes
```
print$"x(15&ord),Love,$/x/\D/for'3h112a05e0n1l2j4f6b9'=~/./g
```
Outputs the following:
```
   Love        Love
 Love Love  Love Love
Love     Love     Love
Love              Love
 Love            Love
  Love          Love
    Love      Love
      Love  Love
         Love
```
Exactly 20 `Love`.
---
**Brief Explaination**  
[by request](https://codegolf.stackexchange.com/questions/19123/#comment202844_19538)
* **`for'3h112a05e0n1l2j4f6b9'=~/./g`**  
This [modifies](http://perldoc.perl.org/perlsyn.html#Statement-Modifiers) the print statement, and iterates over each character. The regex `/./` obviously matches a single character, and in a list context `/./g` will return a list of all characters in the string. A more common, but slightly longer way to write this would be `for split//,'3h112a05e0n1l2j4f6b9'`.
* **`print$"x(15&ord),Love,$/x/\D/`**  
The special variable [`$"`](http://perldoc.perl.org/perlvar.html#%24LIST_SEPARATOR) defaults to a space. The [ord](http://perldoc.perl.org/functions/ord.html)inal value of each character mod 16 stores the number spaces needed between each `Love` via string repetition ([`x`](http://perldoc.perl.org/perlop.html#Multiplicative-Operators)). Finally, if the character is not a digit (`/\D/`), the value of [`$/`](http://perldoc.perl.org/perlvar.html#%24INPUT_RECORD_SEPARATOR), which defaults to `"\n"` is tacked on to the end.
[Answer]
#  Wolfram Language (Mathematica) - 111
```
i=0;MatrixForm@Table[If[(x^2+y^2-200)^3+10x^2y^3<0,{"L","O","V","E"}[[i++~Mod~4+1]],""],{y,-20,20},{x,-20,20}]
```
![enter image description here](https://i.stack.imgur.com/iZ40c.gif)
[Answer]
# Javascript - 147 141 137 133 characters
```
with(Math){s="";for(k=800;k--;)
x=abs(1.25-k%40/16),y=k/320-1.25,
s+=.75>x+abs(y)|.5>sqrt(x*x-x+y*y-y+.5)
?"Love"[k%4]:39==k%40?"\n":" "}s
```
Note : I posted another answer, but this one use different approach and heart has a different shape.
How it works :
![enter image description here](https://i.stack.imgur.com/2Y1bf.jpg)
First, I render a diamond (equation is `|x|+|y|`) then, I combine two circles on the top. x values are mirrored (so only one circle is needed).
[Answer]
# Ruby, 47, or Golfscript, 41
Boring answer.
```
puts" Love  Love
"+"LoveLoveLove
"*6+"    Love"
```
Golfscript version: 
```
" Love  Love
""LoveLoveLove
"6*"    Love"
```
Output: 
```
 Love  Love
LoveLoveLove
LoveLoveLove
LoveLoveLove
LoveLoveLove
LoveLoveLove
LoveLoveLove
    Love
```
[Answer]
# [Sclipting](http://esolangs.org/wiki/Sclipting) — 28 chars / 56 bytes
```
겤뙡늆굚넰밌各긂밀❷거雙復냄뭖끐❸갰右거雙復겠⓸걠右復終
```
Output:
```
    LOVE    LOVE
  LOVELOVELOVELOVE
LOVELOVELOVELOVELOVE
  LOVELOVELOVELOVE
    LOVELOVELOVE
      LOVELOVE
        LOVE
```
[Answer]
## JavaScript - 136 121 115 113 characters
```
s="";for(k=800;k--;)
x=1.25-k%40/16,y=k/320-1.25,
s+=Math.pow(x*x+y*y-1,3)<x*x*y*y*y
?"Love"[k%4]:39==k%40?"\n":" ";s
```
To run : copy paste into browser console (eg : Chrome or Firefox)
[Answer]
## C, 116 chars
(I don't know if this is heart-shaped enough... fills the inside of three circles to produce the output.)
```
i = 192, x, y;
main(t) {
  for (; i--; putchar(i % 16? y : 10))
    y = i / 16 - 8,
    x = i % 16 - 8,
    t = x*x + y*y,
    y = " Levo"[ (t < 64 & y < 0 | t < 8*abs(x)) * (i % 4 + 1) ];
}
```
Output:
```
 veLov   veLov 
oveLove oveLove
oveLove oveLove
oveLove oveLove
oveLoveLoveLove
oveLoveLoveLove
oveLoveLoveLove
 veLoveLoveLov 
 veLoveLoveLov 
  eLoveLoveLo  
    oveLove    
```
Earlier in the golfing process, before replacing constant expressions (change `M` to adjust size):
```
#define M 4
i = 3*M * 4*M, x, y;
main(t) {
  for (; i--; putchar(i % (4*M)? x : '\n')) {
    y = i / (4*M) - 2*M, x = i % (4*M) - 2*M,
    t = x*x + y*y, x = " Levo"[ (t < 4*M*M & y < 0 | t < abs(2*M*x)) * (1 + i % 4) ];
  }
}
```
I also felt compelled to do this. :P
```
#define F for
#define M main
 /*##     ####
####*/i  =192,x
,y;M(t) {F(;i--
;putchar(i %16?
y:10))y=i/16-8,
x=i%16-8,t=x*x+
y*y,y=" Levo"[(
 t<64&y<0|t<8*
  abs(x))*(i%
    4+1)];}
```
[Answer]
# **Ruby - 113 Characters**
```
l=->a,b=28,c=1{puts (("Love"*a).center(b))*c};l.call(2,14,2);l.call(3,14,2);[7,7,7,6,5,4,3,2,1].map{|x|l.call(x)}
```
**Output:**
```
1.9.3p448 :811 > l=->a,b=28,c=1{puts (("Love"*a).center(b))*c};l.call(2,14,2);l.call(3,14,2);[7,7,7,6,5,4,3,2,1].map{|x|l.call(x)}
   LoveLove      LoveLove   
 LoveLoveLove  LoveLoveLove 
LoveLoveLoveLoveLoveLoveLove
LoveLoveLoveLoveLoveLoveLove
LoveLoveLoveLoveLoveLoveLove
  LoveLoveLoveLoveLoveLove  
    LoveLoveLoveLoveLove    
      LoveLoveLoveLove      
        LoveLoveLove        
          LoveLove          
            Love            
```
To be more clear
![enter image description here](https://i.stack.imgur.com/oSxYd.png) 
[Answer]
**Perl - 159 characters**
Not massively golfed...
```
printf"%-14s%14s\n",$_,~~reverse for map{($.,$i,$c)=split',';($"x$i).($.x$c)}qw(L,5,3 o,3,8 v,1,11 e,0,13 L,1,13 o,3,11 v,5,9 e,7,7 L,8,6 o,10,4 v,12,2 e,13,1)
```
Here's the same with added whitespace for slightly better readability...
```
printf "%-14s%14s\n", $_, ~~reverse
   for map {
      ($.,$i,$c) = split',';
      ($"x$i).($.x$c)
   } qw(
      L,5,3
      o,3,8
      v,1,11
      e,0,13
      L,1,13
      o,3,11
      v,5,9
      e,7,7
      L,8,6
      o,10,4
      v,12,2
      e,13,1
   )
```
Output is...
```
     LLL            LLL     
   oooooooo      oooooooo   
 vvvvvvvvvvv    vvvvvvvvvvv 
eeeeeeeeeeeee  eeeeeeeeeeeee
 LLLLLLLLLLLLLLLLLLLLLLLLLL 
   oooooooooooooooooooooo   
     vvvvvvvvvvvvvvvvvv     
       eeeeeeeeeeeeee       
        LLLLLLLLLLLL        
          oooooooo          
            vvvv            
             ee             
```
The complete word "Love" is contained within (vertically) 22 times, plus numerous partials.
[Answer]
# APL, 36 chars / bytes\*
```
7 16⍴∊'  ' 'Love'[20400948744⊤⍨36/2]
```
Must be evaluated with `⎕IO←0` (the default varies by implementation)
\*APL can be written in a single-byte charset if needed (as long as you don't use any other Unicode character) so N chars = N bytes for the purpose of counting.
**Output:**
Contains exactly 20 "Love"
```
  Love    Love
LoveLoveLoveLove
LoveLoveLoveLove
LoveLoveLoveLove
  LoveLoveLove
    LoveLove
      Love
```
[Answer]
# [Extended BrainFuck](http://sylwester.no/ebf/) : 193 (counted without non essential whitespace)
```
    {h]<[<]<        [<}>>-->
-3>->-3>+9>+9>+>-7>+>->-5>+>->->
-3>+>+>>4->->6+>5+>>4+[-<4+>]<[-
<4+<5+<5+<5+4>&h++]>[-[-[<10+.[-]
    >-[[-]3<[-]]>[<4+3<[[->>
    +<<]<]]]>[[>]>[.>&h]<<++
        >]]>[<<4+[->8+<]
        >....[-]<<+>>]>]
```
Turns into:
# Brainfuck: 264 (counted without non essential whitespace)
```
    >>-->->>        >->->>>+
    >>>>>>>>        >+>>>>>>
>>>+>->>>>>>>+>->->>>>>+>->->->>>
+>+>>---->->++++++>+++++>>++++[-<
++++>]<[-<++++<+++++<+++++<+++++>
>>>]<[<]<[<++]>[-[-[<++++++++++.[
    -]>-[[-]<<<[-]]>[<++++<<<
    [[->>+<<]<]]]>[[>]>[.>]<[
        <]<[<]<<++>]]>[<<
        ++++[->++++++++<]
            >....[-]<
             <+>>]>]
```
You run it with any bf interpreter. Ubuntu has `bf` and `beef` and both works nicely.
```
bf heart.bf
```
The output (344 bytes):
```
    LOVELOVE        LOVELOVE
    LOVELOVE        LOVELOVE
LOVELOVELOVELOVELOVELOVELOVELOVE
LOVELOVELOVELOVELOVELOVELOVELOVE
LOVELOVELOVELOVELOVELOVELOVELOVE
LOVELOVELOVELOVELOVELOVELOVELOVE
    LOVELOVELOVELOVELOVELOVE
    LOVELOVELOVELOVELOVELOVE
        LOVELOVELOVELOVE
        LOVELOVELOVELOVE
            LOVELOVE
            LOVELOVE
```
Ungolfed EBF code:
```
>>--> ; mark
;; ##  ##@   
;;########@
;;########@
;; ######@
;;  ####@
;;   ##@
;; the block below is the art above 
;; where space is replaced with ->
;; # with > and @ with +>
->>>->->>>+>
>>>>>>>>+>
>>>>>>>>+>
->>>>>>>+>
->->>>>>+>
->->->>>+>+>
;; we store the string LOVE after a blank
>
~"LOVE"<[<]<
[<++] ;; add 2 to every cell until mark
;; Variables
:new
:zero
:in
:next
@zero
$in(
  -[ ; 1
     -[ ; 2
        $zero 10+.[-]
        $in-[#[-]$new<[-] @in] ; its second round lf
        $next[#$in++++$new<[[->>+<<]<]]@new     ; 2   
      ]
      >[[>]>[.>]<[<]<[<]<<++>   ]@new
  ]>[@next $zero 4+(-$in 8+) $in.... (-) $new+ $in]@zero
)
```
[Answer]
# C# 224
```
class P{static void Main(){for(int i=0,m=1;i<30;i++)for(int l=0;l<new[]{5,6,7,6,8,10,3,10,4,13,1,13,1,87,1,27,4,23,7,20,11,16,16,11,20,7,24,3,27,1}[i];l++,m++)System.Console.Write((i%2>0?"love"[m%4]:' ')+(m%29>0?"":"\n"));}}
```
Formatted:
```
class P
{
    static void Main()
    {
        for (int i = 0, m = 1; i < 30; i++)
            for (int l = 0; l < new[] { 5, 6, 7, 6, 8, 10, 3, 10, 4, 13, 1, 13, 1, 87, 1, 27, 4, 23, 7, 20, 11, 16, 16, 11, 20, 7, 24, 3, 27, 1 }[i]; l++, m++)
                System.Console.Write((i % 2 > 0 ? "love"[m % 4] : ' ') + (m % 29 > 0 ? "" : "\n"));
    }
}
```
Output:
```
     velove       elovel
   ovelovelov   velovelove
 lovelovelovel velovelovelov
lovelovelovelovelovelovelovel
ovelovelovelovelovelovelovelo
velovelovelovelovelovelovelov
 lovelovelovelovelovelovelov
   elovelovelovelovelovelo
    ovelovelovelovelovel
      lovelovelovelove
         lovelovelov
           elovelo
             vel
              l
```
[Answer]
**Perl - 97 characters**
This answer is based on @Wasi's 121 character Python solution.
```
$.=love;say"   $.    $.$/$. $.$. $.$/$.   $.   $.";say$"x$_,$.,$"x(9-$_*2),$.for 0..4;say$"x 6,$.
```
You need to run perl with the `-M5.010` option to enable 5.10-specific features. This [is apparently allowed](http://meta.codegolf.stackexchange.com/questions/273/on-interactive-answers-and-other-special-conditions/274#274).
Interesting features:
* I use the variable `$.` to store the word "love". This is because it can be immediately followed by another word if necessary. `$.for` is unambiguously tokenized as `$.` followed by `for`; `$_for` would not be tokenized as `$_` followed by `for` because `$_for` is itself a legal variable name.
* `$"`, a built-in variable representing that character that arrays will be joined with when interpolated into a string (and defaults to a single space character) is used instead of `" "` for savings of one character here and there.
* Perl's string interpolation beats the python `.replace` method significantly in code golfing.
* Perl's `for 0..4` similarly wins over `for i in range(5)`
[Answer]
# CJam - 33 bytes
```
19285703234336595Zb["Love"SS+N]f=
```
[Try it online](http://cjam.aditsu.net/#code=19285703234336595Zb%5B%22Love%22SS%2BN%5Df%3D)
**Output:**
```
  Love    Love
LoveLoveLoveLove
LoveLoveLoveLove
LoveLoveLoveLove
  LoveLoveLove
    LoveLove
      Love
```
**Explanation:**
```
19285703234336595    number that contains the pattern as base-3 digits
Zb                   converts to base 3 (Z=3)
["Love"SS+N]         creates an array containing "Love", "  " and a newline
f=                   replaces the base-3 digits with the corresponding strings
                     (0 -> "Love", 1 -> "  ", 2 -> newline)
```
[Answer]
# Python, 334 Bytes
```
x = "love"
print("\t  love\t      love")
print("\t"+str(x*2)+"    "+str(x*2))
print("      "+str(x*6))
print(str(" "*5)+str(x*6)+"lo")
print(str(" "*5)+str(x*6)+"lo")
print("      "+str(x*6))
print("\t"+str(x*5))
print("\t"+str(" "*2)+str(x*4)+"l")
print("\t"+str(" "*4)+str(x*3)+"l")
print("\t"+str(" "*7)+str(x*2))
print("\t"+str(" "*10)+"v")
```
output:
![enter image description here](https://i.stack.imgur.com/eaOIY.png)
[Answer]
**Bash, 170 bytes**
totally a copy of programFOX's :)
```
echo '\x1f\x8b\x08\x00\x95\x10\xe0R\x02\xffSPP\xf0\xc9/KU\x80\x03\x10\x8f\x0bB\xa1c.l\x82dJ\xe0\xb0\x01\xe6\x02\x0cATa.T\xf7\x02\x00\xd9\x91g\x05\xc5\x00\x00\x00'|gunzip
```
[Answer]
print('\n'.join([''.join([(' *Your text here*'[(x-y) % len(' *Enter same text here*')] if ((x*0.05)\*\*2+(y*0.1)\*\*2-1)\*\*3-(x\*0.05)**2*(y*0.1)\*\*3 <= 0 else ' ') for x in range(-30, 30)]) for y in range(30, -30, -1)]))![enter image description here](https://i.stack.imgur.com/clB4F.jpg)
]