-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathabusride.html
66 lines (61 loc) · 2.54 KB
/
abusride.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<!DOCTYPE html>
<html>
<head>
<title>A Bus Ride Home (w/ Ghosts)</title>
</head>
<body>
<h1>A Bus Ride Home <i>(w/ Ghosts</i>)</h1>
<h2>By <a href="https://ohnoitsnoah.com">ohnoitsnoah</a> and <a href="https://quewon.github.io">q1</a></h2>
<p>Refresh the page to experience a new bus ride!</p>
<p><b><u>NOTE: This is a prototype</u></b></p>
<hr>
<p>You get on the bus.</p>
<script>
// List of phrases to cycle through
const phrases = [
`Someone is playing music on their headphones a little too loud.`,
`A small group of ghosts are playing Boggle.`,
`There's a ghost giggling in the corner.`,
`A ghost clips through the bus and gets left behind.`,
`Someone picks their nose.`,
`A ghost is snoring loudly, but nobody can figure out how to wake them up.`,
`"I wonder what pumpkin pie tastes like...hopefully like pumpkin!"`,
`"Ughhhhhh. I hope I get to my stop on time."`,
`"Gee-whiz! I love public transportation! :D"`,
`"My mom's gonna kill me!"`,
`Someone opens their lunch. It begins to stink up the bus.`,
`"*Snore*...spaghetti, *snore*, Princess Pea- Huh? Where am I?"`,
`"Ugh, I feel like death."`,
`"-Yeah, I just feel like none of their newer stuff will top their first album."`,
`An old ghost couple argues about their future.`,
`A couple ghosts behind you are reminiscing about their lives back in the 1880s.`,
`You arrive at your final destination and get off.`
// Add more phrases here!
];
// Function to shuffle the phrases array using Fisher-Yates shuffle algorithm
function shuffleArray(array) {
for (let i = array.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
[array[i], array[j]] = [array[j], array[i]];
}
}
// Function to print all the phrases together as plain text
function printAllPhrases() {
const outputDisplay = document.createElement("div");
shuffleArray(phrases);
for (let i = 0; i < phrases.length; i++) {
const newParagraph = document.createElement("p");
newParagraph.textContent = phrases[i];
outputDisplay.appendChild(newParagraph);
if (phrases[i] === `You arrive at your final destination and get off.`) {
// End the simulation when the target phrase is encountered
break;
}
}
document.body.appendChild(outputDisplay);
}
// Start the simulation automatically when the page loads
printAllPhrases();
</script>
</body>
</html>