Skip to content

Commit 4a4d421

Browse files
committed
feat: replace with python-baz-arcade — full SPA rewrite
Major upgrade from simple SPA to arcade version: - Hash-based router with views pattern - Modular CSS (tokens, base, arcade, components, pages) - XP/levels system with gamification - Daily streak tracking - Energy system - Daily quests - In-game shop - Profile page - Settings page - Proper state management with versioning - Legacy data migration support Bug fixes from arcade: - Fix XP/coins never added to global stats (engine.js logic error) - Fix challenge XP double-counting (challenges.js) Architecture: - js/views/ (home, map, lesson, exercises, challenges, result, profile, settings) - js/renderers/ (predict, quiz, fill, bug, sort, write) - js/store.js (versioned state with migration) - js/engine.js (challenge engine) - js/game.js (XP, streak, energy, quests) - js/router.js (hash-based routing) - js/theme.js (dark/light mode) - js/sound.js (Web Audio API) - js/shop.js (in-game shop) - js/achievements.js (badge system) - js/glossary.js (Python glossary) - data/*.js (23 chapters as JS modules)
1 parent ad1df17 commit 4a4d421

89 files changed

Lines changed: 9953 additions & 9623 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

DESIGN.md

Lines changed: 184 additions & 160 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 72 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
## 🎮 پایتون‌باز چیه؟
1818

19-
یه بازی آنلاین برای یادگیری پایتون از صفر. هر فصل شامل **آموزش**، **تمرین** و **چالش** هست. با حل کردن چالش‌ها، سطحت بالا میره و فصل‌های بعدی باز میشه!
19+
یه بازی آنلاین برای یادگیری پایتون از صفر با حالت **آرکید**! هر فصل شامل **آموزش**، **تمرین** و **چالش** هست. با حل کردن چالش‌ها ایکس‌پی بگیر، سطحت بالا بره، و فصل‌های بعدی باز بشه!
2020

2121
**🔗 [بازی آنلاین پایتون‌باز](https://erpycode.github.io/python-game-lab/)**
2222

@@ -31,12 +31,23 @@
3131
| 📱 ریسپانسیو | روی موبایل و دسکتاپ کار میکنه |
3232
| 🔒 سطح‌بندی | فصل‌ها قفل هستن و باید فصل قبلی رو تموم کنی |
3333
| 🌙☀️ حالت تاریک/روشن | تم دلخواهت رو انتخاب کن |
34+
| 🏅 XP و لِوِل | سیستم ایکس‌پی بازی‌وار با سطح‌بندی پیشرفت |
35+
| 🔥 روزانه‌ی پیاپی | هر روز وارد شو تا استریک روزانه‌ات حفظ بشه |
36+
| ⚡ انرژی | سیستم انرژی برای مدیریت بازی روزانه |
37+
| 📋 ماموریت‌های روزانه | کوئست‌های روزانه با پاداش ایکس‌پی |
38+
| 🛒 فروشگاه بازی | آیتم‌ها و اسکین‌های قابل خرید با ایکس‌پی |
39+
| 👤 پروفایل | صفحه پروفایل با آمار و دستاورد‌ها |
40+
| ⚙️ تنظیمات | صفحه تنظیمات با شخصی‌سازی |
3441
| 📖 واژه‌نامه پایتون | ۳۷ کلمه کلیدی با توضیح فارسی |
3542
| 🔍 جستجوی فصل | سریع فصل مورد نظرت رو پیدا کن |
36-
| 🏅 دستاورد‌ها | ۷ دستاورد قابل باز کردن |
3743
| ⏱️ تایمر چالش | چالش‌ها رو با تایمر حل کن |
3844
| 📊 پیشرفت کلی | نوار پیشرفت + آمار کامل |
3945

46+
## 📸 اسکرین‌شات‌ها
47+
48+
<!-- اسکرین‌شات‌های جدید اینجا اضافه کنید -->
49+
*به‌زودی اضافه می‌شه...*
50+
4051
## 📚 فصل‌ها
4152

4253
<table>
@@ -102,94 +113,6 @@
102113
</td>
103114
</tr>
104115
</table>
105-
106-
## 🚀 اجرا کردن
107-
108-
### 🎮 بازی آنلاین (بدون نصب)
109-
110-
**🔗 [بازی آنلاین پایتون‌باز](https://erpycode.github.io/python-game-lab/)**
111-
112-
فقط کافیه لینک رو باز کنی و شروع کنی!
113-
114-
### 💻 اجرا روی سیستم خودت
115-
116-
<div dir="ltr">
117-
118-
```bash
119-
# Clone the repo
120-
git clone https://github.com/erpycode/python-game-lab.git
121-
122-
# Go to directory
123-
cd python-game-lab
124-
125-
# Start local server
126-
python3 -m http.server 8080
127-
128-
# Open browser → http://localhost:8080
129-
```
130-
131-
</div>
132-
133-
## 📁 ساختار پروژه
134-
135-
<div dir="ltr">
136-
137-
```
138-
python-game-lab/
139-
├── index.html # Main page
140-
├── css/
141-
│ └── style.css # Styles & animations
142-
├── js/
143-
│ ├── app.js # Main logic + navigation
144-
│ ├── challenges.js # Challenge engine + smart feedback
145-
│ ├── progress.js # Progress storage (localStorage)
146-
│ ├── ui.js # User interface + rendering
147-
│ ├── utils.js # Helper functions
148-
│ ├── sounds.js # Sound effects (Web Audio API)
149-
│ ├── achievements.js # Badge/achievement system
150-
│ ├── darkmode.js # Dark/light theme toggle
151-
│ ├── glossary.js # Python glossary (37 terms)
152-
│ ├── search.js # Chapter search filter
153-
│ └── timer.js # Challenge countdown timer
154-
├── data/
155-
│ ├── chapter_1.json # 📗 Variables
156-
│ ├── chapter_2.json # 📗 Operators
157-
│ ├── ... # (23 chapters total)
158-
│ └── chapter_23.json # 🎓 Testing with pytest
159-
├── .github/
160-
│ └── workflows/
161-
│ └── deploy.yml # GitHub Pages deployment
162-
├── .nojekyll # Bypass Jekyll processing
163-
├── DESIGN.md # Design documentation
164-
└── README.md
165-
```
166-
167-
</div>
168-
169-
## 🤝 مشارکت
170-
171-
این پروژه اوپن‌سورس هست! اگه میخوای کمک کنی:
172-
173-
1. 🍴 ریپو رو Fork کن
174-
2. 🌿 Branch جدید بساز
175-
3. ✏️ تغییراتت رو commit کن
176-
4. 📤 Push کن
177-
5. 🔀 Pull Request بزن
178-
179-
## 📝 اضافه کردن فصل جدید
180-
181-
فقط یه فایل JSON جدید توی پوشه `data/` بساز و اسمش رو توی `js/ui.js` اضافه کن. برای جزئیات بیشتر فایل `DESIGN.md` رو ببین.
182-
183-
## 📄 لایسنس
184-
185-
[MIT License](LICENSE)
186-
187-
---
188-
189-
<p align="center">
190-
ساخته شده با ❤️ توسط <a href="https://github.com/erpycode">ErPyCode</a>
191-
</p>
192-
193116
</div>
194117

195118
---
@@ -211,7 +134,7 @@ python-game-lab/
211134

212135
## 🎮 What is Python Baz?
213136

214-
An online game for learning Python from scratch. Each chapter includes **lessons**, **exercises**, and **challenges**. Solve challenges to level up and unlock the next chapter!
137+
An online game for learning Python from scratch with an **arcade** experience! Each chapter includes **lessons**, **exercises**, and **challenges**. Earn XP, level up, and unlock new chapters!
215138

216139
**🔗 [Play Python Baz Online](https://erpycode.github.io/python-game-lab/)**
217140

@@ -226,12 +149,23 @@ An online game for learning Python from scratch. Each chapter includes **lessons
226149
| 📱 Responsive | Works on mobile and desktop |
227150
| 🔒 Level System | Chapters are locked — complete previous ones to unlock |
228151
| 🌙☀️ Dark/Light Mode | Choose your preferred theme |
152+
| 🏅 XP & Levels | Arcade-style XP system with progression |
153+
| 🔥 Daily Streak | Log in daily to maintain your streak |
154+
| ⚡ Energy | Energy system for daily gameplay management |
155+
| 📋 Daily Quests | Daily quests with XP rewards |
156+
| 🛒 In-Game Shop | Buy items and skins with XP |
157+
| 👤 Profile | Profile page with stats and achievements |
158+
| ⚙️ Settings | Settings page with customization |
229159
| 📖 Python Glossary | 37 key terms with Persian descriptions |
230160
| 🔍 Chapter Search | Find any chapter instantly |
231-
| 🏅 Achievements | 7 unlockable badges |
232161
| ⏱️ Challenge Timer | Complete challenges against the clock |
233162
| 📊 Progress Tracking | Overall progress bar + detailed stats |
234163

164+
## 📸 Screenshots
165+
166+
<!-- Add new arcade screenshots here -->
167+
*Coming soon...*
168+
235169
## 📚 Chapters
236170

237171
<table>
@@ -323,21 +257,37 @@ python3 -m http.server 8080
323257

324258
```
325259
python-game-lab/
326-
├── index.html # Main page
260+
├── index.html # Main page (SPA entry)
327261
├── css/
328-
│ └── style.css # Styles & animations
262+
│ ├── tokens.css # Design tokens (colors, spacing, etc.)
263+
│ ├── base.css # Base/reset styles
264+
│ ├── arcade.css # Arcade theme & gamification styles
265+
│ ├── components.css # Reusable UI components
266+
│ └── pages.css # Page-specific styles
329267
├── js/
330-
│ ├── app.js # Main logic + navigation
331-
│ ├── challenges.js # Challenge engine + smart feedback
332-
│ ├── progress.js # Progress storage (localStorage)
333-
│ ├── ui.js # User interface + rendering
268+
│ ├── app.js # SPA router + main entry
269+
│ ├── router.js # Hash-based router
270+
│ ├── state.js # Global state management (versioned)
271+
│ ├── migration.js # Legacy data migration
272+
│ ├── views/
273+
│ │ ├── home.js # Home/dashboard view
274+
│ │ ├── map.js # Chapter map view
275+
│ │ ├── lesson.js # Lesson view
276+
│ │ ├── exercises.js # Exercises view
277+
│ │ ├── challenges.js # Challenge view
278+
│ │ ├── result.js # Result/score view
279+
│ │ ├── profile.js # Profile page
280+
│ │ └── settings.js # Settings page
281+
│ ├── systems/
282+
│ │ ├── xp.js # XP & level system
283+
│ │ ├── streak.js # Daily streak tracking
284+
│ │ ├── energy.js # Energy system
285+
│ │ ├── quests.js # Daily quests
286+
│ │ ├── shop.js # In-game shop
287+
│ │ └── sound.js # Sound effects (Web Audio API)
334288
│ ├── utils.js # Helper functions
335-
│ ├── sounds.js # Sound effects (Web Audio API)
336-
│ ├── achievements.js # Badge/achievement system
337-
│ ├── darkmode.js # Dark/light theme toggle
338289
│ ├── glossary.js # Python glossary (37 terms)
339-
│ ├── search.js # Chapter search filter
340-
│ └── timer.js # Challenge countdown timer
290+
│ └── search.js # Chapter search filter
341291
├── data/
342292
│ ├── chapter_1.json # 📗 Variables
343293
│ ├── ... # (23 chapters total)
@@ -350,6 +300,24 @@ python-game-lab/
350300
└── README.md
351301
```
352302

303+
## 🏗️ Architecture
304+
305+
### SPA Router
306+
Hash-based routing (`#/home`, `#/map`, `#/lesson/1`, etc.) with view-based rendering. No page reloads.
307+
308+
### State Management
309+
Versioned state in localStorage with automatic migration when upgrading. Stores XP, streaks, energy, quests, shop inventory, and chapter progress.
310+
311+
### Views Pattern
312+
Each page is a self-contained view module (`views/*.js`) that renders into the main content area.
313+
314+
### Gamification Systems
315+
- **XP/Level**: Earn XP from challenges; level up with progression
316+
- **Daily Streak**: Login consecutive days for bonus rewards
317+
- **Energy**: Regenerate over time; spend on activities
318+
- **Daily Quests**: Fresh challenges every day
319+
- **Shop**: Spend XP on cosmetics and boosts
320+
353321
## 🤝 Contributing
354322

355323
Contributions are welcome!
@@ -362,7 +330,7 @@ Contributions are welcome!
362330

363331
## 📝 Adding a New Chapter
364332

365-
Create a new JSON file in the `data/` folder and add its name to `js/ui.js`. See `DESIGN.md` for details.
333+
Create a new JSON file in the `data/` folder and add its name to `js/app.js`. See `DESIGN.md` for details.
366334

367335
## 📄 License
368336

0 commit comments

Comments
 (0)