diff --git a/Day 5/Issue 22/Priyanshu/main.py b/Day 5/Issue 22/Priyanshu/main.py new file mode 100644 index 0000000..ee1f08a --- /dev/null +++ b/Day 5/Issue 22/Priyanshu/main.py @@ -0,0 +1,228 @@ +import datetime + +def github_text_contributions(text, start_date): + # github contirbution grid size + rows, cols = 7, 52 + grid = [[0] * cols for _ in range(rows)] + + char_maps = { + 'A': [ + [0,1,1,1,0], + [1,0,0,0,1], + [1,1,1,1,1], + [1,0,0,0,1], + [1,0,0,0,1] + ], + 'B': [ + [1,1,1,1,0], + [1,0,0,0,1], + [1,1,1,1,0], + [1,0,0,0,1], + [1,1,1,1,0] + ], + 'C': [ + [0,1,1,1,0], + [1,0,0,0,1], + [1,0,0,0,0], + [1,0,0,0,1], + [0,1,1,1,0] + ], + 'D': [ + [1,1,1,1,0], + [1,0,0,0,1], + [1,0,0,0,1], + [1,0,0,0,1], + [1,1,1,1,0] + ], + 'E': [ + [1,1,1,1,1], + [1,0,0,0,0], + [1,1,1,1,0], + [1,0,0,0,0], + [1,1,1,1,1] + ], + 'F': [ + [1,1,1,1,1], + [1,0,0,0,0], + [1,1,1,1,0], + [1,0,0,0,0], + [1,0,0,0,0] + ], + 'G': [ + [0,1,1,1,0], + [1,0,0,0,0], + [1,0,1,1,1], + [1,0,0,0,1], + [0,1,1,1,0] + ], + 'H': [ + [1,0,0,0,1], + [1,0,0,0,1], + [1,1,1,1,1], + [1,0,0,0,1], + [1,0,0,0,1] + ], + 'I': [ + [1,1,1,1,1], + [0,0,1,0,0], + [0,0,1,0,0], + [0,0,1,0,0], + [1,1,1,1,1] + ], + 'J': [ + [0,0,0,0,1], + [0,0,0,0,1], + [0,0,0,0,1], + [1,0,0,0,1], + [0,1,1,1,0] + ], + 'K': [ + [1,0,0,0,1], + [1,0,0,1,0], + [1,1,1,0,0], + [1,0,0,1,0], + [1,0,0,0,1] + ], + 'L': [ + [1,0,0,0,0], + [1,0,0,0,0], + [1,0,0,0,0], + [1,0,0,0,0], + [1,1,1,1,1] + ], + 'M': [ + [1,0,0,0,1], + [1,1,0,1,1], + [1,0,1,0,1], + [1,0,0,0,1], + [1,0,0,0,1] + ], + 'N': [ + [1,0,0,0,1], + [1,1,0,0,1], + [1,0,1,0,1], + [1,0,0,1,1], + [1,0,0,0,1] + ], + 'O': [ + [0,1,1,1,0], + [1,0,0,0,1], + [1,0,0,0,1], + [1,0,0,0,1], + [0,1,1,1,0] + ], + 'P': [ + [1,1,1,1,0], + [1,0,0,0,1], + [1,1,1,1,0], + [1,0,0,0,0], + [1,0,0,0,0] + ], + 'Q': [ + [0,1,1,1,0], + [1,0,0,0,1], + [1,0,1,0,1], + [1,0,0,1,0], + [0,1,1,0,1] + ], + 'R': [ + [1,1,1,1,0], + [1,0,0,0,1], + [1,1,1,1,0], + [1,0,0,1,0], + [1,0,0,0,1] + ], + 'S': [ + [0,1,1,1,0], + [1,0,0,0,0], + [0,1,1,1,0], + [0,0,0,0,1], + [0,1,1,1,0] + ], + 'T': [ + [1,1,1,1,1], + [0,0,1,0,0], + [0,0,1,0,0], + [0,0,1,0,0], + [0,0,1,0,0] + ], + 'U': [ + [1,0,0,0,1], + [1,0,0,0,1], + [1,0,0,0,1], + [1,0,0,0,1], + [0,1,1,1,0] + ], + 'V': [ + [1,0,0,0,1], + [1,0,0,0,1], + [1,0,0,0,1], + [0,1,0,1,0], + [0,0,1,0,0] + ], + 'W': [ + [1,0,0,0,1], + [1,0,0,0,1], + [1,0,1,0,1], + [1,0,1,0,1], + [0,1,0,1,0] + ], + 'X': [ + [1,0,0,0,1], + [0,1,0,1,0], + [0,0,1,0,0], + [0,1,0,1,0], + [1,0,0,0,1] + ], + 'Y': [ + [1,0,0,0,1], + [0,1,0,1,0], + [0,0,1,0,0], + [0,0,1,0,0], + [0,0,1,0,0] + ], + 'Z': [ + [1,1,1,1,1], + [0,0,0,1,0], + [0,0,1,0,0], + [0,1,0,0,0], + [1,1,1,1,1] + ], + ' ': [ + [0,0,0,0,0], + [0,0,0,0,0], + [0,0,0,0,0], + [0,0,0,0,0], + [0,0,0,0,0] + ] + } + + x, y = 1, 1 # Start position + for char in text.upper(): + if char in char_maps: + char_map = char_maps[char] + for i in range(5): + for j in range(5): + if y + j < cols: + grid[x + i][y + j] = char_map[i][j] + y += 6 + + contribute_dates = [] + for i in range(rows): + for j in range(cols): + if grid[i][j] == 1: + days_to_add = i + j * 7 + contribute_date = start_date + datetime.timedelta(days=days_to_add) + contribute_dates.append(contribute_date.strftime("%Y-%m-%d")) + + return contribute_dates + +# Example usage +start_date = datetime.date.today() # A Sunday + +text = input("Enter text to be displayed\n") +text = text.upper() +dates = github_text_contributions(text, start_date) +print("Contribute on these dates:") +for date in dates: + print(date) \ No newline at end of file