main
Plaza521 2022-10-27 17:03:11 +03:00 committed by GitHub
parent 95e1653b1a
commit 9e82c9478a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 4 deletions

View File

@ -50,13 +50,15 @@ class Frame:
to_str += '' to_str += ''
for elem in line: for elem in line:
if elem == SPACE: if elem == SPACE:
to_str += " " to_str += TT_SPACE
elif elem == WALL: elif elem == WALL:
to_str += "██" to_str += TT_WALL
elif elem == FOOD: elif elem == FOOD:
to_str += "@@" to_str += TT_FOOD
elif elem == WALL_FOOD: elif elem == WALL_FOOD:
to_str += "@█" to_str += TT_WALL_FOOD
elif elem == HEAD:
to_str += TT_HEAD
to_str += '\n' to_str += '\n'
out_string += to_str out_string += to_str

6
out.py
View File

@ -20,6 +20,12 @@ class Out:
width=1, height=1 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: if frame.see(pl.food.x, pl.food.y) == WALL:
frame.draw( frame.draw(
x=pl.food.x, y=pl.food.y, x=pl.food.x, y=pl.food.y,

View File

@ -25,3 +25,10 @@ SPACE = 0
WALL = 1 WALL = 1
FOOD = 2 FOOD = 2
WALL_FOOD = 3 WALL_FOOD = 3
HEAD = 4
TT_SPACE = " "
TT_WALL = "██"
TT_FOOD = "@@"
TT_WALL_FOOD = "@█"
TT_HEAD = "██"