Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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):
- self.x, self.y = x, y
- def __repr__(self):
- return f'{self.x} {self.y}'
- class Monster:
- 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 = monsters_caract[self.type]
- 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.
- Caract = namedtuple('MonsterCarac', ['view_range', 'attack_range', 'damage'])
- monsters_caract = {}
- for monster_type in enumerate(MonsterType):
- match monster_type:
- case MonsterType.BOX:
- monsters_caract[monster_type] = Caract(0, 0, 0)
- case MonsterType.SKEL:
- monsters_caract[monster_type] = Caract(1, 1, 1)
- case MonsterType.GARG:
- monsters_caract[monster_type] = Caract(2, 1, 2)
- case MonsterType.ORC:
- monsters_caract[monster_type] = Caract(3, 1, 3)
- # 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)
- 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)
- # Write an action using print
- # To debug: print("Debug messages...", file=sys.stderr, flush=True)
- # MOVE x y [message] | ATTACK weapon x y [message]
- print("MOVE 6 8 Let's go!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement