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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
</html>
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html lang="en">
|
3 |
+
<head>
|
4 |
+
<meta charset="UTF-8" />
|
5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
6 |
+
<title>Branch Workflows Jeopardy</title>
|
7 |
+
<style>
|
8 |
+
body {
|
9 |
+
font-family: Arial, sans-serif;
|
10 |
+
display: flex;
|
11 |
+
flex-direction: column;
|
12 |
+
align-items: center;
|
13 |
+
background-color: #f0f0f0;
|
14 |
+
margin: 0;
|
15 |
+
}
|
16 |
+
h1 {
|
17 |
+
color: #0078D4;
|
18 |
+
}
|
19 |
+
#game-board {
|
20 |
+
display: grid;
|
21 |
+
grid-template-columns: repeat(5, 1fr);
|
22 |
+
grid-auto-rows: 100px;
|
23 |
+
gap: 2px;
|
24 |
+
margin: 20px 0;
|
25 |
+
background-color: #000;
|
26 |
+
border: 4px solid #000;
|
27 |
+
}
|
28 |
+
.category {
|
29 |
+
background-color: #005a9e;
|
30 |
+
color: #fff;
|
31 |
+
font-weight: bold;
|
32 |
+
display: flex;
|
33 |
+
justify-content: center;
|
34 |
+
align-items: center;
|
35 |
+
text-align: center;
|
36 |
+
font-size: 18px;
|
37 |
+
border: 1px solid #000;
|
38 |
+
}
|
39 |
+
.card {
|
40 |
+
background-color: #0078D4;
|
41 |
+
color: #fff;
|
42 |
+
display: flex;
|
43 |
+
justify-content: center;
|
44 |
+
align-items: center;
|
45 |
+
font-size: 16px;
|
46 |
+
font-weight: bold;
|
47 |
+
cursor: pointer;
|
48 |
+
border: 1px solid #000;
|
49 |
+
text-align: center;
|
50 |
+
transition: background-color 0.3s;
|
51 |
+
}
|
52 |
+
.card:hover {
|
53 |
+
background-color: #005a9e;
|
54 |
+
}
|
55 |
+
.card.disabled {
|
56 |
+
background-color: #cccccc;
|
57 |
+
cursor: default;
|
58 |
+
}
|
59 |
+
#question-display {
|
60 |
+
width: 80%;
|
61 |
+
text-align: center;
|
62 |
+
margin-bottom: 20px;
|
63 |
+
}
|
64 |
+
#score {
|
65 |
+
font-size: 24px;
|
66 |
+
font-weight: bold;
|
67 |
+
color: #0078D4;
|
68 |
+
}
|
69 |
+
.answer-container {
|
70 |
+
display: flex;
|
71 |
+
justify-content: center;
|
72 |
+
margin-top: 20px;
|
73 |
+
}
|
74 |
+
.answer-btn {
|
75 |
+
margin: 5px;
|
76 |
+
padding: 10px 15px;
|
77 |
+
font-size: 18px;
|
78 |
+
cursor: pointer;
|
79 |
+
text-align: center;
|
80 |
+
border: 2px solid #005a9e;
|
81 |
+
border-radius: 5px;
|
82 |
+
background-color: #0078D4;
|
83 |
+
color: #fff;
|
84 |
+
font-weight: bold;
|
85 |
+
transition: background-color 0.3s, color 0.3s;
|
86 |
+
}
|
87 |
+
.answer-btn:hover {
|
88 |
+
background-color: #005a9e;
|
89 |
+
color: #f0f0f0;
|
90 |
+
}
|
91 |
+
.answer-btn.disabled {
|
92 |
+
background-color: #cccccc;
|
93 |
+
color: #666;
|
94 |
+
cursor: not-allowed;
|
95 |
+
}
|
96 |
+
.feedback {
|
97 |
+
margin-top: 10px;
|
98 |
+
font-size: 18px;
|
99 |
+
font-weight: bold;
|
100 |
+
}
|
101 |
+
</style>
|
102 |
+
</head>
|
103 |
+
<body>
|
104 |
+
<h1>Branch Workflows Jeopardy</h1>
|
105 |
+
<p>
|
106 |
+
<strong>Learn More:</strong>
|
107 |
+
<a
|
108 |
+
href="https://learn.microsoft.com/en-us/training/modules/manage-git-branches-workflows/"
|
109 |
+
target="_blank"
|
110 |
+
>Branch Workflows</a
|
111 |
+
>
|
112 |
+
</p>
|
113 |
+
|
114 |
+
<div id="game-board">
|
115 |
+
<!-- Categories -->
|
116 |
+
<div class="category">Common Workflows</div>
|
117 |
+
<div class="category">Trunk-Based Dev</div>
|
118 |
+
<div class="category">Feature Branch</div>
|
119 |
+
<div class="category">Release Branch</div>
|
120 |
+
<div class="category">Forking</div>
|
121 |
+
</div>
|
122 |
+
|
123 |
+
<div id="question-display"></div>
|
124 |
+
<div id="score">Score: 0</div>
|
125 |
+
|
126 |
+
<script>
|
127 |
+
// 5 categories, each with 3 questions = 15 total
|
128 |
+
const categories = [
|
129 |
+
"Common Workflows",
|
130 |
+
"Trunk-Based Dev",
|
131 |
+
"Feature Branch",
|
132 |
+
"Release Branch",
|
133 |
+
"Forking"
|
134 |
+
];
|
135 |
+
|
136 |
+
const questions = [
|
137 |
+
// Common Workflows (index 0)
|
138 |
+
[
|
139 |
+
{
|
140 |
+
q: "Which workflow is an extension of the Centralized Workflow, emphasizing continuous integration in the main branch?",
|
141 |
+
a: ["Trunk-based development", "Release branch workflow", "GitHub flow"],
|
142 |
+
correct: 0
|
143 |
+
},
|
144 |
+
{
|
145 |
+
q: "Which workflow uses a dedicated branch created from the main branch to stabilize code for final testing before deploying to production?",
|
146 |
+
a: ["Trunk-based development", "Release branch workflow", "Forking workflow"],
|
147 |
+
correct: 1
|
148 |
+
},
|
149 |
+
{
|
150 |
+
q: "Which workflow is often used in open-source projects, giving each developer their own server-side repository?",
|
151 |
+
a: ["Trunk-based development", "Feature branch workflow", "Forking workflow"],
|
152 |
+
correct: 2
|
153 |
+
}
|
154 |
+
],
|
155 |
+
// Trunk-Based Dev (index 1)
|
156 |
+
[
|
157 |
+
{
|
158 |
+
q: "In trunk-based development, which branch do developers frequently commit small, incremental changes to?",
|
159 |
+
a: ["Main branch (trunk)", "Multiple long-lived branches", "Ephemeral patches"],
|
160 |
+
correct: 0
|
161 |
+
},
|
162 |
+
{
|
163 |
+
q: "Which practice is crucial for maintaining code quality and stability in trunk-based development?",
|
164 |
+
a: ["Ignoring code review", "Frequent merges without tests", "Continuous integration & automated testing"],
|
165 |
+
correct: 2
|
166 |
+
},
|
167 |
+
{
|
168 |
+
q: "What is the primary advantage of trunk-based development?",
|
169 |
+
a: [
|
170 |
+
"It fosters large merge conflicts",
|
171 |
+
"It emphasizes continuous integration with minimal branching",
|
172 |
+
"It requires no commit messages"
|
173 |
+
],
|
174 |
+
correct: 1
|
175 |
+
}
|
176 |
+
],
|
177 |
+
// Feature Branch (index 2)
|
178 |
+
[
|
179 |
+
{
|
180 |
+
q: "What does the feature branch workflow emphasize about each new feature or change?",
|
181 |
+
a: [
|
182 |
+
"They stay in the main branch",
|
183 |
+
"They are developed in a dedicated branch",
|
184 |
+
"They are tested only after merging with main"
|
185 |
+
],
|
186 |
+
correct: 1
|
187 |
+
},
|
188 |
+
{
|
189 |
+
q: "Which advantage does the feature branch workflow provide?",
|
190 |
+
a: [
|
191 |
+
"Multiple developers can break main easily",
|
192 |
+
"Merges happen automatically without review",
|
193 |
+
"Parallel development of multiple features plus code review"
|
194 |
+
],
|
195 |
+
correct: 2
|
196 |
+
},
|
197 |
+
{
|
198 |
+
q: "Which Git concept is recommended to gather feedback or suggestions on feature branches?",
|
199 |
+
a: ["Push to production", "Pull requests", "Direct commits to main"],
|
200 |
+
correct: 1
|
201 |
+
}
|
202 |
+
],
|
203 |
+
// Release Branch (index 3)
|
204 |
+
[
|
205 |
+
{
|
206 |
+
q: "When a dedicated branch is created from the main branch for release activities, it is typically known as what?",
|
207 |
+
a: ["Trunk branch", "Feature branch", "Release branch"],
|
208 |
+
correct: 2
|
209 |
+
},
|
210 |
+
{
|
211 |
+
q: "Which of the following is a benefit of using a Release Branch Workflow?",
|
212 |
+
a: [
|
213 |
+
"Merges code to production without final testing",
|
214 |
+
"Provides a controlled environment for final testing and bug fixes",
|
215 |
+
"Eliminates the need for a stable main branch"
|
216 |
+
],
|
217 |
+
correct: 1
|
218 |
+
},
|
219 |
+
{
|
220 |
+
q: "After a release branch is ready for production, what typically happens?",
|
221 |
+
a: [
|
222 |
+
"It is discarded without merging",
|
223 |
+
"It is merged back into main (and possibly other branches)",
|
224 |
+
"It is hidden from developers"
|
225 |
+
],
|
226 |
+
correct: 1
|
227 |
+
}
|
228 |
+
],
|
229 |
+
// Forking (index 4)
|
230 |
+
[
|
231 |
+
{
|
232 |
+
q: "How does the forking workflow differ from other Git workflows?",
|
233 |
+
a: [
|
234 |
+
"It uses a single centralized repository for all developers",
|
235 |
+
"Every developer has a personal server-side repository",
|
236 |
+
"It eliminates the need for pull requests entirely"
|
237 |
+
],
|
238 |
+
correct: 1
|
239 |
+
},
|
240 |
+
{
|
241 |
+
q: "Which scenario typically uses the forking workflow?",
|
242 |
+
a: [
|
243 |
+
"Large open-source projects with many contributors",
|
244 |
+
"Small internal teams with direct write access",
|
245 |
+
"Personal hobby projects with no collaboration"
|
246 |
+
],
|
247 |
+
correct: 0
|
248 |
+
},
|
249 |
+
{
|
250 |
+
q: "What is a key advantage of the forking workflow?",
|
251 |
+
a: [
|
252 |
+
"No merges are ever necessary",
|
253 |
+
"Maintainers can accept commits from any developer without giving direct write access",
|
254 |
+
"It doesn’t rely on version control at all"
|
255 |
+
],
|
256 |
+
correct: 1
|
257 |
+
}
|
258 |
+
]
|
259 |
+
];
|
260 |
+
|
261 |
+
let score = 0;
|
262 |
+
let totalCards = 15; // 5 categories x 3 questions each
|
263 |
+
let answeredCards = 0;
|
264 |
+
|
265 |
+
const gameBoard = document.getElementById("game-board");
|
266 |
+
const questionDisplay = document.getElementById("question-display");
|
267 |
+
const scoreDisplay = document.getElementById("score");
|
268 |
+
|
269 |
+
function createBoard() {
|
270 |
+
for (let row = 0; row < 3; row++) {
|
271 |
+
for (let col = 0; col < 5; col++) {
|
272 |
+
const card = document.createElement("div");
|
273 |
+
card.className = "card";
|
274 |
+
card.textContent = `$${(row + 1) * 100}`;
|
275 |
+
card.onclick = () => showQuestion(col, row, card);
|
276 |
+
gameBoard.appendChild(card);
|
277 |
+
}
|
278 |
+
}
|
279 |
+
}
|
280 |
+
|
281 |
+
function showQuestion(category, difficulty, cardElement) {
|
282 |
+
if (cardElement.classList.contains("disabled")) return;
|
283 |
+
const question = questions[category][difficulty];
|
284 |
+
const answerHtml = question.a
|
285 |
+
.map(
|
286 |
+
(answer, index) =>
|
287 |
+
`<button class="answer-btn" onclick="checkAnswer(${category}, ${difficulty}, ${index})">${answer}</button>`
|
288 |
+
)
|
289 |
+
.join("");
|
290 |
+
|
291 |
+
questionDisplay.innerHTML = `
|
292 |
+
<h2>${categories[category]} for $${(difficulty + 1) * 100}</h2>
|
293 |
+
<p>${question.q}</p>
|
294 |
+
<div class="answer-container">${answerHtml}</div>
|
295 |
+
`;
|
296 |
+
|
297 |
+
// Mark card as disabled
|
298 |
+
cardElement.classList.add("disabled");
|
299 |
+
cardElement.style.backgroundColor = "#cccccc";
|
300 |
+
answeredCards++;
|
301 |
+
}
|
302 |
+
|
303 |
+
function checkAnswer(category, difficulty, selectedAnswer) {
|
304 |
+
const question = questions[category][difficulty];
|
305 |
+
const correctAnswer = question.a[question.correct];
|
306 |
+
const isCorrect = selectedAnswer === question.correct;
|
307 |
+
const value = (difficulty + 1) * 100;
|
308 |
+
|
309 |
+
// Disable all answer buttons
|
310 |
+
document.querySelectorAll(".answer-btn").forEach((btn) => {
|
311 |
+
btn.disabled = true;
|
312 |
+
btn.classList.add("disabled");
|
313 |
+
});
|
314 |
+
|
315 |
+
if (isCorrect) {
|
316 |
+
score += value;
|
317 |
+
questionDisplay.innerHTML += `<p class="feedback" style="color: green;">Correct! You earned $${value}.</p>`;
|
318 |
+
} else {
|
319 |
+
score -= value;
|
320 |
+
questionDisplay.innerHTML += `<p class="feedback" style="color: red;">Wrong! You lost $${value}. The correct answer was: ${correctAnswer}</p>`;
|
321 |
+
}
|
322 |
+
|
323 |
+
scoreDisplay.textContent = `Score: ${score}`;
|
324 |
+
if (answeredCards === totalCards) {
|
325 |
+
endGame();
|
326 |
+
}
|
327 |
+
}
|
328 |
+
|
329 |
+
function endGame() {
|
330 |
+
questionDisplay.innerHTML = `<h2>Game Over!</h2><p>Your final score is $${score}.</p>`;
|
331 |
+
}
|
332 |
+
|
333 |
+
createBoard();
|
334 |
+
</script>
|
335 |
+
</body>
|
336 |
</html>
|