Files
ai6-m2/Battleships/Lesson1.html
2025-11-07 11:22:04 +03:00

121 lines
3.5 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>Lesson 1: Battleships in Python!</title>
<style>
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background: #f0f8ff;
color: #2c3e50;
padding: 20px;
max-width: 900px;
margin: 0 auto;
}
h1 {
color: #2980b9;
text-align: center;
border-bottom: 3px solid #3498db;
padding-bottom: 10px;
}
h2 {
color: #2c3e50;
margin-top: 25px;
}
.outcome {
background: #e3f2fd;
padding: 15px;
border-left: 4px solid #3498db;
margin: 15px 0;
}
.why {
background: #e8f5e9;
padding: 15px;
border-left: 4px solid #2ecc71;
margin: 15px 0;
}
.step {
background: #fff8e1;
padding: 12px;
margin: 10px 0;
border-radius: 6px;
border-left: 4px solid #f39c12;
}
code {
background: #f1f1f1;
padding: 2px 6px;
border-radius: 4px;
font-family: monospace;
}
.time {
font-weight: bold;
color: #e74c3c;
}
</style>
</head>
<body>
<h1>🎮 Lesson 1: Find the Hidden Ship!</h1>
<div class="outcome">
<h2>✅ Learning Outcomes</h2>
<ul>
<li>Use <code>random</code> to create hidden game elements</li>
<li>Get input from the player using <code>input()</code></li>
<li>Use <code>if</code> / <code>else</code> to give feedback</li>
<li>Run and debug a simple Python program</li>
</ul>
</div>
<div class="why">
<h2>💡 Why It Matters</h2>
<p>Every video game has <strong>hidden logic</strong> — secret levels, random enemies, or treasure locations. Learning to hide and reveal things with code is the first step to making your own games!</p>
<p>These same skills are used in apps, quizzes, and even smart home devices!</p>
</div>
<h2>⏱️ Lesson Plan (40 minutes)</h2>
<div class="step">
<span class="time">05 min</span><strong>Demo & Explain</strong><br>
Show the game: “Theres a secret ship! Can you find it?”<br>
Explain: Well write code that hides a ship and checks your guess.
</div>
<div class="step">
<span class="time">520 min</span><strong>Code Together</strong><br>
Type this starter code (or use your template):
<pre style="background:#2d2d2d;color:#f8f8f2;padding:10px;border-radius:6px;font-size:14px;">
import random
ship_row = random.randint(0, 4)
ship_col = random.randint(0, 4)
print("Guess the ship!")
guess_row = int(input("Row (0-4): "))
guess_col = int(input("Col (0-4): "))
if guess_row == ship_row and guess_col == ship_col:
print("🎯 HIT! You sank the ship!")
else:
print("💦 MISS!")
print("The ship was at", ship_row, ship_col)
</pre>
</div>
<div class="step">
<span class="time">2035 min</span><strong>Test & Improve</strong><br>
• Run the program 3 times<br>
• Try to break it (type a letter instead of number — what happens?)<br>
• 🌟 <em>Challenge</em>: Add a 2nd ship or limit to 3 guesses!
</div>
<div class="step">
<span class="time">3540 min</span><strong>Share & Celebrate</strong><br>
Pair up! Can your partner guess the ship in 2 tries?
</div>
<h2>🚀 You Just Learned:</h2>
<p>How to create <strong>interactive programs</strong> that respond to user choices — the heart of all games!</p>
</body>
</html>