+
-
About me
-
Hi! My name is Caleb Fontenot. I am a software developer in my second semester at South Lousiana Community College.
+
About me
+
Hi! My name is Caleb Fontenot. I am a software developer in my second semester at South Lousiana
+ Community College.
+
Pick a design!
+
+
+
+
+
+
-
Pick a design!
+ function design4(input) {
+ let outputString = "";
+ let outputLine = "";
+ let radius = (input.length + 1);
+ let mid = radius;
+ if (mid % 2 == 1) {
+ var spaceOffset = " ";
+ } else {
+ var spaceOffset = "";
+ }
+ console.log(radius, mid);
+ // dist represents distance to the center
+ let dist = parseFloat(0);
+ let space = ""
+ for (let i = 0; i < (input.length / 2); ++i) {
+ space += " ";
+ }
+ // for horizontal movement
+ var i;
+ var j;
+ let lineHasInput = false;
+ for (i = 0; i <= 2 * radius; i++) {
+ lineHasInput = false;
+ if (Math.trunc(i) != mid) {
+ // for vertical movement
+ for (j = 0; j <= 2 * radius; j++) {
+ dist = Math.sqrt(
+ ((i - radius) * (i - radius) * 4) + // (* 4) accounts for the offset between lines
+ (j - radius) * (j - radius)
+ );
+ //console.log(i, j, radius, dist);
+ // dist should be in the range (radius - 0.5)
+ // and (radius + 0.5) to print stars(*)
-
-
-
-
+ if (dist > radius - 1 && dist < radius + 1) { //&& dist > radius - 1
+ lineHasInput = true;
+ outputLine += "·"; //zero-width space
+ } else {
+ outputLine += " ";
+ }
+ }
+ } else {
+ lineHasInput = true;
+ outputLine += "·" + space + input + space + spaceOffset + "·"; //zero-width space
+ }
-
-
-
-
-
-
+ //console.log(i, j, outputLine);
+ if (lineHasInput) {
+ outputString += outputLine + "
";
+ }
+ outputLine = "";
+ }
+ return outputString;
+ }
+ var charIterateState;
+ function charIterate(input) {
+ if (charIterateState == undefined) {
+ charIterateState = 0;
+ } else {
+ if (charIterateState < (input.length - 1)) {
+ charIterateState++;
+ } else {
+ charIterateState = 0;
+ }
+ }
+ console.log(charIterateState, input.charAt(charIterateState));
+ return charIterateState;
+ }
-
-
+ function design5(input) {
+ let outputString = "";
+ let outputLine = "";
+ let radius = (input.length);
+ let mid = radius;
+ if (mid % 2 == 1) {
+ var spaceOffset = " ";
+ } else {
+ var spaceOffset = "";
+ }
+ console.log(radius, mid);
+ // dist represents distance to the center
+ let dist = parseFloat(0);
+ let space = ""
+ for (let i = 0; i < (input.length / 2); ++i) {
+ space += " ";
+ }
+ // for horizontal movement
+ var i;
+ var j;
+ let lineHasInput = false;
+ for (i = 0; i <= 2 * radius; i++) {
+ lineHasInput = false;
+ if (Math.trunc(i) != mid) {
+ // for vertical movement
+ for (j = 0; j <= 2 * radius; j++) {
+ dist = Math.sqrt(
+ ((i - radius) * (i - radius) * 4) + // (* 4) accounts for the offset between lines
+ (j - radius) * (j - radius)
+ );
+ //console.log(i, j, radius, dist);
+ // dist should be in the range (radius - 0.5)
+ // and (radius + 0.5) to print stars(*)
+
+
+ if (dist > radius - 1 && dist < radius + 1) { //&& dist > radius - 1
+ lineHasInput = true;
+ outputLine += "" + input.charAt(charIterate(input)); //zero-width space
+ } else {
+ outputLine += " ";
+ }
+ }
+ } else {
+ lineHasInput = true;
+ outputLine += input.charAt(charIterate(input)) + space + input + space + spaceOffset + input.charAt(charIterate(input));
+ }
+
+ //console.log(i, j, outputLine);
+ if (lineHasInput) {
+ outputString += outputLine + "
";
+ }
+ outputLine = "";
+ }
+ return outputString;
+ }
+
+
+