Skip to content

Commit c4496e2

Browse files
authored
Merge pull request #57 from icarusiftctts/main
Fix #13 - Added INDEX.md automation
2 parents 4372d87 + d87fab1 commit c4496e2

4 files changed

Lines changed: 240 additions & 0 deletions

File tree

.github/workflows/update-index.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Update Game Index
2+
on:
3+
push:
4+
branches: [ main, master ]
5+
pull_request:
6+
branches: [ main, master ]
7+
8+
jobs:
9+
update-index:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v3
13+
with:
14+
token: ${{ secrets.GITHUB_TOKEN }}
15+
16+
- name: Set up Python
17+
uses: actions/setup-python@v4
18+
with:
19+
python-version: '3.x'
20+
21+
- name: Update INDEX.md
22+
run: |
23+
python update_index.py
24+
25+
- name: Commit changes
26+
run: |
27+
git config --local user.email "[email protected]"
28+
git config --local user.name "GitHub Action"
29+
git add INDEX.md
30+
if [[ -n "$(git status --porcelain INDEX.md)" ]]; then
31+
git commit -m "Auto-update INDEX.md with new games [skip ci]"
32+
git push
33+
else
34+
echo "No changes to INDEX.md"
35+
fi

INDEX.md

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# 🎮 Game Scripts Index
2+
3+
Welcome to Game_Scripts — an open-source collection of mini games!
4+
This index automatically tracks all games across different programming languages.
5+
Last updated: Wed Oct 15 20:32:09 UTC 2025
6+
7+
Tracked 21 games across 3 languages.
8+
9+
## 📚 Table of Contents
10+
- [Java](#java-games)
11+
- [Javascript](#javascript-games)
12+
- [Python](#python-games)
13+
14+
## Java Games
15+
16+
### 🎯 [BrickBreakingGame](./Java/BrickBreakingGame/)
17+
A fun game built with core programming concepts
18+
19+
### 🎯 [Hangman](./Java/Hangman/)
20+
🎮 Hangman GUI Game
21+
22+
### 🎯 [MemoryCardGame(GUI)](./Java/MemoryCardGame(GUI)/)
23+
🎮 Memory Card Matching Game (GUI)
24+
25+
### 🎯 [NumberGuessingGame](./Java/NumberGuessingGame/)
26+
🎮 NumberGuessingGameGUI.java
27+
28+
### 🎯 [PongGameGUI](./Java/PongGameGUI/)
29+
🎮 Pong Game GUI
30+
31+
### 🎯 [TicTacToe](./Java/TicTacToe/)
32+
The Number Guessing Game GUI is a simple and interactive game built using Java Swing.
33+
34+
## Javascript Games
35+
36+
### 🎯 [Coin Toss Simulator](./Javascript/Coin Toss Simulator/)
37+
A simple and visually appealing coin flip simulator built using HTML, CSS, and JavaScript.
38+
39+
### 🎯 [Memory Card Game](./Javascript/Memory Card Game/)
40+
A responsive, difficulty-based memory card game built with HTML, CSS, and JavaScript. Players flip cards to find matching pairs of popular app icons. The game includes multiple difficulty levels, dynamic grid generation, image-based cards, and a win message when all pairs are matched.
41+
42+
### 🎯 [NumberGuessingGame](./Javascript/NumberGuessingGame/)
43+
A simple web-based number guessing game built with HTML, CSS, and JavaScript.
44+
45+
### 🎯 [Rock Paper Scissor](./Javascript/Rock Paper Scissor/)
46+
A fun game built with core programming concepts
47+
48+
### 🎯 [Stopwatch App](./Javascript/Stopwatch App/)
49+
A simple yet elegant web-based stopwatch application with start, stop, and reset functionality.
50+
51+
## Python Games
52+
53+
### 🎯 [Brick_Breaker](./Python/Brick_Breaker/)
54+
- Language: Python
55+
56+
### 🎯 [Dice_Roll](./Python/Dice_Roll/)
57+
A visually engaging dice rolling simulator built using Python and Tkinter.
58+
59+
### 🎯 [Maze_Runner](./Python/Maze_Runner/)
60+
A fun game built with core programming concepts
61+
62+
### 🎯 [Quiz Game](./Python/Quiz Game/)
63+
A fun game built with core programming concepts
64+
65+
### 🎯 [Snake_Game](./Python/Snake_Game/)
66+
- Language: Python
67+
68+
### 🎯 [Snake_Water_Gun](./Python/Snake_Water_Gun/)
69+
By now we have 2 numbers (variables), you and computer
70+
71+
### 🎯 [Throw_Dart](./Python/Throw_Dart/)
72+
- Language: Python
73+
74+
### 🎯 [Tic_Tac_Toe](./Python/Tic_Tac_Toe/)
75+
- Language: Python
76+
77+
### 🎯 [Treasure_hunt](./Python/Treasure_hunt/)
78+
- Language: Python
79+
80+
### 🎯 [Whack_A_Mole](./Python/Whack_A_Mole/)
81+
- Language: Python

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ The goal is simple — learn, create, and share **fun little games** built using
1818

1919
Each game lives inside its own folder with a small **README**, making it easy to explore and learn from.
2020

21+
We also maintain an **INDEX** that auto-updates to include all games in the project.
22+
2123
---
2224

2325
## 🚀 Getting Started

update_index.py

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
#!/usr/bin/env python3
2+
3+
import os
4+
import re
5+
from pathlib import Path
6+
7+
def get_game_description(game_path):
8+
readme_path = os.path.join(game_path, 'README.md')
9+
if os.path.exists(readme_path):
10+
try:
11+
with open(readme_path, 'r', encoding='utf-8') as f:
12+
content = f.read()
13+
lines = content.split('\n')
14+
for line in lines:
15+
line = line.strip()
16+
if line and not line.startswith('#') and len(line) > 10:
17+
clean_line = re.sub(r'[*_`]', '', line)
18+
return clean_line
19+
except:
20+
pass
21+
22+
for file in os.listdir(game_path):
23+
if file.lower().endswith(('.py', '.js', '.java', '.cpp')):
24+
try:
25+
with open(os.path.join(game_path, file), 'r', encoding='utf-8') as f:
26+
content = f.read(1000)
27+
lines = content.split('\n')[:15]
28+
for line in lines:
29+
line = line.strip()
30+
if line.startswith('#'):
31+
desc = line[1:].strip()
32+
if len(desc) > 10 and not any(word in desc.lower() for word in
33+
['!/usr/bin/env', 'coding:', 'author:', 'date:', 'copyright']):
34+
return desc
35+
elif line.startswith('//'):
36+
desc = line[2:].strip()
37+
if len(desc) > 10 and 'license' not in desc.lower():
38+
return desc
39+
elif '/*' in line or line.startswith('*'):
40+
desc = re.sub(r'/\*|\*/|\*', '', line).strip()
41+
if len(desc) > 10:
42+
return desc
43+
except:
44+
continue
45+
46+
return "A fun game built with core programming concepts"
47+
48+
def scan_games():
49+
languages = ['Python', 'Java', 'Javascript']
50+
games = {}
51+
52+
for lang in languages:
53+
if os.path.exists(lang):
54+
games[lang] = []
55+
for item in os.listdir(lang):
56+
item_path = os.path.join(lang, item)
57+
if os.path.isdir(item_path):
58+
description = get_game_description(item_path)
59+
games[lang].append({
60+
'name': item,
61+
'path': f"./{item_path}",
62+
'description': description
63+
})
64+
65+
return games
66+
67+
def generate_index(games):
68+
content = []
69+
content.append("# 🎮 Game Scripts Index")
70+
content.append("")
71+
content.append("Welcome to Game_Scripts — an open-source collection of mini games!")
72+
content.append("This index automatically tracks all games across different programming languages.")
73+
content.append(f"Last updated: {os.popen('date').read().strip() if os.name != 'nt' else 'N/A'}")
74+
content.append("")
75+
content.append(f"Tracked {sum(len(v) for v in games.values())} games across {len(games)} languages.")
76+
content.append("")
77+
78+
content.append("## 📚 Table of Contents")
79+
for lang in sorted(games.keys()):
80+
if games[lang]:
81+
content.append(f"- [{lang.title()}](#{lang.lower()}-games)")
82+
83+
content.append("")
84+
85+
for lang in sorted(games.keys()):
86+
if games[lang]:
87+
content.append(f"## {lang.title()} Games")
88+
content.append("")
89+
90+
for game in sorted(games[lang], key=lambda x: x['name'].lower()):
91+
content.append(f"### 🎯 [{game['name']}]({game['path']}/)")
92+
content.append(f"{game['description']}")
93+
content.append("")
94+
95+
return "\n".join(content)
96+
97+
def main():
98+
print("🔍 Scanning for games...")
99+
games = scan_games()
100+
101+
print("📝 Generating INDEX.md...")
102+
index_content = generate_index(games)
103+
104+
with open('INDEX.md', 'w', encoding='utf-8') as f:
105+
f.write(index_content)
106+
107+
total_games = sum(len(v) for v in games.values())
108+
print(f"✅ INDEX.md updated successfully!")
109+
print(f"📊 Tracked {total_games} games across {len(games)} languages.")
110+
111+
if total_games > 0:
112+
print("\n📋 Games found:")
113+
for lang, game_list in games.items():
114+
if game_list:
115+
print(f" {lang.title()}: {len(game_list)} games")
116+
for game in game_list[:3]:
117+
print(f" - {game['name']}")
118+
if len(game_list) > 3:
119+
print(f" ... and {len(game_list) - 3} more")
120+
121+
if __name__ == "__main__":
122+
main()

0 commit comments

Comments
 (0)