probably uncopyrightable but cc0/unlicense/bsd0/wtfpl just in case
ilo lili pi weka pu tan jan pona Ke Tami https://jsbin.com/kewekiqewa/ (yes i could've written it myself but i didn't feel like it tbhtbhtbh)
probably uncopyrightable but cc0/unlicense/bsd0/wtfpl just in case
ilo lili pi weka pu tan jan pona Ke Tami https://jsbin.com/kewekiqewa/ (yes i could've written it myself but i didn't feel like it tbhtbhtbh)
<h1>ilo pi nimi sin</h1> | |
<p id="nimi"></p> | |
<table><tbody> | |
<tr> | |
<td><label for="open">pini lili pi mute mu nimi</label></td> | |
<td><input type="number" id="open" name="open" min="1" size="3" value="2" class="poki-nanpa"></td> | |
</tr><tr> | |
<td><label for="pini">pini suli pi mute mu nimi</label></td> | |
<td><input type="number" id="pini" name="pini" size="3" min="1" value="3" class="poki-nanpa"></td> | |
</tr><tr> | |
<td><label for="mute">mute nimi</label></td> | |
<td><input type="number" id="mute" name="mute" size="3" min="1" value="10" class="poki-nanpa"></td> | |
</tr><tr> | |
<td><label for="kenN">ken pi kalama N pini</label></td> | |
<td><input type="number" id="kenN" name="kenN" size="3" min="0" value="10" class="poki-nanpa"></td> | |
</tr> | |
</tbody></table> | |
<br> | |
<button onclick="panaENimi()">o pana sin</button> | |
<br> | |
<label><input type="checkbox" onclick="panaEPokiPu()" checked="true">o weka e nimi pu</label> | |
<div id="pokiPu"><br>sina ken ante e poki ni pi nimi pu:<br><textarea cols="50" rows="11" id="nimiPu">a,akesi,ala,alasa,ali,anpa,ante,anu,awen,e,en,esun,ijo,ike,ilo,insa,jaki,jan,jelo,jo,kala,kalama,kama,kasi,ken,kepeken,kili,kiwen,ko,kon,kule,kulupu,kute,la,lape,laso,lawa,len,lete,li,lili,linja,lipu,loje,lon,luka,oko,lupa,ma,mama,mani,meli,mi,mije,moku,moli,monsi,mu,mun,musi,mute,namako,nanpa,nasa,nasin,nena,ni,nimi,noka,o,oko,olin,ona,open,pakala,pali,palisa,pan,pana,pi,pilin,pimeja,pini,pipi,poka,poki,pona,pu,sama,seli,selo,seme,sewi,sijelo,sike,namako,sina,sinpin,sitelen,sona,soweli,suli,suno,supa,suwi,tan,taso,tawa,telo,tenpo,toki,tomo,tu,unpa,uta,utala,walo,wan,waso,wawa,weka,wile</textarea></div> |
// probably uncopyrightable but cc0/unlicense/bsd0/wtfpl just in case | |
// ilo lili pi weka pu tan jan pona Ke Tami https://jsbin.com/kewekiqewa/ (yes i could've written it myself but i didn't feel like it tbhtbhtbh) | |
let pokiPiKalamaLili = ["j", "k", "l", "m", "n", "p", "s", "t", "w"]; | |
let pokiPiKalamaAwen = ["a", "e", "i", "o", "u"]; | |
let kalamaN = "n"; | |
let kalamaM = "m"; // why did i make this a variable, (also turns out pu doesn't forbid `nm` but doesn't use it either, "Myanmar" → `Mijama`) | |
let pokiPiMuIke = ["ji", "ti", "wo", "wu"]; | |
let wekaLon = true; | |
let nimiPu = []; | |
let pokiMu = []; | |
for (var i = 0; i < pokiPiKalamaLili.length; i++) { | |
for (var j = 0; j < pokiPiKalamaAwen.length; j++) { | |
mu = pokiPiKalamaLili[i] + pokiPiKalamaAwen[j]; | |
if (!(pokiPiMuIke.includes(mu))) { | |
pokiMu.push(mu) | |
}; | |
} | |
} | |
let pokiPiMuNanpaWan = pokiMu.concat(pokiPiKalamaAwen); | |
function panaEPokiPu() { | |
if (wekaLon) { | |
wekaLon = false; | |
document.getElementById("pokiPu").style.display = "none"; | |
} else { | |
wekaLon = true; | |
document.getElementById("pokiPu").style.display = "block"; | |
} | |
} | |
function panaENimi() { | |
let open = parseInt(document.getElementById("open").value); | |
let pini = parseInt(document.getElementById("pini").value); | |
let mute = parseInt(document.getElementById("mute").value); | |
let kenN = parseInt(document.getElementById("kenN").value) / 100; | |
if (wekaLon) { | |
nimiPu = document.getElementById("nimiPu").value.split(" ").join("").split(","); | |
} else { | |
nimiPu = []; | |
} | |
nimiPu.push(""); | |
let pokiNimi = []; | |
for (var i = 0; i < mute; i++) { | |
let nimi = ""; | |
while (nimiPu.includes(nimi)) { | |
nimi = ""; | |
muteMu = Math.floor(Math.random() * (pini - open + 1) + open); | |
for (var j = 0; j < muteMu; j++) { | |
if (j == 0) { | |
nimi = nimi.concat(pokiPiMuNanpaWan[Math.floor(Math.random() * pokiPiMuNanpaWan.length)]); | |
} else { | |
muSin = pokiMu[Math.floor(Math.random() * pokiMu.length)]; | |
if (nimi[nimi.length - 1] == kalamaN && (muSin[0] == kalamaN || muSin[0] == kalamaM)) { // used to be "if nimi[nimi.length - 1] == muSin[0]" but i forgot that `nm` is illegal | |
nimi = nimi.concat(muSin.substring(1)); | |
} else { | |
nimi = nimi.concat(muSin); | |
} | |
} | |
if (Math.random() < kenN) { | |
nimi = nimi.concat(kalamaN); | |
} | |
} | |
} | |
pokiNimi.push(nimi) | |
} | |
document.getElementById("nimi").innerHTML = pokiNimi.join("<br>"); | |
} | |
panaENimi(); |
body { | |
background-color: #36393f; | |
color: #fff; | |
font-family: Comic Sans MS, sans-serif; | |
text-align: center; | |
font-size: 120%; | |
} | |
table { | |
text-align: right; | |
margin: 0 auto; | |
} | |
input, button, textarea { | |
margin: 0 3px; | |
background-color: #23272a; | |
color: #fff; | |
border: 3px #23272a solid; | |
font-size: inherit; | |
} | |
.poki-nanpa { | |
width: 3em; | |
} |