mirror of
https://github.com/coding-horror/basic-computer-games.git
synced 2025-12-22 07:10:42 -08:00
Sorted table
This commit is contained in:
@@ -10,6 +10,8 @@ write_string = "# TODO list \n game | csharp | java | javascript | pascal | perl
|
|||||||
# Set the directory you want to start from
|
# Set the directory you want to start from
|
||||||
rootDir = '..'
|
rootDir = '..'
|
||||||
|
|
||||||
|
strings_done = []
|
||||||
|
|
||||||
checklist = ["game", "csharp", "java", "javascript",
|
checklist = ["game", "csharp", "java", "javascript",
|
||||||
"pascal", "perl", "python", "ruby", "vbnet"]
|
"pascal", "perl", "python", "ruby", "vbnet"]
|
||||||
|
|
||||||
@@ -25,7 +27,7 @@ for dirName, subdirList, fileList in os.walk(rootDir):
|
|||||||
|
|
||||||
if prev_game != split_dir[1]:
|
if prev_game != split_dir[1]:
|
||||||
# it's a new dir
|
# it's a new dir
|
||||||
write_string += " | ".join(checklist) + "\n"
|
strings_done.append(checklist)
|
||||||
checklist = [split_dir[1], "csharp", "java", "javascript",
|
checklist = [split_dir[1], "csharp", "java", "javascript",
|
||||||
"pascal", "perl", "python", "ruby", "vbnet"]
|
"pascal", "perl", "python", "ruby", "vbnet"]
|
||||||
prev_game = split_dir[1]
|
prev_game = split_dir[1]
|
||||||
@@ -39,5 +41,10 @@ for dirName, subdirList, fileList in os.walk(rootDir):
|
|||||||
checklist[lang_pos[split_dir[2]]] = "⬜️"
|
checklist[lang_pos[split_dir[2]]] = "⬜️"
|
||||||
|
|
||||||
|
|
||||||
|
sorted_strings = list(map(lambda l: " | ".join(l) + "\n",
|
||||||
|
sorted(strings_done, key=lambda x: x[0])))
|
||||||
|
write_string += ''.join(sorted_strings)
|
||||||
|
|
||||||
|
|
||||||
with open("README.md", "w") as f:
|
with open("README.md", "w") as f:
|
||||||
f.write(write_string)
|
f.write(write_string)
|
||||||
|
|||||||
Reference in New Issue
Block a user