JavaScript + Python 2 + Japt, 3 languages, 132 bytes, score ~= 0.205
A="`i96d)p2`i96d)p2";1//2;A=1
S="S=%s;console.log(S,uneval(S))";A//2;S="S=%r;print S%%S";"""
console.log(S,uneval(S))//""";print S%S
This prints
S="S=%s;console.log(S,uneval(S))";console.log(S,uneval(S))
in JavaScript (only in Firefox),
S="S=%r;printS='S=%r;print S%%S";printS%%S';print S%S
in Python 2, and
`i96d)p2`i96d)p2
in Japt. (Test it online!)
JavaScript
This is what JavaScript sees:
A="`i96d)p2`i96d)p2";1
S="S=%s;console.log(S,uneval(S))";A
console.log(S,uneval(S))
The first line is a no-op because A
is not used in any way. The second line sets S
to the string S=%s;console.log(S,uneval(S))
, and the third prints it after replacing the %s
with the uneval
ed representation of S
(just S
wrapped in quotes). The result is a quine in JavaScript.
Python
This is basically what Python sees:
A="`i96d)p2`i96d)p2";1//2;A=1
S="S=%s;console.log(S,uneval(S))";A//2;S="S=%r;print S%%S"
print S%S
The first line is pretty much a no-op; the only important part is the A=1
at the end. This turns A
into a number so that the integer division A//2
on the second line doesn't throw an error.
The second line is mostly the same way, except it sets S
to the string S=%r;print S%%S
. The third line prints S
after replacing the %r
with the raw representation of S
(just S
wrapped in quotessingle-quotes). The result is a quine in Python 2.
Japt
This is the JavaScript code the Japt interpreter sees:
A="`i96d)p2`i96d)p2";1//2;A=1
S="S=%s;console.log(S,uneval(S))";A//2;S="S=%r;print S%%S";"","\nconsole.log(S,uneval(S))//","";.p("r".i("n".t(),S%S))
As you can see, it's mostly the same as the JavaScript answer, with one main exception: the last two lines are combined. As a result, this is what the interpreter actually sees:
A="`i96d)p2`i96d)p2";1
S="S=%s;console.log(S,uneval(S))";A
The first line sets A
to the Japt quine, and the second sets S
to part of the JS quine. In Japt however, only the last expression is sent to output; this is A
, so the output is `i96d)p2`i96d)p2
.