# Loves me, Loves me not

This simple kids' game is old, but still popular. Since we are living in 21st century now, let's digitize it!

# Specification

Program must take no input, unless you are using a language that can't generate random seed - in that case you are allowed to take the seed as an input. Your task is to write a program that will output randomly a total of 3 to 20 lines inclusive: "Loves me..." and "Loves me not..." in turns, as in the game (and one additional line; keep reading).

However, there are some restrictions. Each line should be followed by newline. The first line must be "Loves me...". The last line (either "Loves me" or "Loves me not") should end with exclamation mark or a single dot, respectively. After the last line, you need to output either a heart( <3 ) or a broken heart ( </3 ) in the new line, depending whether "Loves me!" or "Loves me not." was the last sentence.

Trailing whitespace are allowed.

# Example Output

Output:

Loves me...
Loves me not...
Loves me...
Loves me not...
Loves me!
<3

Another output:

Loves me...
Loves me not...
Loves me...
Loves me not.
</3

## This is the code-golf, so the shortest entry wins!

Also, my first challenge :) Good luck!

• Are there any restrictions on the distribution of the number of lines, i.e., should it be uniformly random, or is it enough that all lengths between 3 and 20 have a positive probability? – Zgarb Sep 15 '15 at 15:13
• I didn't think about this, but I'd say that any distribution is fine - so they don't have to be uniformly random. – MatthewRock Sep 15 '15 at 15:14
• Is it 3 to 20 ([3, 20)) or 3 up to including 20 ([3, 20])? – orlp Sep 15 '15 at 15:15
• @MatthewRock What if the language we want to use can't seed a random number on their own? Can the user supply a random seed? – mınxomaτ Sep 15 '15 at 15:35
• @minxomat Whatever, it's just a game. Go on, changed the rules. – MatthewRock Sep 15 '15 at 18:25

# ß, 138 bytes

Works (with valid output). More a solution than the solution, could be golfed further:

R=ß!G3,20,1)µL='Loves me'µD='...@LF@'µ€L&D)°/X=0°(R-1µ€L)°\mod(X,2)=0°{€' not')µ€D)°)€L)°\mod(R,2)°{µ€'!'&@LF&'<3')°]€' not.'&@LF&'</3')°}

Sample:

\$ sharps "R=ß!G3,20,1)µL='Loves me'µD='...@LF@'µ€L&D)°/X=0°(R-1µ€L)°\mod(X,2)=0°{€' not')µ€D)°)€L)°\mod(R,2)°{µ€'!'&@LF&'<3')°]€' not.'&@LF&'</3')°}"
Loves me...
Loves me not...
Loves me...
Loves me not...
Loves me...
Loves me not...
Loves me!
<3

# Hassium, 161 165 bytes

This answer is non-competing, since it requires a version of the interpreter that is newer than this challenge.

func main()println(range(-1,t=new Random().next(3,21)).select(x=>"Loves me"+(x%2==0?" not":"")+(x==t-2?(x%2==0?".":"!"):"...")).join("\n"),"\n",t%2==0?"</3":"<3");

Unleashing the power of Hassium.

### Ungolfed version

func main()
{
t = new Random().next(3,21); # initialize the love number
loveNumber = range(-1, t); # creates an array like this Array { -1 0 1 2 ... ... up to n } where n is a random number between 3 and 21 }
loves = loveNumber.select(x => # iterates through the array
{
ret = "Loves me";
if (x % 2 == 0) # check if x is even
{
ret += " not"; # add ' not' to the result
}
ret += (x == t ? (x % 2 == 0 ? "." : "!") : "...");
return ret;
}).join("\n"); # join the result with Unix newlines (\n)
println(loves); # print it
println(t%2==0?"</3":"<3");
}
• On this site we typically only allow languages and features created prior to the posting of the challenge. In this case, it appears you added the range function to Hassium after the challenge was posted. – Alex A. Sep 16 '15 at 18:31
• Alex A., the range has always been in Hassium, I just forgot to put in the correct file so it wasn't usable. – zdimension Sep 16 '15 at 18:40
• 1. If this particular code did not work with the interpreter that was available at the time this challenge was posted, your answer is technically invalid and should contain a disclaimer stating that it's non-competing. 2. The random number generator seems to be extremely biased. I ran this 500 times and only got two </3. – Dennis Sep 16 '15 at 19:51
• @Dennis however, if you got various lengths, I would say it's fine - I specified that any distribution is allowed - so although 2 in 500 isn't much, it's still acceptable, by the rules. – MatthewRock Sep 17 '15 at 9:39

# 1. Python 3, 179171 167 bytes

from random import*;n=randint(3,20);s=""
for i in range(n):
b=i%2==0;s+="Loves me"+(""if b else" not")
if i<n-1:s+="...\n"
s+="!\n<3"if b else".\n</3";print(s)

# Japt, 77 76 bytes

Mq17 +3 o £Lov ´{Y%2?" not":""}...Ã
U· +
Lov ´+(UÊ%2?" not.
</3":"!
<3

Probably can be golfed a lot further.

Try it Online!