Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- inp = open("input.txt", "r")
- l, r, e = map(int, inp.read().split())
- inp.close()
- n = 0
- for i in range(l):
- n += r + e + 1 - i
- n = (n - 1) * 2 + 1
- row = ["."] * n
- mas = []
- for i in range(n):
- mas.append(row.copy())
- def just_a_recursion(x, y, l, r, e, dir = "all"):
- if l == 0:
- return
- if mas[y][x] != ".":
- mas[y][x] = "x"
- else:
- mas[y][x] = "*"
- for i in range(1, r + e + 1):
- if dir != "right" and mas[y][x + i] != ".":
- mas[y][x + i] = "x"
- elif dir != "right":
- mas[y][x + i] = "-"
- if dir != "left" and mas[y][x - i] != ".":
- mas[y][x - i] = "x"
- elif dir != "left":
- mas[y][x - i] = "-"
- if dir != "down" and mas[y + i][x] != ".":
- mas[y + i][x] = "x"
- elif dir != "down":
- mas[y + i][x] = "|"
- if dir != "up" and mas[y - i][x] != ".":
- mas[y - i][x] = "x"
- elif dir != "up":
- mas[y - i][x] = "|"
- for i in range(1, r + 1):
- if mas[y + i][x + i] != ".":
- mas[y + i][x + i] = "x"
- else:
- mas[y + i][x + i] = "\\"
- if mas[y - i][x - i] != ".":
- mas[y - i][x - i] = "x"
- else:
- mas[y - i][x - i] = "\\"
- if mas[y - i][x + i] != ".":
- mas[y - i][x + i] = "x"
- else:
- mas[y - i][x + i] = "/"
- if mas[y + i][x - i] != ".":
- mas[y + i][x - i] = "x"
- else:
- mas[y + i][x - i] = "/"
- if dir == "down":
- just_a_recursion(x + r + e + 1, y, l - 1, r - 1, e, "left")
- just_a_recursion(x - r - e - 1, y, l - 1, r - 1, e, "right")
- just_a_recursion(x, y - r - e - 1, l - 1, r - 1, e, "down")
- elif dir == "left":
- just_a_recursion(x + r + e + 1, y, l - 1, r - 1, e, "left")
- just_a_recursion(x, y + r + e + 1, l - 1, r - 1, e, "up")
- just_a_recursion(x, y - r - e - 1, l - 1, r - 1, e, "down")
- elif dir == "up":
- just_a_recursion(x + r + e + 1, y, l - 1, r - 1, e, "left")
- just_a_recursion(x, y + r + e + 1, l - 1, r - 1, e, "up")
- just_a_recursion(x - r - e - 1, y, l - 1, r - 1, e, "right")
- elif dir == "right":
- just_a_recursion(x, y + r + e + 1, l - 1, r - 1, e, "up")
- just_a_recursion(x - r - e - 1, y, l - 1, r - 1, e, "right")
- just_a_recursion(x, y - r - e - 1, l - 1, r - 1, e, "down")
- else:
- just_a_recursion(x + r + e + 1, y, l - 1, r - 1, e, "left")
- just_a_recursion(x, y + r + e + 1, l - 1, r - 1, e, "up")
- just_a_recursion(x - r - e - 1, y, l - 1, r - 1, e, "right")
- just_a_recursion(x, y - r - e - 1, l - 1, r - 1, e, "down")
- just_a_recursion(n//2, n//2, l, r, e)
- out = open("output.txt", "w")
- newline = "\n"
- for i in range(n):
- if i == n-1: newline = ""
- line = ""
- for j in mas[i]:
- line += j
- out.write(line + newline)
- out.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement