From f5997021970a2ac6b278a5321430cf74553d0caf Mon Sep 17 00:00:00 2001 From: Alvaro Frias Garay Date: Thu, 6 Jan 2022 13:03:31 -0300 Subject: [PATCH 1/2] Added script to write a markdown TODO list of implementations for games --- 00_Utilities/markdown_todo.py | 43 +++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 00_Utilities/markdown_todo.py diff --git a/00_Utilities/markdown_todo.py b/00_Utilities/markdown_todo.py new file mode 100644 index 00000000..accf1ac2 --- /dev/null +++ b/00_Utilities/markdown_todo.py @@ -0,0 +1,43 @@ +import os + + +lang_pos = { + "csharp": 1, "java": 2, "javascript": 3, + "pascal": 4, "perl": 5, "python": 6, "ruby": 7, "vbnet": 8 +} + +write_string = "# TODO list \n game | csharp | java | javascript | pascal | perl | python | ruby | vbnet \n --- | --- | --- | --- | --- | --- | --- | --- | --- \n" +# Set the directory you want to start from +rootDir = '..' + +checklist = ["game", "csharp", "java", "javascript", + "pascal", "perl", "python", "ruby", "vbnet"] + +prev_game = "" + +for dirName, subdirList, fileList in os.walk(rootDir): + split_dir = dirName.split("/") + + if len(split_dir) == 2 and not split_dir[1] in ['.git', '00_Utilities']: + if prev_game == "": + prev_game = split_dir[1] + checklist[0] = split_dir[1] + + if prev_game != split_dir[1]: + # it's a new dir + write_string += " | ".join(checklist) + "\n" + checklist = [split_dir[1], "csharp", "java", "javascript", + "pascal", "perl", "python", "ruby", "vbnet"] + prev_game = split_dir[1] + + elif len(split_dir) == 3 and split_dir[1] != '.git': + if split_dir[2] in lang_pos.keys(): + if len(fileList) > 1 or len(subdirList) > 0: + # there is more files than the readme + checklist[lang_pos[split_dir[2]]] = "✅" + else: + checklist[lang_pos[split_dir[2]]] = "⬜️" + + +with open("README.md", "w") as f: + f.write(write_string) From 08b299b3bb23a22f03dec849d460660a004ce946 Mon Sep 17 00:00:00 2001 From: Alvaro Frias Garay Date: Thu, 6 Jan 2022 13:13:04 -0300 Subject: [PATCH 2/2] Sorted table --- 00_Utilities/markdown_todo.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/00_Utilities/markdown_todo.py b/00_Utilities/markdown_todo.py index accf1ac2..74e358c0 100644 --- a/00_Utilities/markdown_todo.py +++ b/00_Utilities/markdown_todo.py @@ -10,6 +10,8 @@ write_string = "# TODO list \n game | csharp | java | javascript | pascal | perl # Set the directory you want to start from rootDir = '..' +strings_done = [] + checklist = ["game", "csharp", "java", "javascript", "pascal", "perl", "python", "ruby", "vbnet"] @@ -25,7 +27,7 @@ for dirName, subdirList, fileList in os.walk(rootDir): if prev_game != split_dir[1]: # it's a new dir - write_string += " | ".join(checklist) + "\n" + strings_done.append(checklist) checklist = [split_dir[1], "csharp", "java", "javascript", "pascal", "perl", "python", "ruby", "vbnet"] prev_game = split_dir[1] @@ -39,5 +41,10 @@ for dirName, subdirList, fileList in os.walk(rootDir): 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: f.write(write_string)