R, 27 2325 bytes
2-1+!1-length(readLines())
Inspired by rturnbull's answer to Third time the charm, but the simplicity of the check makes it shorter.
Try it doubledDoubled | Tripled | Quadrupled
Why this works:
readLines()
will actually reads the source file itself rather than stdin
. Hence, adding lines just increments the tripledlength()
of the vector returned by readLines()
. Therefore, we compute !(1-length())
to obtain 1
whenever length()==1
and quadrupled0
when length()!=1
, adding one to have the desired effect.