samualtnorman / hackmud-script-manager

Script manager for game hackmud, with minification, TypeScript support, and player script type definition generation.

Home Page:https://www.npmjs.com/package/hackmud-script-manager

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

not using quine cheated version in weird case

samualtnorman opened this issue · comments

export default args => args.foo(`aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa`)

quine cheats to 98 chars

function(a){return a.foo("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")}

but

export default args => args.foo(`aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa`)

quine cheats to 77 chars

function(o){
//	["foo","aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"]	
let[$,n]=JSON.parse(#fs.scripts.quine().split`	`[1])
return o[$](n)}

despite the source being longer

This happens because the quined/non-quined selection comes before postprocessing. At this point the scripts are

function _0a3zb0ymxzr_SCRIPT_(a){return a.foo("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")}

and

function _0m9hbj02g1l_SCRIPT_($){
//	["foo","aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"]	
let[l,t]=JSON.parse($0m9hbj02g1l$SUBSCRIPT$scripts$quine$().split`	`[1])
return $[l](t)}

ah, you're right. thank you for spotting this