Make an application that displays text at random that conforms to the specified regex

后端 未结 11 737
情书的邮戳
情书的邮戳 2021-01-30 05:39

OK, so in the spirit of Code-Golf, I\'m trying out something new here: Code-Bowling.

In golf, you try to get the lowest score (smallest application, mos

11条回答
  •  遇见更好的自我
    2021-01-30 06:07

    This JavaScript piece comes with a text generator:

    function cth(i) {
        return i > 16 ? cth(i >> 4) + cth(i & 15) : "" + (i < 10 ? i : String.fromCharCode(55 + i))
    }
    
    function nc(s) {
        return c += s
    }
    var w = [],
        s = [],
        c = 0,
        t = new Date().getTime()
        s[0] = cth(nc(71)) s[1] = cth(nc(40)) s[2] = cth(nc(-11))
        s.splice(1, 0, s.slice(1, 2)[0])
        w.push(unescape("%" + s.join("%")))
        s[0] = cth(nc(-23)) s[2] = cth(nc(37)) s[3] = cth(nc(-4)) s[4] = cth(nc(-5)) s[5] = cth(nc(-2))
        s.splice(5, 0, s.slice(3, 4)[0])
        w.push(unescape("%" + s.join("%")))
        s.splice(0, 3)
        s.unshift(cth(nc(-2))) s.unshift(s[s.length - 1].replace(/(.)(.)/, "$2$1")) s.unshift(cth(nc(-32)))
        w.push(unescape("%" + s.join("%")))
        s = w[0].split(/[^aeiou]/i) s[0] = "After"
        s = s.join("n")
        w.push(s)
        s = String(69676874).replace(/(..)/g, "%$1")
        w.push("N" + unescape(s))
        t /= c
        alert(w[0] + " " + w[1 + (t & 3)])
    

    Yes, this isn't a long code, but it's still pointless to have.

提交回复
热议问题