mirror of
https://github.com/coding-horror/basic-computer-games.git
synced 2026-01-08 03:12:26 -08:00
show terminal header with link to sources
This commit is contained in:
@@ -1,16 +0,0 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>SINE WAVE</title>
|
||||
<link rel="stylesheet" href="../../00_Utilities/javascript/style_terminal.css" />
|
||||
</head>
|
||||
<body>
|
||||
<pre id="output"></pre>
|
||||
<script>
|
||||
/* redirect console.log messages to the output-element in the DOM */
|
||||
window.console = {
|
||||
log: (text) => document.getElementById("output").innerHTML += text + "<br>"
|
||||
}
|
||||
</script>
|
||||
<script src="sinewave.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,22 +0,0 @@
|
||||
print(tab(30), "SINE WAVE");
|
||||
print(tab(15), "CREATIVE COMPUTING MORRISTOWN, NEW JERSEY");
|
||||
print("\n\n\n\n");
|
||||
|
||||
// REMARKABLE PROGRAM BY DAVID AHL
|
||||
// Transliterated to Javascript by Les Orchard <me@lmorchard.com>
|
||||
|
||||
let toggleWord = true;
|
||||
|
||||
for (let step = 0; step < 40; step += 0.25) {
|
||||
let indent = Math.floor(26 + 25 * Math.sin(step));
|
||||
print(tab(indent), toggleWord ? "CREATIVE" : "COMPUTING");
|
||||
toggleWord = !toggleWord;
|
||||
}
|
||||
|
||||
function print(...messages) {
|
||||
console.log(messages.join(" "));
|
||||
}
|
||||
|
||||
function tab(count) {
|
||||
return " ".repeat(count);
|
||||
}
|
||||
18
78_Sine_Wave/javascript/sinewave.mjs
Normal file
18
78_Sine_Wave/javascript/sinewave.mjs
Normal file
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
import { println, tab } from '../../00_Common/javascript/common.mjs';
|
||||
|
||||
println(tab(30), "SINE WAVE");
|
||||
println(tab(15), "CREATIVE COMPUTING MORRISTOWN, NEW JERSEY");
|
||||
println("\n".repeat(4));
|
||||
|
||||
// REMARKABLE PROGRAM BY DAVID AHL
|
||||
// Transliterated to Javascript by Les Orchard <me@lmorchard.com>
|
||||
|
||||
let toggleWord = true;
|
||||
|
||||
for (let step = 0; step < 40; step += 0.25) {
|
||||
let indent = Math.floor(26 + 25 * Math.sin(step));
|
||||
println(tab(indent), toggleWord ? "CREATIVE" : "COMPUTING");
|
||||
toggleWord = !toggleWord;
|
||||
}
|
||||
Reference in New Issue
Block a user