from collections import namedtuple import sys from enum import Enum from typing import Tuple, List, Optional def idebug(*args): return print(*args, file=sys.stderr, flush=True) def debug(*args): # return print(*args, file=sys.stderr, flush=True) class WeaponDamage(Enum): SWORD = 10 HAMMER = 6 SCYTHE = 7 BOW = 8 class MonsterType(Enum): BOX = 7 SKEL = 8 GARG = 9 ORC = 10 VAMP = 11 class Position: def __init__(self, x, y): self.x, self.y = x, y def __repr__(self): return f'({self.x}, {self.y})' MonsterChar = namedtuple('MonsterChar', ['view_range', 'attack_range', 'damage']) class Monster: pos: Position health: int type: MonsterType monster_char: MonsterChar def __init__(self, x, y, health, etype): self.pos = Position(x, y) self.health = health self.type = MonsterType(etype) self.view_range, self.attack_range, self.damage = self.monster_char.view_range, self.monster_char.attack_range, self.monster_char.damage @property def monster_char(self) -> MonsterChar: match self.type: case MonsterType.BOX: return MonsterChar(0, 0, 0) case MonsterType.SKEL: return MonsterChar(1, 1, 1) case MonsterType.GARG: return MonsterChar(2, 1, 2) case MonsterType.ORC: return MonsterChar(3, 1, 3) case _: return None def __repr__(self): # return f' {self.type}({self.health}) {self.pos} {self.monster_char}' return f'{self.type}({self.health}) {self.pos}' class Hero: def __init__(self, x, y, health, score, charges_hammer, charges_scythe, charges_bow): self.pos = Position(x, y) self.health = health self.score = score self.chargesHammer = charges_hammer self.charges_scythe = charges_scythe self.charges_bow = charges_bow self.view_range = 3 def __repr__(self): return f'{self.pos} {self.health} {self.score} {self.chargesHammer} {self.charges_scythe} {self.charges_bow}' # Make the hero reach the exit of the maze alive. # game loop while True: # x: x position of the hero # y: y position of the hero # health: current health points # score: current score # charges_hammer: how many times the hammer can be used # charges_scythe: how many times the scythe can be used # charges_bow: how many times the bow can be used x, y, health, score, charges_hammer, charges_scythe, charges_bow = [int(i) for i in input().split()] idebug(x, y, health, score, charges_hammer, charges_scythe, charges_bow) visible_entities = int(input()) # the number of visible entities idebug(visible_entities) monsters = [] for i in range(visible_entities): # ex: x position of the entity # ey: y position of the entity # etype: the type of the entity # evalue: value associated with the entity ex, ey, etype, evalue = [int(j) for j in input().split()] idebug(ex, ey, etype, evalue) if etype in range(7, 12): monsters.append(Monster(x=ex, y=ey, etype=etype, health=evalue)) # Write an action using print # To debug: print("Debug messages...", file=sys.stderr, flush=True) for monster in monsters: debug(monster) # MOVE x y [message] | ATTACK weapon x y [message] print("MOVE 6 8 Let's go!")