Skip to content

Commit bf108db

Browse files
Merge pull request steam-bell-92#1181 from nishtha-agarwal-211/feat-port-war-card-game
feat: Port 'War Card Game' to the Web App
2 parents daecca7 + 7c5d733 commit bf108db

4 files changed

Lines changed: 955 additions & 4 deletions

File tree

README.md

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
# 🎮 Python Mini Projects Collection 🎯
66

7-
### *Learn Python by Building Fun, Interactive Games & Tools!*
7+
### _Learn Python by Building Fun, Interactive Games & Tools!_
88

99
[![Python Version](https://img.shields.io/badge/python-3.10%2B-blue.svg)](https://www.python.org/downloads/)
1010
[![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
@@ -53,7 +53,6 @@
5353
- [📝 License](#-license)
5454
- [💬 Connect & Share](#-connect--share)
5555

56-
5756
## 🎯 Repo Introduction
5857

5958
This repository is a collection of small Python games and utility projects built to make learning Python more practical and engaging. It includes both command-line projects and a browser-based web app for trying the projects online.
@@ -110,18 +109,21 @@ cd python-mini-project
110109
#### 2. Create a Virtual Environment
111110

112111
For Linux/macOS:
112+
113113
```bash
114114
python3 -m venv venv
115115
source venv/bin/activate
116116
```
117117

118118
For Windows (Command Prompt):
119+
119120
```bash
120121
python -m venv venv
121122
venv\Scripts\activate
122123
```
123124

124125
For Windows (PowerShell):
126+
125127
```bash
126128
python -m venv venv
127129
venv\Scripts\Activate.ps1
@@ -166,6 +168,7 @@ The web application provides a browser-based interface for all projects.
166168
#### Prerequisites for Web App
167169

168170
The web app requires Node.js and npm:
171+
169172
- Download from https://nodejs.org/ (v16 or higher recommended)
170173
- Verify installation: `node --version && npm --version`
171174

@@ -188,6 +191,7 @@ pytest tests/ -v
188191
```
189192

190193
For specific test file:
194+
191195
```bash
192196
pytest tests/test_armstrong.py -v
193197
```
@@ -212,6 +216,7 @@ pytest tests/test_armstrong.py -v
212216
#### Virtual Environment Reminder
213217

214218
Always activate your virtual environment before working:
219+
215220
```bash
216221
# Linux/macOS
217222
source venv/bin/activate
@@ -221,6 +226,7 @@ venv\Scripts\activate
221226
```
222227

223228
Deactivate when done:
229+
224230
```bash
225231
deactivate
226232
```
@@ -237,6 +243,7 @@ deactivate
237243
The browser app currently exposes 39 projects:
238244

239245
### Games
246+
240247
- 2048 Game
241248
- BlackJack21
242249
- Coin Flip
@@ -255,9 +262,11 @@ The browser app currently exposes 39 projects:
255262
- Whack-a-Mole
256263
- Word Scramble
257264
- Spot the Difference
265+
- War Card Game
258266
- Number Sliding Puzzle
259267

260268
### Math
269+
261270
- AP/GP/AGP/HP Recognizer
262271
- Armstrong Numbers
263272
- Binary Search
@@ -273,6 +282,7 @@ The browser app currently exposes 39 projects:
273282
- Progress Tracker
274283

275284
### Utilities
285+
276286
- AI Resume Analyzer
277287
- Color Palette Suggestor
278288
- Morse Code
@@ -286,7 +296,6 @@ The browser app currently exposes 39 projects:
286296
These standalone Python project files do not have a browser counterpart yet and are good future-port candidates:
287297

288298
- [games/Reverse-Hangman-Game/Reverse-Hangman-Game.py](games/Reverse-Hangman-Game/Reverse-Hangman-Game.py)
289-
- [games/War-Card-Game/War-Card-Game.py](games/War-Card-Game/War-Card-Game.py)
290299
- [math/Happy-Number/Happy-Number.py](math/Happy-Number/Happy-Number.py)
291300
- [math/Matrix-Calculator/Matrix-Calculator.py](math/Matrix-Calculator/Matrix-Calculator.py)
292301
- [math/Quadratic-Solver/Quadratic-Solver.py](math/Quadratic-Solver/Quadratic-Solver.py)
@@ -1159,7 +1168,7 @@ Found this helpful? Show some love!
11591168

11601169
**Made with ❤️ for Python learners everywhere**
11611170

1162-
*If you learned something new, don't forget to star the repo! ⭐*
1171+
_If you learned something new, don't forget to star the repo! ⭐_
11631172

11641173
[⬆ Back to Top](#-python-mini-projects-collection-)
11651174

web-app/index.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -872,6 +872,7 @@ <h3>Legal</h3>
872872
<script defer src="js/playground.js"></script>
873873
<script defer type="module" src="js/main.js"></script>
874874
<script defer src="js/hero-canvas.js"></script>
875+
<script defer src="js/projects/war-card-game.js"></script>
875876
<script defer src="js/projects/number-sliding-puzzle.js"></script>
876877
<script>
877878
lucide.createIcons();
@@ -1005,6 +1006,13 @@ <h3>Legal</h3>
10051006
desc: "Friendship relationship calculator",
10061007
tags: "game,relationship",
10071008
},
1009+
{
1010+
project: "war-card-game",
1011+
title: "War Card Game",
1012+
category: "games",
1013+
desc: "A classic two-player card game based on comparing rank values",
1014+
tags: "game,cards,multiplayer,war",
1015+
},
10081016

10091017
// MATH (15+)
10101018
{

web-app/js/projects.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1595,6 +1595,15 @@ function getProjectHTML(projectName) {
15951595

15961596
const projectInstructions = {
15971597
// GAMES
1598+
"war-card-game": {
1599+
title: "⚔️ How to Play War Card Game",
1600+
steps: [
1601+
"Enter names or check the option to play against the CPU.",
1602+
"Each player starts with a deck of 26 cards.",
1603+
"Click 'Draw / Battle' to draw the top card from both decks.",
1604+
"The player with the higher card rank wins the round and gets a point.",
1605+
"Ace is the highest, 2 is the lowest.",
1606+
"Play continues until all cards are drawn. The player with the most points wins!"
15981607
"number-sliding-puzzle": {
15991608
title: "🧩 How to Play Number Sliding Puzzle",
16001609
steps: [
@@ -3167,6 +3176,7 @@ function initializeProject(projectName) {
31673176
"math-quiz": "initMathQuiz",
31683177
"resume-analyzer": "initResumeAnalyzer",
31693178
"caesar-cipher": "initCaesarCipher",
3179+
"war-card-game": "initWarCardGame"
31703180
"number-sliding-puzzle": "initNumberSlidingPuzzle"
31713181
};
31723182

0 commit comments

Comments
 (0)