Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var positive = true; // Start going down or up
- var h = 6; // How wide the diamonds should go to
- var contCount = 5; // How many columns of diamonds should there be
- var t = h * 2; // Don't edit
- // Loop and make the pyramids
- for (var i = 0; i < (h * 100) * Math.PI; i++) {
- // Decide whether we need to be going up or down
- var output = "";
- if (i % h == 0) {
- positive = !positive;
- continue;
- }
- // Draw contCount diamond parts
- for (var cont = 0; cont < contCount; cont++) {
- var c = 0; // How many chars we're at
- // --- Left
- // Draw left dashes
- for (var j = 0; j < (positive ? i % h : h - i % h) - 1; j++) {
- output += "-";
- c++;
- }
- // Draw left slashes
- output += (i % h == 0) ? (positive ? "<" : ">") : (positive ? "\\" : "/");
- // Create whitespace to straighten line
- for (; c < h - 1; c++) output += " ";
- // --- Right
- // Create whitespace to justify right
- var temp = c + (!positive ? i % h : h - i % h) - 1;
- for (; c < temp; c++) output += " ";
- // Draw right slashes
- output += (i % h == 0) ? (!positive ? "<" : ">") : (!positive ? "\\" : "/");
- // Draw right dashes
- for (var j = 0; j < (positive ? i % h : h - i % h) - 1; j++) {
- output += "-";
- c++;
- }
- }
- // Print output
- console.info(output);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement