-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdefense.html
171 lines (148 loc) · 9.48 KB
/
defense.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Defense of Team Ball Lightning</title>
<style>
body {
font-family: 'Times', sans-serif;
background-color: #f0f0f0;
color: #333;
padding: 20px;
}
.game-container {
background-color: #fff;
padding: 20px;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0,0,0,0.1);
}
.game-header {
text-align: center;
}
.game-story {
margin-top: 20px;
white-space: pre-wrap; /* Ensures typewriter effect respects new lines */
}
#rollDie {
display: block;
margin: 20px auto;
padding: 10px 20px;
font-size: 18px;
cursor: pointer;
}
</style>
</head>
<body>
<div class="game-container">
<h1 class="game-header">Defense of Team Ball Lightning</h1>
<img src="https://raw.githubusercontent.com/Hamzatrah/VirtualQuantumPersonalComputer/8c48901fa1f8aa904b04618a9b7f530aaa5abbe7/IMG_6893.png" alt="Team Ball Lightning" style="max-width: 100%; height: auto; display: block; margin: 0 auto;">
<button id="rollDie">Roll Qutrit Die</button>
<p id="dieResult">Result: </p>
<div class="game-story">
<!-- Story and choices will be dynamically inserted here based on the player's interaction -->
</div>
</div>
<script>
const quantum = {
getRandom: function(min, mid, max) {
if (typeof min !== "number" || typeof mid !== "number" || typeof max !== "number") {
throw new Error("min, mid, and max must be numbers");
}
if (min >= mid || mid >= max) {
throw new Error("Values must be in order: min < mid < max");
}
const buffer = new Uint32Array(1);
window.crypto.getRandomValues(buffer);
const normalizedRandom = buffer[0] / (0xFFFFFFFF + 1);
if (normalizedRandom < 0.33) {
return this.cryptoRandom(min, mid);
} else if (normalizedRandom < 0.67) {
return this.cryptoRandom(mid, max);
} else {
return this.cryptoRandom(max, max + (max - mid));
}
},
cryptoRandom: function(min, max) {
const range = max - min;
const buffer = new Uint32Array(1);
window.crypto.getRandomValues(buffer);
return (buffer[0] / (0xFFFFFFFF + 1)) * range + min;
}
};
const storyLines = [
`<strong>Chapter 1: The Dismissal</strong><br>
Moment before the final presentation, Hamzat Incorporated is unexpectedly confronted by Scott Greenwald, the executive chairman of <strong> Reality Hack 501c-3, </strong> this host of the Hackathon. Scott accuses Hamzat of being rude and without further explanation, expels him from the competition. Team Ball Lightning is left leaderless and disqualified, their groundbreaking project now in jeopardy.`,
`<strong>Chapter 2: The Search for Truth</strong><br>
Refusing to accept defeat, Hamzat starts a guerrilla internet activism campaign, gathering signatures for a petition to investigate Reality Hack 501c-3, the organization behind the hackathon. The investigation uncovers three main allegations against Scott: withholding Hamzat's passport, identity-based discrimination, and cheating to eliminate Team Ball Lightning's competitive advantage.`,
`<strong>Chapter 3: The Qutrit Die Rolls</strong><br>
Now, Hamzat must navigate through a series of challenges to clear his name and restore Team Ball Lightning's honor. Each decision you make will influence the outcome of this story. Will you confront Scott directly, seek support from the hackathon community, or find a way to present your project despite the disqualification?`,
`<strong>Chapter 4: The Revelation</strong><br>
Depending on your decisions, the story unfolds towards one of several endings. Can Hamzat uncover Scott's motives in trying to hack his hackathon and reveal the truth behind the disqualification? Will Team Ball Lightning's project see the light of day, bringing virtual ball lightning into our physical world?`
];
const endings = {
"H": `<strong>Ending A (Confrontation):</strong><br>Scott admits to feeling threatened by the potential of Team Ball Lightning's project. He is arrested. <strong> A2 Betrayal
The unraveling began quietly, insidiously. Scott, whose ambition had long since eclipsed his moral compass, embarked on a campaign of deceit that would unravel the fabric of trust within Team Ball Lightning. His first move was against Albert, the team's lead researcher. Using a combination of flattery and false promises, Scott extracted sensitive research data, promising Albert fame and recognition he never intended to deliver.
Albert, blinded by the prospect of acclaim, failed to see the betrayal coming. By the time he realized his error, it was too late; his contributions had already been undermined, repurposed to serve Scott’s hidden agenda. The trust within the team began to erode, but Scott was far from finished.
Bao, the team's engineer, was next. Scott preyed on Bao’s fears, convincing him that the project was at risk of being shut down due to lack of progress. In a desperate bid to save their work, Bao handed over control of the engineering prototypes to Scott. It was a move he would come to regret, as Scott used these prototypes to further his own position, leaving Bao's efforts uncredited and his reputation in jeopardy.
Zoe, the team's communications lead, experienced a similar fate. Scott manipulated her trust to gain access to the team's media and public relations channels. Under the guise of protecting the team's image, he began to isolate them from their supporters and industry contacts, positioning himself as the sole face of the project.
Richard, however, proved to be the linchpin that Scott couldn’t sway. Skeptical from the start, Richard had maintained a cautious distance from Scott's machinations. His suspicions, initially dismissed by the team as paranoia, became their saving grace when the full extent of Scott's betrayal came to light.
The fallout was catastrophic. Scott's actions, now public, led to a federal trial that exposed numerous felonies, including fraud, theft of intellectual property, and obstruction of justice. The evidence was irrefutable, much of it provided by Richard, who had quietly documented Scott's actions.
',
"𝕏": `<strong>Ending B (Community Support):</strong><br>The hackathon community rallies behind Team Ball Lightning, forcing the organizers to allow them back into the competition. Their presentation is a resounding success, earning them the closure they deserved.`,
"+": `<strong>Ending C (Guerrilla Presentation):</strong><br>The unauthorized demonstration outside the venue captures widespread attention, leading to an impromptu review by the scientific community. Team Ball Lightning is recognized for innovation and determination and groundbreaking science.`
};
let currentLine = 0;
let makingFinalDecision = false;
document.getElementById('rollDie').addEventListener('click', function() {
rollQuantumDie();
});
function rollQuantumDie() {
const resultElement = document.getElementById('dieResult');
const outcome = quantumDieOutcome();
resultElement.innerHTML = `Result: ${outcome}`;
const storyContainer = document.querySelector('.game-story');
const rollDieButton = document.getElementById('rollDie');
rollDieButton.disabled = true; // Disable the button
if (currentLine < storyLines.length) {
typeStory(storyLines[currentLine], storyContainer, 0, 30, () => rollDieButton.disabled = false);
currentLine++;
if (currentLine === storyLines.length) {
makingFinalDecision = true;
}
} else if (makingFinalDecision) {
typeStory(endings[outcome], storyContainer, 0, 30, () => rollDieButton.disabled = false);
makingFinalDecision = false;
}
}
function typeStory(text, target, index = 0, interval = 30, callback) {
if (index < text.length) {
target.innerHTML += text.charAt(index);
index++;
const nextChar = text.charAt(index);
let additionalDelay = 0;
if (nextChar === '.' || nextChar === ',' || nextChar === ':' || nextChar === ';' || nextChar === '!') {
additionalDelay = 500;
}
setTimeout(() => {
typeStory(text, target, index, interval, callback);
}, interval + additionalDelay);
} else if (callback) {
callback(); // Re-enable the button
}
}
function quantumDieOutcome() {
const result = quantum.getRandom(0, 1, 2);
let outcome;
if (result < 1) {
outcome = 'H';
} else if (result >= 1 && result < 2) {
outcome = '𝕏';
} else {
outcome = '+';
}
return outcome;
}
</script>
</body>
</html>