From 29d9de615a291431e5d4cfb97cc5e0326ee6cd6e Mon Sep 17 00:00:00 2001 From: ennucore Date: Mon, 20 Sep 2021 09:56:41 +0300 Subject: [PATCH] saving font --- turtle_2/font.json | 1 + turtle_2/task_2.py | 14 ++------------ 2 files changed, 3 insertions(+), 12 deletions(-) create mode 100644 turtle_2/font.json diff --git a/turtle_2/font.json b/turtle_2/font.json new file mode 100644 index 0000000..1cabe75 --- /dev/null +++ b/turtle_2/font.json @@ -0,0 +1 @@ +{"0": [[0, 0], [1, 0], [1, 1], [1, 2], [0, 2], [0, 1], [0, 0]], "1": [[0, 1], [1, 0], [1, 1], [1, 2]], "2": [[0, 0], [1, 0], [1, 1], [0, 2], [1, 2]], "3": [[0, 0], [1, 0], [0, 1], [1, 1], [0, 2]], "4": [[0, 0], [0, 1], [1, 1], [1, 0], [1, 2]], "5": [[1, 0], [0, 0], [0, 1], [1, 1], [1, 2], [0, 2]], "6": [[1, 0], [0, 1], [1, 1], [1, 2], [0, 2], [0, 1]], "7": [[0, 0], [1, 0], [0, 1], [0, 2]], "8": [[0, 0], [1, 0], [1, 1], [0, 1], [0, 2], [1, 2], [1, 1], [0, 1], [0, 0]], "9": [[0, 0], [1, 0], [1, 1], [0, 2], [1, 1], [0, 1], [0, 0]]} \ No newline at end of file diff --git a/turtle_2/task_2.py b/turtle_2/task_2.py index aa1da69..c5abbab 100644 --- a/turtle_2/task_2.py +++ b/turtle_2/task_2.py @@ -1,20 +1,10 @@ import turtle as t import typing import math +import json -DATA: typing.Dict[str, typing.List[typing.Tuple[int, int]]] = { - '0': [(0, 0), (1, 0), (1, 1), (1, 2), (0, 2), (0, 1), (0, 0)], - '1': [(0, 1), (1, 0), (1, 1), (1, 2)], - '2': [(0, 0), (1, 0), (1, 1), (0, 2), (1, 2)], - '3': [(0, 0), (1, 0), (0, 1), (1, 1), (0, 2)], - '4': [(0, 0), (0, 1), (1, 1), (1, 0), (1, 2)], - '5': [(1, 0), (0, 0), (0, 1), (1, 1), (1, 2), (0, 2)], - '6': [(1, 0), (0, 1), (1, 1), (1, 2), (0, 2), (0, 1)], - '7': [(0, 0), (1, 0), (0, 1), (0, 2)], - '8': [(0, 0), (1, 0), (1, 1), (0, 1), (0, 2), (1, 2), (1, 1), (0, 1), (0, 0)], - '9': [(0, 0), (1, 0), (1, 1), (0, 2), (1, 1), (0, 1), (0, 0)] - } +DATA: typing.Dict[str, typing.List[typing.Tuple[int, int]]] = json.loads(open('font.json').read()) DIGIT_SIZE = 25