From 9e82c9478a8ce483a15f3080adf32f4b59db902e Mon Sep 17 00:00:00 2001 From: Plaza521 <89989298+Plaza521@users.noreply.github.com> Date: Thu, 27 Oct 2022 17:03:11 +0300 Subject: [PATCH] refactor --- frame.py | 10 ++++++---- out.py | 6 ++++++ settings.py | 7 +++++++ 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/frame.py b/frame.py index 2d007b3..a53b321 100644 --- a/frame.py +++ b/frame.py @@ -50,13 +50,15 @@ class Frame: to_str += '│' for elem in line: if elem == SPACE: - to_str += " " + to_str += TT_SPACE elif elem == WALL: - to_str += "██" + to_str += TT_WALL elif elem == FOOD: - to_str += "@@" + to_str += TT_FOOD elif elem == WALL_FOOD: - to_str += "@█" + to_str += TT_WALL_FOOD + elif elem == HEAD: + to_str += TT_HEAD to_str += '│\n' out_string += to_str diff --git a/out.py b/out.py index 365d94b..95fb662 100644 --- a/out.py +++ b/out.py @@ -20,6 +20,12 @@ class Out: width=1, height=1 ) + frame.draw( + x=pl.body[-1].x, y=pl.body[-1].y, + value=HEAD, + width=1, height=1 + ) + if frame.see(pl.food.x, pl.food.y) == WALL: frame.draw( x=pl.food.x, y=pl.food.y, diff --git a/settings.py b/settings.py index 4d53acc..5e8dd4e 100644 --- a/settings.py +++ b/settings.py @@ -25,3 +25,10 @@ SPACE = 0 WALL = 1 FOOD = 2 WALL_FOOD = 3 +HEAD = 4 + +TT_SPACE = " " +TT_WALL = "██" +TT_FOOD = "@@" +TT_WALL_FOOD = "@█" +TT_HEAD = "██"