File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed
Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change 1+ def result_to_pattern (result : str ) -> str :
2+ """
3+ Convert a result string to a human-readable pattern of symbols.
4+
5+ This function maps each character in a result string to a corresponding colored square
6+ symbol.
7+ - The character '0' maps to a dark grey square symbol,
8+ - The character '1' maps to a yellow square symbol and,
9+ - The character '2' maps to a green square symbol.
10+ The output is a string composed of UTF-8 colored square symbols.
11+
12+ Parameters:
13+ result (str): a string consisting only of the '0', '1' or '2' characters.
14+
15+ Returns:
16+ str: The corresponding human-readable string pattern composed of UTF-8 colored symbols.
17+
18+ Example:
19+ >>> result_to_pattern("01102")
20+ Output: "⬛🟨🟨⬛🟩"
21+ >>> result_to_pattern("0001221")
22+ Output: "⬛⬛⬛🟨🟩🟩🟨"
23+
24+ """
25+
26+ # print("\u2B1B") # ⬛ grey square
27+ # print("\U0001F7E8") # 🟨 yellow square
28+ # print("\U0001F7E9") # 🟩 green square
You can’t perform that action at this time.
0 commit comments