4 deleted 490 characters in body
source | link

Edit: I havefixed the issue and ignore my previous edits where I started I found a major mistakean error, one input fails. Will update ASAPI was sanitizing the dictionary incorrectly. Funny enough, this didn't change the code length

var q=new XMLHttpRequest();q.open("get","words.txt");q.onreadystatechange=()=>{if(q.readyState!=4)return;(z=>q.responseText.toLowerCase().split("\n").filter(w=>w.split("").reduce((j,l)=>j&&z.indexOf(l)<0,true)).map((o,p)=>[o.toLowerCase(),p]).sort((a,b)=>{if(a[0].length == b[0].length){return a[1]-b[1]}return b[0].length-a[0].length;})[0][0].split("").forEach(e=>e=e.replace(/[^a-z]/,"")&&console.log(("ABCEFGCDEFGADEFBCDEGADEFGAEFGACDEFCEFGEFBCDEACEFGDEFACEABCEFABCDEFABEFGABCFGABEFACDFGDEFGBCDEFBCDFBDFBCEFGBCDFGABDG".split("").reduce((f,v,i)=>{if(i==114){f[0].unshift(v);f[1].push(f[0])}else if(v<f[0][0]){f[1].push(f[0]);f[0]=[v]}else{f[0].unshift(v)}return f},[[0],[]])[1][e.charCodeAt()-97]).reduce((f,v)=>f.replace(RegExp(`${v}`,"g"),"#"),"-AAA-\nF---B\nF---B\n-GGG-\nE---C\nE---C\n-DDD-").replace(/[^#\n]/g,"-"))))(prompt())};q.send()
const outputString = "ABCEFGCDEFGADEFBCDEGADEFGAEFGACDEFCEFGEFBCDEACEFGDEFACEABCEFABCDEFABEFGABCFGABEFACDFGDEFGBCDEFBCDFBDFBCEFGBCDFGABDG";
const formatString = "-AAA-\nF---B\nF---B\n-GGG-\nE---C\nE---C\n-DDD-";

var q=new XMLHttpRequest();
q.open("get","words.txt");
q.onreadystatechange=()=>{
    if(q.readyState!=4)return;
    (z=>q.responseText.toLowerCase().split("\n").filter(
        w=>w.split("").reduce((j,l)=>j&&z.indexOf(l)<0,true)
    ).map(
        (o,p)=>[o.toLowerCase(),p]
    ).sort(
        (a,b)=>{
            if(a[0].length == b[0].length){
                return a[1]-b[1]
            }
            return b[0].length-a[0].length;
        }
    )[0][0].split("").forEach(
        e=>e=e.replace(/[^a-z]/,"")&&console.log(
            (outputString.split("").reduce(
                (f,v,i)=>{
                    if(i==114){
                        f[0].unshift(v);f[1].push(f[0])
                    }else if(v<f[0][0]){
                        f[1].push(f[0]);f[0]=[v]
                    }else{
                        f[0].unshift(v)
                    }return f
                },[[0],[]]
            )[1][e.charCodeAt()-97]).reduce(
                (f,v)=>f.replace(RegExp(`${v}`,"g"),"#"),formatString
            ).replace(/[^#\n]/g,"-"))
    ))(prompt())
};
q.send()

Edit: I have found a major mistake, one input fails. Will update ASAP.

var q=new XMLHttpRequest();q.open("get","words.txt");q.onreadystatechange=()=>{if(q.readyState!=4)return;(z=>q.responseText.split("\n").filter(w=>w.split("").reduce((j,l)=>j&&z.indexOf(l)<0,true)).map((o,p)=>[o.toLowerCase(),p]).sort((a,b)=>{if(a[0].length == b[0].length){return a[1]-b[1]}return b[0].length-a[0].length;})[0][0].split("").forEach(e=>e=e.replace(/[^a-z]/,"")&&console.log(("ABCEFGCDEFGADEFBCDEGADEFGAEFGACDEFCEFGEFBCDEACEFGDEFACEABCEFABCDEFABEFGABCFGABEFACDFGDEFGBCDEFBCDFBDFBCEFGBCDFGABDG".split("").reduce((f,v,i)=>{if(i==114){f[0].unshift(v);f[1].push(f[0])}else if(v<f[0][0]){f[1].push(f[0]);f[0]=[v]}else{f[0].unshift(v)}return f},[[0],[]])[1][e.charCodeAt()-97]).reduce((f,v)=>f.replace(RegExp(`${v}`,"g"),"#"),"-AAA-\nF---B\nF---B\n-GGG-\nE---C\nE---C\n-DDD-").replace(/[^#\n]/g,"-"))))(prompt())};q.send()
const outputString = "ABCEFGCDEFGADEFBCDEGADEFGAEFGACDEFCEFGEFBCDEACEFGDEFACEABCEFABCDEFABEFGABCFGABEFACDFGDEFGBCDEFBCDFBDFBCEFGBCDFGABDG";
const formatString = "-AAA-\nF---B\nF---B\n-GGG-\nE---C\nE---C\n-DDD-";

var q=new XMLHttpRequest();
q.open("get","words.txt");
q.onreadystatechange=()=>{
    if(q.readyState!=4)return;
    (z=>q.responseText.split("\n").filter(
        w=>w.split("").reduce((j,l)=>j&&z.indexOf(l)<0,true)
    ).map(
        (o,p)=>[o.toLowerCase(),p]
    ).sort(
        (a,b)=>{
            if(a[0].length == b[0].length){
                return a[1]-b[1]
            }
            return b[0].length-a[0].length;
        }
    )[0][0].split("").forEach(
        e=>e=e.replace(/[^a-z]/,"")&&console.log(
            (outputString.split("").reduce(
                (f,v,i)=>{
                    if(i==114){
                        f[0].unshift(v);f[1].push(f[0])
                    }else if(v<f[0][0]){
                        f[1].push(f[0]);f[0]=[v]
                    }else{
                        f[0].unshift(v)
                    }return f
                },[[0],[]]
            )[1][e.charCodeAt()-97]).reduce(
                (f,v)=>f.replace(RegExp(`${v}`,"g"),"#"),formatString
            ).replace(/[^#\n]/g,"-"))
    ))(prompt())
};
q.send()

Edit: I fixed the issue and ignore my previous edits where I started I found an error, I was sanitizing the dictionary incorrectly. Funny enough, this didn't change the code length

var q=new XMLHttpRequest();q.open("get","words.txt");q.onreadystatechange=()=>{if(q.readyState!=4)return;(z=>q.responseText.toLowerCase().split("\n").filter(w=>w.split("").reduce((j,l)=>j&&z.indexOf(l)<0,true)).map((o,p)=>[o,p]).sort((a,b)=>{if(a[0].length == b[0].length){return a[1]-b[1]}return b[0].length-a[0].length;})[0][0].split("").forEach(e=>e=e.replace(/[^a-z]/,"")&&console.log(("ABCEFGCDEFGADEFBCDEGADEFGAEFGACDEFCEFGEFBCDEACEFGDEFACEABCEFABCDEFABEFGABCFGABEFACDFGDEFGBCDEFBCDFBDFBCEFGBCDFGABDG".split("").reduce((f,v,i)=>{if(i==114){f[0].unshift(v);f[1].push(f[0])}else if(v<f[0][0]){f[1].push(f[0]);f[0]=[v]}else{f[0].unshift(v)}return f},[[0],[]])[1][e.charCodeAt()-97]).reduce((f,v)=>f.replace(RegExp(`${v}`,"g"),"#"),"-AAA-\nF---B\nF---B\n-GGG-\nE---C\nE---C\n-DDD-").replace(/[^#\n]/g,"-"))))(prompt())};q.send()
const outputString = "ABCEFGCDEFGADEFBCDEGADEFGAEFGACDEFCEFGEFBCDEACEFGDEFACEABCEFABCDEFABEFGABCFGABEFACDFGDEFGBCDEFBCDFBDFBCEFGBCDFGABDG";
const formatString = "-AAA-\nF---B\nF---B\n-GGG-\nE---C\nE---C\n-DDD-";

var q=new XMLHttpRequest();
q.open("get","words.txt");
q.onreadystatechange=()=>{
    if(q.readyState!=4)return;
    (z=>q.responseText.toLowerCase().split("\n").filter(
        w=>w.split("").reduce((j,l)=>j&&z.indexOf(l)<0,true)
    ).map(
        (o,p)=>[o,p]
    ).sort(
        (a,b)=>{
            if(a[0].length == b[0].length){
                return a[1]-b[1]
            }
            return b[0].length-a[0].length;
        }
    )[0][0].split("").forEach(
        e=>e=e.replace(/[^a-z]/,"")&&console.log(
            (outputString.split("").reduce(
                (f,v,i)=>{
                    if(i==114){
                        f[0].unshift(v);f[1].push(f[0])
                    }else if(v<f[0][0]){
                        f[1].push(f[0]);f[0]=[v]
                    }else{
                        f[0].unshift(v)
                    }return f
                },[[0],[]]
            )[1][e.charCodeAt()-97]).reduce(
                (f,v)=>f.replace(RegExp(`${v}`,"g"),"#"),formatString
            ).replace(/[^#\n]/g,"-"))
    ))(prompt())
};
q.send()
3 deleted 490 characters in body
source | link

First, a disclaimer to others, toosty-wootsy is not the real firstEdit: I have found a major mistake, one input for entering "abcdefghijklm"fails. Will update ASAP.! toosty-wootsy is on line 411,404 while Rostov-on-Don is on line 343,822! They are both the same length, but Roston-on-Dov contains more hypens so perhaps your program failed to account for this or failed to account for the casing (you didn't specify what to do with casing unless I missed something). To anyone else, I recommend sanitizing your dictionary input with a toLowerCase()or equivalent and only using lower case letters in your input.

First, a disclaimer to others, toosty-wootsy is not the real first input for entering "abcdefghijklm"! toosty-wootsy is on line 411,404 while Rostov-on-Don is on line 343,822! They are both the same length, but Roston-on-Dov contains more hypens so perhaps your program failed to account for this or failed to account for the casing (you didn't specify what to do with casing unless I missed something). To anyone else, I recommend sanitizing your dictionary input with a toLowerCase()or equivalent and only using lower case letters in your input.

Edit: I have found a major mistake, one input fails. Will update ASAP.

2 added 152 characters in body
source | link

First, a disclaimer to others, toosty-wootsy is not the real first input for entering "abcdefghijklm"! toosty-wootsy is on line 411,404 while Rostov-on-Don is on line 343,822! They are both the same length, but Roston-on-Dov contains more hypens so perhaps your program failed to account for this or failed to account for the casing (you didn't specify what to do with casing unless I missed something). To anyone else, I recommend sanitizing your dictionary input with a toLowerCase()or equivalent and only using lower case letters in your input.

It skips functions entirely and recalculates variables for any place they are iterated, so it's very inefficient, but it should never take more than a few seconds at worst case to run. Input is given through andan html prompt. The script assumes it is part of a window with relative file access and outputs to the console.

I haven't double checked because I got so, um, involved in this code, but I think that it might be smaller to store these modified display codes in a flat array than to break them into an array based on one string. But that wasn't as fun.

I don't expect to win, but I am curious if anyone else can beat this in web-oriented JavaScript using an XMLHttpRequest and prompt() for input.

First, a disclaimer to others, toosty-wootsy is not the real first input for entering "abcdefghijklm"! toosty-wootsy is on line 411,404 while Rostov-on-Don is on line 343,822! They are both the same length, but Roston-on-Dov contains more hypens so perhaps your program failed to account for this or failed to account for the casing (you didn't specify what to do with casing unless I missed something). To anyone else, I recommend sanitizing your dictionary input with a toLowerCaseor equivalent and only using lower case letters in your input.

It skips functions entirely and recalculates variables for any place they are iterated, so it's very inefficient, but it should never take more than a few seconds at worst case to run. Input is given through and html prompt. The script assumes it is part of a window with relative file access and outputs to the console.

I haven't double checked because I got so, um, involved in this code, but I think that it might be smaller to store these modified display codes in a flat array than to break them into an array based on one string. But that wasn't as fun.

First, a disclaimer to others, toosty-wootsy is not the real first input for entering "abcdefghijklm"! toosty-wootsy is on line 411,404 while Rostov-on-Don is on line 343,822! They are both the same length, but Roston-on-Dov contains more hypens so perhaps your program failed to account for this or failed to account for the casing (you didn't specify what to do with casing unless I missed something). To anyone else, I recommend sanitizing your dictionary input with a toLowerCase()or equivalent and only using lower case letters in your input.

It skips functions entirely and recalculates variables for any place they are iterated, so it's very inefficient, but it should never take more than a few seconds at worst case to run. Input is given through an html prompt. The script assumes it is part of a window with relative file access and outputs to the console.

I haven't double checked because I got so, um, involved in this code, but I think that it might be smaller to store these modified display codes in a flat array than to break them into an array based on one string. But that wasn't as fun.

I don't expect to win, but I am curious if anyone else can beat this in web-oriented JavaScript using an XMLHttpRequest and prompt() for input.

1
source | link