You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fs=require('fs');fs.readFile('t','utf8',(e,t)=>{fs.readFile('i',(e,i)=>{a=[];e=t.match(/(\w+)/gm);u=w=0;for(x of i.values()){if(x>31){w=w+x}else{a.push(w);w=0}}for(;u<a.length;u++){for(k=0;k<e.length;k++){g=y=0;for(;y<e[k].length;y++){g=g+e[k][y].charCodeAt(0)}if(a[u]==g){a[u]=e[k];break}}}console.log(a.join(" "))})})
To run, this code needs two files in the same directory - any plaintext file named "t" and any other data format named "i". (I'd suggest a big file "t" (the more words the better), a small file "i" (it gets slow at about 1.5 mb, but you can always wait it out), and I think file "i" is interesting as an image, personally, but anything'll do).
Ladder is written in node.js.
This was an attempt at a nanonanogenmo, but at 321 bytes I overshot the character limit by 65. I probably could go back through in something a bit more terse, but I'm! not! feeling it! :)
The program reads in file 'i' as a data buffer, then goes through and extracts byte values, adding them into larger numbers (which are delineated by the ascii control characters, 0-31). It then does the same to the individual words in file "t", separated on word boundaries. Finally, it attempts to match the two arrays of values, showing you the content of your file "i" as a poem made of words from "t".
Ladder is a little exercise in exposing the mushy insides of file encoding (and perhaps imaging some alternative encoding formats that lean into their own forms of poeticism). Try running different types of files through it, or files exported from different programs!
Here is a longer version that outputs to a .txt file and adds a little title, clocking in at an extravagant 453 bytes:
fs=require('fs');fs.readFile('t','utf8',(e,t)=>{fs.readFile('i',(e,i)=>{a=[];e=t.match(/(\w+)/gm);u=w=0;for(x of i.values()){if(x>31){w=w+x}else{a.push(w);w=0}} for(;u<a.length;u++){for(k=0;k<e.length;k++){g=y=0;for(;y<e[k].length;y++){g=g+e[k][y].charCodeAt(0)}if(a[u]==g){a[u]=e[k];break}}}fs.writeFile('o.txt',"running ladder on "+t.split(".")[0]+"\n\n on a file with a buffer length of "+i.length+"\n\n\n\n\n\n\n\n\n\n"+a.join(" "),(e)=>{});});});
Ladder
fs=require('fs');fs.readFile('t','utf8',(e,t)=>{fs.readFile('i',(e,i)=>{a=[];e=t.match(/(\w+)/gm);u=w=0;for(x of i.values()){if(x>31){w=w+x}else{a.push(w);w=0}}for(;u<a.length;u++){for(k=0;k<e.length;k++){g=y=0;for(;y<e[k].length;y++){g=g+e[k][y].charCodeAt(0)}if(a[u]==g){a[u]=e[k];break}}}console.log(a.join(" "))})})
To run, this code needs two files in the same directory - any plaintext file named "t" and any other data format named "i". (I'd suggest a big file "t" (the more words the better), a small file "i" (it gets slow at about 1.5 mb, but you can always wait it out), and I think file "i" is interesting as an image, personally, but anything'll do).
Ladder is written in node.js.
This was an attempt at a nanonanogenmo, but at 321 bytes I overshot the character limit by 65. I probably could go back through in something a bit more terse, but I'm! not! feeling it! :)
The program reads in file 'i' as a data buffer, then goes through and extracts byte values, adding them into larger numbers (which are delineated by the ascii control characters, 0-31). It then does the same to the individual words in file "t", separated on word boundaries. Finally, it attempts to match the two arrays of values, showing you the content of your file "i" as a poem made of words from "t".
Ladder is a little exercise in exposing the mushy insides of file encoding (and perhaps imaging some alternative encoding formats that lean into their own forms of poeticism). Try running different types of files through it, or files exported from different programs!
Here is a longer version that outputs to a .txt file and adds a little title, clocking in at an extravagant 453 bytes:
fs=require('fs');fs.readFile('t','utf8',(e,t)=>{fs.readFile('i',(e,i)=>{a=[];e=t.match(/(\w+)/gm);u=w=0;for(x of i.values()){if(x>31){w=w+x}else{a.push(w);w=0}} for(;u<a.length;u++){for(k=0;k<e.length;k++){g=y=0;for(;y<e[k].length;y++){g=g+e[k][y].charCodeAt(0)}if(a[u]==g){a[u]=e[k];break}}}fs.writeFile('o.txt',"running ladder on "+t.split(".")[0]+"\n\n on a file with a buffer length of "+i.length+"\n\n\n\n\n\n\n\n\n\n"+a.join(" "),(e)=>{});});});
Sample output: o.txt
Which is running this Project Gutenberg book
On this image from the Miracle of the Sun.
The text was updated successfully, but these errors were encountered: