projects and collaborations

text-based

diastic machine

//diastic machine - Jackson Mac Low function diastic(seed, words){ var phrase = ""; var currentWord = 0; for (var i = 0; i < seed.length; i++) { var c = seed.charAt(i); //javascript string object for (var j = 0; j < words.length; j++){ if (words[j].charAt(i) == c){ phrase += words[j]; phrase += " "; currentWord = j + 1; break; } } } return phrase; } var srctxt; var words; function preload(){ srctxt = loadStrings('bible.txt'); } function setup(){ noCanvas(); srctxt = join(srctxt, ' '); words = splitTokens(srctxt, ' ,!.?'); var seed = select("#seed"); var submit = select("#submit"); submit.mousePressed(function(){ var phrase = diastic(seed.value(), words); createP(phrase); }); }