Created
February 10, 2018 01:04
-
-
Save Party4Bread/015bc6effb61be0cd156614e174aff7e to your computer and use it in GitHub Desktop.
혀엉 언어는 생성기가 없어보여서 대충대충 만들어보았습니다
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"/> | |
<style> | |
textarea{ | |
min-height: 12em;min-width: 30em; | |
} | |
</style> | |
</head> | |
<body> | |
<h1>혀엉언어 코드 생성기</h1> | |
<textarea placeholder="출력하고 싶은 문자열" id="ipt"></textarea><br/> | |
<input type="button" id="btn" onclick="idiotmethod();cng();" value="IDIOT한방법(겁나게 비효율적)"/><br/> | |
<input type="button" id="btn" onclick="beinglittlehumanmethod();cng();" value="그나마나은방법(비효율적)"/><br/> | |
<input type="button" id="btn" onclick="littlehumanmethod();cng();" value="꽤나은방법(조금 비효율적)"/><br/> | |
<textarea readonly onchange="cng();" id="opt"></textarea><b id="lenlab">글자수나옵니다</b><br/> | |
<a href="https://gist.github.com/xnuk/d9f883ede568d97caa158255e4b4d069">이게뭔지 궁금한분 참조하시길</a> | |
<script> | |
function cng(){ | |
document.getElementById("lenlab").textContent=document.getElementById("opt").value.length+"길이"; | |
} | |
function idiotmethod(){ | |
let td=document.getElementById("ipt").value; | |
let dest=""; | |
for(let i = 0;i<td.length;i++){ | |
dest+="형"; | |
for(let j = 0;j<td.charCodeAt(i);j++){ | |
dest+="."; | |
} | |
dest+="항." | |
} | |
dest+="형흑.흣" | |
document.getElementById("opt").value=dest; | |
} | |
function beinglittlehumanmethod(){ | |
let td=document.getElementById("ipt").value; | |
let dest=""; | |
let base=td.charCodeAt(0); | |
if(td.length<=1){ | |
idiotmethod(); | |
return; | |
} | |
for(let i = 0;i<td.length;i++){ | |
base = td.charCodeAt(i)<base?td.charCodeAt(i):base; | |
} | |
dest+="형"; | |
for(let j = 0;j<base;j++){ | |
dest+="."; | |
} | |
if(td.length<=2) | |
{ | |
dest+="흑..."; | |
} | |
else{ | |
dest+="흐"; | |
for(let i = 3;i<td.length;i++){ | |
dest+="으"; | |
} | |
dest+="윽..."; | |
} | |
for(let i = 0;i<td.length;i++){ | |
dest+="형"; | |
for(let j = base;j<td.charCodeAt(i);j++){ | |
dest+="."; | |
} | |
dest+="하앙." | |
} | |
dest+="형흑.흣" | |
document.getElementById("opt").value=dest; | |
} | |
function littlehumanmethod(){ | |
let td=document.getElementById("ipt").value; | |
let dest=""; | |
let base=td.charCodeAt(0); | |
if(td.length<=1){ | |
idiotmethod(); | |
return; | |
} | |
for(let i = 0;i<td.length;i++){ | |
base = td.charCodeAt(i)<base?td.charCodeAt(i):base; | |
} | |
dest+=hyungfactor(base); | |
if(td.length<=2) | |
{ | |
dest+="흑..."; | |
} | |
else{ | |
dest+="흐"; | |
for(let i = 3;i<td.length;i++){ | |
dest+="으"; | |
} | |
dest+="윽..."; | |
} | |
for(let i = 0;i<td.length;i++){ | |
dest+=hyungfactor(td.charCodeAt(i)-base); | |
dest+="하앙."; | |
} | |
dest+="형흑.흣" | |
document.getElementById("opt").value=dest; | |
} | |
function hyungfactor(num){ | |
let subnum=0; | |
let maxghi=0; | |
let dest=""; | |
var sqrtnum=Math.floor(Math.sqrt(num)); | |
if(num==0){ | |
return "형"; | |
} | |
if(num==1){ | |
return "형."; | |
} | |
if(isPrime(num)){ | |
num-=1; | |
subnum=1; | |
} | |
for(var i=sqrtnum+1; i>0; i--) { // sqrtnum+1 | |
if(num % i == 0) { | |
maxghi=i; | |
break; | |
} | |
} | |
dest+="혀"; | |
for(let i=2;i<maxghi;i++){ | |
dest+="어"; | |
} | |
dest+="엉"; | |
for(let i=0;i<num/maxghi;i++){ | |
dest+="."; | |
} | |
if(subnum==1){ | |
dest+="형.하앙..."; | |
} | |
return dest; | |
} | |
function isPrime(num) { | |
var sqrtnum=Math.floor(Math.sqrt(num)); | |
var prime = num != 1; | |
for(var i=2; i<sqrtnum+1; i++) { // sqrtnum+1 | |
if(num % i == 0) { | |
prime = false; | |
break; | |
} | |
} | |
return prime; | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
이곳에서 사용해볼수있습니다.