(m: list[list[tuple[str,int]]], r: int, c: int, enemy: str)
| 19 | return None |
| 20 | |
| 21 | def get_target(m: list[list[tuple[str,int]]], r: int, c: int, enemy: str) -> tuple[int,int] | None: |
| 22 | minhp, rt, ct = 1000, None, None |
| 23 | for rr,cc in [(r-1,c),(r,c-1),(r,c+1),(r+1,c)]: |
| 24 | if m[rr][cc][0] == enemy and m[rr][cc][1] < minhp: |
| 25 | minhp,rt,ct = m[rr][cc][1],rr,cc |
| 26 | return (rt,ct) if rt and ct else None |
| 27 | |
| 28 | def step(m: list[list[tuple[str,int]]], dmg: dict[str,int]): |
| 29 | moved = set() |