mirror of
https://github.com/coding-horror/basic-computer-games.git
synced 2025-12-22 15:16:33 -08:00
Fix TODO list generation for C#
This commit is contained in:
98
00_Utilities/TODO.md
Normal file
98
00_Utilities/TODO.md
Normal file
@@ -0,0 +1,98 @@
|
|||||||
|
# TODO list
|
||||||
|
game | csharp | java | javascript | pascal | perl | python | ruby | vbnet
|
||||||
|
--- | --- | --- | --- | --- | --- | --- | --- | ---
|
||||||
|
01_Acey_Ducey | ✅ | ✅ | ✅ | pascal | ✅ | ✅ | ✅ | ✅
|
||||||
|
02_Amazing | ✅ | ✅ | ✅ | pascal | ✅ | ✅ | ✅ | ✅
|
||||||
|
03_Animal | ✅ | ✅ | ✅ | pascal | ✅ | ✅ | ✅ | ✅
|
||||||
|
04_Awari | ✅ | ✅ | ✅ | pascal | ✅ | ✅ | ✅ | ✅
|
||||||
|
05_Bagels | ✅ | ✅ | ✅ | pascal | ✅ | ✅ | ✅ | ✅
|
||||||
|
06_Banner | ✅ | ✅ | ✅ | ⬜️ | ⬜️ | ✅ | ✅ | ✅
|
||||||
|
07_Basketball | ⬜️ | ✅ | ✅ | ⬜️ | ⬜️ | ✅ | ⬜️ | ✅
|
||||||
|
08_Batnum | ✅ | ✅ | ✅ | ⬜️ | ✅ | ✅ | ⬜️ | ✅
|
||||||
|
09_Battle | ✅ | ✅ | ✅ | ⬜️ | ⬜️ | ✅ | ⬜️ | ✅
|
||||||
|
10_Blackjack | ✅ | ⬜️ | ✅ | pascal | ⬜️ | ✅ | ⬜️ | ✅
|
||||||
|
11_Bombardment | ✅ | ✅ | ✅ | pascal | ✅ | ✅ | ✅ | ✅
|
||||||
|
12_Bombs_Away | ⬜️ | ✅ | ✅ | pascal | ✅ | ✅ | ⬜️ | ✅
|
||||||
|
13_Bounce | ⬜️ | ✅ | ✅ | pascal | ⬜️ | ✅ | ✅ | ✅
|
||||||
|
14_Bowling | ✅ | ✅ | ✅ | pascal | ⬜️ | ✅ | ⬜️ | ✅
|
||||||
|
15_Boxing | ✅ | ✅ | ✅ | pascal | ⬜️ | ✅ | ⬜️ | ✅
|
||||||
|
16_Bug | ⬜️ | ✅ | ✅ | pascal | ⬜️ | ✅ | ✅ | ✅
|
||||||
|
17_Bullfight | ✅ | ⬜️ | ✅ | pascal | ⬜️ | ✅ | ⬜️ | ✅
|
||||||
|
18_Bullseye | ✅ | ✅ | ✅ | pascal | ✅ | ✅ | ⬜️ | ✅
|
||||||
|
20_Buzzword | ✅ | ✅ | ✅ | pascal | ✅ | ✅ | ✅ | ✅
|
||||||
|
21_Calendar | ✅ | ✅ | ✅ | pascal | ✅ | ✅ | ⬜️ | ✅
|
||||||
|
22_Change | ✅ | ✅ | ✅ | pascal | ✅ | ✅ | ⬜️ | ✅
|
||||||
|
23_Checkers | ✅ | ⬜️ | ✅ | pascal | ⬜️ | ✅ | ✅ | ✅
|
||||||
|
24_Chemist | ✅ | ✅ | ✅ | pascal | ✅ | ✅ | ⬜️ | ✅
|
||||||
|
25_Chief | ⬜️ | ✅ | ✅ | pascal | ✅ | ✅ | ✅ | ✅
|
||||||
|
26_Chomp | ⬜️ | ✅ | ✅ | pascal | ✅ | ✅ | ⬜️ | ✅
|
||||||
|
27_Civil_War | ✅ | ✅ | ✅ | pascal | ⬜️ | ✅ | ⬜️ | ✅
|
||||||
|
28_Combat | ✅ | ✅ | ✅ | pascal | ⬜️ | ✅ | ⬜️ | ✅
|
||||||
|
29_Craps | ⬜️ | ✅ | ✅ | pascal | ✅ | ✅ | ✅ | ✅
|
||||||
|
30_Cube | ⬜️ | ✅ | ✅ | pascal | ⬜️ | ✅ | ✅ | ✅
|
||||||
|
31_Depth_Charge | ✅ | ✅ | ✅ | pascal | ✅ | ✅ | ✅ | ✅
|
||||||
|
32_Diamond | ⬜️ | ✅ | ✅ | pascal | ✅ | ✅ | ✅ | ✅
|
||||||
|
33_Dice | ✅ | ✅ | ✅ | pascal | ✅ | ✅ | ✅ | ✅
|
||||||
|
34_Digits | ⬜️ | ✅ | ✅ | pascal | ⬜️ | ✅ | ⬜️ | ✅
|
||||||
|
35_Even_Wins | ⬜️ | ⬜️ | ✅ | pascal | ✅ | ✅ | ⬜️ | ✅
|
||||||
|
36_Flip_Flop | ✅ | ✅ | ✅ | pascal | ⬜️ | ✅ | ✅ | ✅
|
||||||
|
37_Football | ⬜️ | ⬜️ | ✅ | pascal | ⬜️ | ⬜️ | ⬜️ | ✅
|
||||||
|
38_Fur_Trader | ✅ | ✅ | ✅ | pascal | ⬜️ | ✅ | ⬜️ | ✅
|
||||||
|
39_Golf | ✅ | ⬜️ | ✅ | pascal | ⬜️ | ✅ | ⬜️ | ✅
|
||||||
|
40_Gomoko | ⬜️ | ✅ | ✅ | pascal | ✅ | ✅ | ⬜️ | ✅
|
||||||
|
41_Guess | ⬜️ | ✅ | ✅ | pascal | ✅ | ✅ | ✅ | ✅
|
||||||
|
42_Gunner | ✅ | ✅ | ✅ | pascal | ⬜️ | ✅ | ⬜️ | ✅
|
||||||
|
43_Hammurabi | ✅ | ✅ | ✅ | pascal | ⬜️ | ✅ | ⬜️ | ✅
|
||||||
|
44_Hangman | ✅ | ✅ | ✅ | pascal | ✅ | ✅ | ⬜️ | ✅
|
||||||
|
45_Hello | ⬜️ | ✅ | ✅ | pascal | ✅ | ✅ | ⬜️ | ✅
|
||||||
|
46_Hexapawn | ✅ | ⬜️ | ✅ | pascal | ⬜️ | ✅ | ⬜️ | ✅
|
||||||
|
47_Hi-Lo | ✅ | ✅ | ✅ | pascal | ✅ | ✅ | ✅ | ✅
|
||||||
|
48_High_IQ | ⬜️ | ✅ | ✅ | pascal | ⬜️ | ✅ | ⬜️ | ✅
|
||||||
|
49_Hockey | ⬜️ | ⬜️ | ✅ | pascal | ⬜️ | ⬜️ | ⬜️ | ✅
|
||||||
|
50_Horserace | ⬜️ | ⬜️ | ✅ | pascal | ⬜️ | ✅ | ⬜️ | ✅
|
||||||
|
51_Hurkle | ✅ | ✅ | ✅ | pascal | ✅ | ✅ | ✅ | ✅
|
||||||
|
52_Kinema | ⬜️ | ✅ | ✅ | pascal | ✅ | ✅ | ✅ | ✅
|
||||||
|
53_King | ⬜️ | ⬜️ | ✅ | pascal | ⬜️ | ⬜️ | ⬜️ | ✅
|
||||||
|
54_Letter | ✅ | ✅ | ✅ | pascal | ✅ | ✅ | ✅ | ✅
|
||||||
|
55_Life | ✅ | ✅ | ✅ | pascal | ✅ | ✅ | ✅ | ✅
|
||||||
|
56_Life_for_Two | ⬜️ | ⬜️ | ✅ | pascal | ⬜️ | ⬜️ | ⬜️ | ✅
|
||||||
|
57_Literature_Quiz | ✅ | ✅ | ✅ | pascal | ✅ | ✅ | ⬜️ | ✅
|
||||||
|
58_Love | ✅ | ✅ | ✅ | pascal | ✅ | ✅ | ✅ | ✅
|
||||||
|
59_Lunar_LEM_Rocket | ⬜️ | ⬜️ | ✅ | pascal | ⬜️ | ✅ | ⬜️ | ✅
|
||||||
|
60_Mastermind | ✅ | ⬜️ | ✅ | pascal | ✅ | ✅ | ⬜️ | ✅
|
||||||
|
61_Math_Dice | ✅ | ✅ | ✅ | pascal | ✅ | ✅ | ✅ | ✅
|
||||||
|
62_Mugwump | ✅ | ✅ | ✅ | pascal | ✅ | ✅ | ⬜️ | ✅
|
||||||
|
63_Name | ✅ | ✅ | ✅ | pascal | ✅ | ✅ | ⬜️ | ✅
|
||||||
|
64_Nicomachus | ⬜️ | ✅ | ✅ | pascal | ✅ | ✅ | ⬜️ | ✅
|
||||||
|
65_Nim | ⬜️ | ⬜️ | ✅ | pascal | ⬜️ | ✅ | ✅ | ✅
|
||||||
|
66_Number | ✅ | ✅ | ✅ | pascal | ✅ | ✅ | ⬜️ | ✅
|
||||||
|
67_One_Check | ⬜️ | ✅ | ✅ | pascal | ✅ | ✅ | ⬜️ | ✅
|
||||||
|
68_Orbit | ⬜️ | ✅ | ✅ | pascal | ✅ | ✅ | ⬜️ | ✅
|
||||||
|
69_Pizza | ✅ | ✅ | ✅ | pascal | ✅ | ✅ | ⬜️ | ✅
|
||||||
|
70_Poetry | ⬜️ | ✅ | ✅ | pascal | ✅ | ✅ | ⬜️ | ✅
|
||||||
|
71_Poker | ⬜️ | ✅ | ✅ | pascal | ⬜️ | ⬜️ | ⬜️ | ✅
|
||||||
|
72_Queen | ⬜️ | ⬜️ | ✅ | pascal | ✅ | ✅ | ⬜️ | ✅
|
||||||
|
73_Reverse | ⬜️ | ✅ | ✅ | pascal | ✅ | ✅ | ✅ | ✅
|
||||||
|
74_Rock_Scissors_Paper | ✅ | ✅ | ✅ | pascal | ✅ | ✅ | ✅ | ✅
|
||||||
|
75_Roulette | ⬜️ | ✅ | ✅ | pascal | ✅ | ✅ | ⬜️ | ✅
|
||||||
|
76_Russian_Roulette | ✅ | ✅ | ✅ | pascal | ✅ | ✅ | ✅ | ✅
|
||||||
|
77_Salvo | ⬜️ | ⬜️ | ✅ | pascal | ⬜️ | ✅ | ⬜️ | ✅
|
||||||
|
78_Sine_Wave | ✅ | ✅ | ✅ | pascal | ✅ | ✅ | ✅ | ✅
|
||||||
|
79_Slalom | ✅ | ✅ | ✅ | pascal | ⬜️ | ✅ | ⬜️ | ✅
|
||||||
|
80_Slots | ⬜️ | ✅ | ✅ | pascal | ✅ | ✅ | ✅ | ✅
|
||||||
|
81_Splat | ✅ | ✅ | ✅ | pascal | ✅ | ✅ | ⬜️ | ✅
|
||||||
|
82_Stars | ✅ | ✅ | ✅ | pascal | ✅ | ✅ | ⬜️ | ✅
|
||||||
|
83_Stock_Market | ✅ | ✅ | ✅ | pascal | ⬜️ | ✅ | ⬜️ | ✅
|
||||||
|
84_Super_Star_Trek | ✅ | ✅ | ✅ | pascal | ⬜️ | ✅ | ⬜️ | ✅
|
||||||
|
85_Synonym | ✅ | ✅ | ✅ | pascal | ✅ | ✅ | ✅ | ✅
|
||||||
|
86_Target | ✅ | ✅ | ✅ | pascal | ⬜️ | ✅ | ⬜️ | ✅
|
||||||
|
87_3-D_Plot | ✅ | ✅ | ✅ | pascal | ✅ | ✅ | ✅ | ✅
|
||||||
|
88_3-D_Tic-Tac-Toe | ✅ | ⬜️ | ✅ | pascal | ⬜️ | ✅ | ⬜️ | ✅
|
||||||
|
89_Tic-Tac-Toe | ⬜️ | ✅ | ✅ | pascal | ✅ | ✅ | ⬜️ | ✅
|
||||||
|
90_Tower | ✅ | ✅ | ✅ | pascal | ✅ | ✅ | ⬜️ | ✅
|
||||||
|
91_Train | ⬜️ | ✅ | ✅ | pascal | ✅ | ✅ | ✅ | ✅
|
||||||
|
92_Trap | ✅ | ✅ | ✅ | pascal | ✅ | ✅ | ✅ | ✅
|
||||||
|
93_23_Matches | ✅ | ✅ | ✅ | pascal | ✅ | ✅ | ⬜️ | ✅
|
||||||
|
94_War | ⬜️ | ✅ | ✅ | pascal | ✅ | ✅ | ✅ | ✅
|
||||||
|
95_Weekday | ✅ | ✅ | ✅ | pascal | ✅ | ✅ | ⬜️ | ✅
|
||||||
|
96_Word | ✅ | ✅ | ✅ | pascal | ✅ | ✅ | ✅ | ✅
|
||||||
@@ -1,6 +1,23 @@
|
|||||||
import os
|
import os
|
||||||
|
from typing import Dict, List
|
||||||
|
|
||||||
lang_pos = {
|
|
||||||
|
def has_implementation(lang: str, file_list: List[str], subdir_list: List[str]) -> bool:
|
||||||
|
if lang == "csharp":
|
||||||
|
return any(file.endswith(".cs") for file in file_list)
|
||||||
|
else:
|
||||||
|
return len(file_list) > 1 or len(subdir_list) > 0
|
||||||
|
|
||||||
|
|
||||||
|
def get_data(root_dir: str = "..") -> List[List[str]]:
|
||||||
|
"""
|
||||||
|
|
||||||
|
Parameters
|
||||||
|
----------
|
||||||
|
root_dir : str
|
||||||
|
The root directory you want to start from.
|
||||||
|
"""
|
||||||
|
lang_pos: Dict[str, int] = {
|
||||||
"csharp": 1,
|
"csharp": 1,
|
||||||
"java": 2,
|
"java": 2,
|
||||||
"javascript": 3,
|
"javascript": 3,
|
||||||
@@ -9,15 +26,10 @@ lang_pos = {
|
|||||||
"python": 6,
|
"python": 6,
|
||||||
"ruby": 7,
|
"ruby": 7,
|
||||||
"vbnet": 8,
|
"vbnet": 8,
|
||||||
}
|
}
|
||||||
|
strings_done: List[List[str]] = []
|
||||||
|
|
||||||
write_string = "# TODO list \n game | csharp | java | javascript | pascal | perl | python | ruby | vbnet \n --- | --- | --- | --- | --- | --- | --- | --- | --- \n"
|
checklist = [
|
||||||
# Set the directory you want to start from
|
|
||||||
rootDir = ".."
|
|
||||||
|
|
||||||
strings_done = []
|
|
||||||
|
|
||||||
checklist = [
|
|
||||||
"game",
|
"game",
|
||||||
"csharp",
|
"csharp",
|
||||||
"java",
|
"java",
|
||||||
@@ -27,14 +39,28 @@ checklist = [
|
|||||||
"python",
|
"python",
|
||||||
"ruby",
|
"ruby",
|
||||||
"vbnet",
|
"vbnet",
|
||||||
]
|
]
|
||||||
|
|
||||||
prev_game = ""
|
ignore_folders = [
|
||||||
|
".git",
|
||||||
|
"00_Utilities",
|
||||||
|
".github",
|
||||||
|
".mypy_cache",
|
||||||
|
".pytest_cache",
|
||||||
|
"00_Alternate_Languages",
|
||||||
|
"00_Common",
|
||||||
|
"buildJvm",
|
||||||
|
"htmlcov",
|
||||||
|
]
|
||||||
|
|
||||||
for dirName, subdirList, fileList in os.walk(rootDir):
|
prev_game = ""
|
||||||
split_dir = dirName.split(os.path.sep)
|
|
||||||
|
|
||||||
if len(split_dir) == 2 and split_dir[1] not in [".git", "00_Utilities"]:
|
for dir_name, subdir_list, file_list in os.walk(root_dir):
|
||||||
|
# split_dir[1] is the game
|
||||||
|
# split_dir[2] is the language
|
||||||
|
split_dir = dir_name.split(os.path.sep)
|
||||||
|
|
||||||
|
if len(split_dir) == 2 and split_dir[1] not in ignore_folders:
|
||||||
if prev_game == "":
|
if prev_game == "":
|
||||||
prev_game = split_dir[1]
|
prev_game = split_dir[1]
|
||||||
checklist[0] = split_dir[1]
|
checklist[0] = split_dir[1]
|
||||||
@@ -54,20 +80,33 @@ for dirName, subdirList, fileList in os.walk(rootDir):
|
|||||||
"vbnet",
|
"vbnet",
|
||||||
]
|
]
|
||||||
prev_game = split_dir[1]
|
prev_game = split_dir[1]
|
||||||
|
elif (
|
||||||
elif len(split_dir) == 3 and split_dir[1] != ".git" and split_dir[2] in lang_pos:
|
len(split_dir) == 3 and split_dir[1] != ".git" and split_dir[2] in lang_pos
|
||||||
if len(fileList) > 1 or len(subdirList) > 0:
|
):
|
||||||
# there is more files than the readme
|
out = (
|
||||||
checklist[lang_pos[split_dir[2]]] = "✅"
|
"✅"
|
||||||
else:
|
if has_implementation(split_dir[2], file_list, subdir_list)
|
||||||
checklist[lang_pos[split_dir[2]]] = "⬜️"
|
else "⬜️"
|
||||||
|
)
|
||||||
|
checklist[lang_pos[split_dir[2]]] = out
|
||||||
|
return strings_done
|
||||||
|
|
||||||
|
|
||||||
sorted_strings = list(
|
def write_file(path: str, strings_done: List[List[str]]) -> None:
|
||||||
|
write_string = (
|
||||||
|
"# TODO list\n"
|
||||||
|
" game | csharp | java | javascript | pascal | perl | python | ruby | vbnet\n"
|
||||||
|
" --- | --- | --- | --- | --- | --- | --- | --- | ---\n"
|
||||||
|
)
|
||||||
|
sorted_strings = list(
|
||||||
map(lambda l: " | ".join(l) + "\n", sorted(strings_done, key=lambda x: x[0]))
|
map(lambda l: " | ".join(l) + "\n", sorted(strings_done, key=lambda x: x[0]))
|
||||||
)
|
)
|
||||||
write_string += "".join(sorted_strings)
|
write_string += "".join(sorted_strings)
|
||||||
|
|
||||||
|
with open(path, "w", encoding="utf-8") as f:
|
||||||
with open("README.md", "w", encoding="utf-8") as f:
|
|
||||||
f.write(write_string)
|
f.write(write_string)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
strings_done = get_data()
|
||||||
|
write_file("TODO.md", strings_done)
|
||||||
|
|||||||
Reference in New Issue
Block a user