Created
February 15, 2016 12:23
-
-
Save TarekkMA/15b7d53a48f1128e49c3 to your computer and use it in GitHub Desktop.
7ASPAT-comp003
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
//-------------Dynamic Varibles----------------// | |
var sratWithUp = true // | |
var endWithDown = true // | |
var numOfPeeks = 4 // | |
var curveLength = 4 // | |
var cycleChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" // | |
//---------------------------------------------// | |
var curves = numOfPeeks * 2 | |
if (!endWithDown) {curves--} | |
if (!sratWithUp) {curves--} | |
var charsNum = curves*curveLength | |
var chars = "" | |
var cycles = (charsNum/cycleChars.length) | 0 | |
var cyclesRemainder = charsNum%cycleChars.length | |
chars += Array(cycles+1).join(cycleChars) | |
chars += cycleChars.substr(0,cyclesRemainder) | |
//------------------------------------------------ | |
var maxSpace = curveLength-1 | |
for(var lineNum=0;lineNum<curveLength;lineNum++){ | |
var line = "" | |
for(var peekNum=0;peekNum<numOfPeeks;peekNum++){ | |
var spaceNumBefore = maxSpace-lineNum | |
var spaceNumAfter = maxSpace-spaceNumBefore | |
var charsBeforeNum = peekNum * curveLength * 2 | |
var pos1,pos2; | |
if(sratWithUp){ | |
pos1=(curveLength-1)-lineNum+charsBeforeNum | |
pos2=(curveLength)+lineNum+charsBeforeNum | |
}else{ | |
pos1=lineNum+charsBeforeNum | |
pos2=lineNum+charsBeforeNum | |
//swap values | |
spaceNumBefore=[spaceNumAfter,spaceNumAfter=spaceNumBefore][0] | |
} | |
line += Array(spaceNumBefore+1).join(" ") | |
line += chars.charAt(pos1) | |
line += Array(spaceNumAfter+1).join(" ") | |
line += Array(spaceNumAfter+1).join(" ") | |
line += chars.charAt(pos2) | |
line += Array(spaceNumBefore+1).join(" ") | |
} | |
console.log(line) | |
} | |
console.log("\n----------Wave_Drawer---------") | |
console.log("| By : Tarek Mohamed Abdalla |") | |
console.log("| Secondary Student |") | |
console.log("------------------------------") | |
if(sratWithUp){ | |
if(endWithDown){ | |
console.log("Your wave starts with <Up> and ends with <Down>") | |
}else{ | |
console.log("Your Wave that starts with <Up> and ends with <Up>") | |
} | |
}else{ | |
if(endWithDown){ | |
console.log("Your wave that starts with <Down> and ends with <Down>") | |
}else{ | |
console.log("Your wave that starts with <Down> and ends with <Up>") | |
} | |
} | |
console.log("Also it has ["+peekNum+"] peeks ,and ["+curves+"] curves that each consist of ["+curveLength+"] charcters.") | |
console.log("In total it has ["+chars.length+"] charcters that repeat to pattren consist of ["+cycleChars.length+"] charcters\nThe pattren >"+cycleChars) | |
console.log("==========\nGive it a try and change <Dynamic Varibles> ;)\n==========") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment