import random, os, time
again = "yes"
def sided(n1, n2):
  n1 = random.randint(1, n1)
  n2 = random.randint(1, n2)
  n3 = n1 * n2
  return n3
def health():
  n1 = sided(6, 12) / 2 + 10
  return n1
def srtength():
  n1 = sided(6, 12) / 2 + 12
  return n1
def kill(h, s):
  return h - s
os.system("clear")
print("Role-playing game")
uname1 = input("Enter the name of the character: \n")
utype1 = input("Enter the character attribute (human, elf, wizard, orc)\n")
health1 = health()
srtength1 = srtength()
print("Health: ", health1)
print("Strength: ", srtength1)
uname2 = input("Who is its opponent? \n")
utype2 = input("Enter the character attribute (human, elf, wizard, orc)\n")
health2 = health()
srtength2 = srtength()
print("Health: ", health2)
print("Strength: ", srtength2)
time.sleep(3)
os.system("clear")
print("Battle time!")
health0 = 1
i = 1
while health0 >= 0:
  time.sleep(1)
  sided1 = sided(1, 12)
  sided2 = sided(1, 12)
  if sided1 > sided2:
    print(uname1, "rolled", sided1, "points")
    print(uname2, "rolled", sided2, "points")
    health0 = kill(health2, srtength1)
    health2 = health0
    print(sided1, "won round", i, "and dealt", srtength1, "points of damage to", uname2,
          uname2, "has", health0, "health points left")
    if health0 < 0:
      print(uname1, "wins the final victory!")
      break
    i += 1
  elif sided2 > sided1:
    print(uname1, "rolled", sided1, "points")
    print(uname2, "rolled", sided2, "points")
    print(uname2, "won round", i, "and dealt", srtength2, "points of damage to", uname1,
          uname1, "has", health0, "health points left")
    health0 = kill(health1, srtength2)
    health1 = health0
    if health0 < 0:
      print(uname2, "wins the final victory!")
      break
    i += 1
  else:
    print(uname1, "rolled", sided1, "points")
    print(uname2, "rolled", sided2, "points")
    print("They tied this round. Let's go again!")
    print("---")
    i += 1
    continue