Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- import sys
- import math
- def idebug(*args):
- # return
- print(*args, file=sys.stderr, flush=True)
- def debug(*args):
- # return
- print(*args, file=sys.stderr, flush=True)
- def init_game_tester():
- global width, height, my_id, map
- width, height, my_id = 15, 15, 0
- map = [['.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.'],
- ['.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.'],
- ['.', '.', '.', '.', '.', '.', 'x', 'x', '.', '.', '.', '.', '.', 'x', 'x'],
- ['.', '.', '.', '.', '.', '.', 'x', 'x', '.', '.', '.', '.', '.', 'x', 'x'],
- ['.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.'],
- ['.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.'],
- ['.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.'],
- ['.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.'],
- ['.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.'],
- ['.', '.', '.', '.', '.', '.', '.', 'x', 'x', 'x', 'x', '.', '.', '.', '.'],
- ['.', '.', '.', '.', '.', '.', '.', 'x', 'x', 'x', 'x', 'x', '.', 'x', 'x'],
- ['.', '.', '.', '.', '.', '.', '.', 'x', 'x', 'x', 'x', 'x', '.', 'x', 'x'],
- ['.', '.', '.', '.', '.', '.', '.', '.', '.', 'x', 'x', 'x', '.', '.', '.'],
- ['x', 'x', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.'],
- ['x', 'x', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.']]
- def init_game():
- global width, height, my_id, map, history, sea
- width, height, my_id = [int(i) for i in input().split()]
- idebug(width, height, my_id)
- map = []
- for i in range(height):
- line = input()
- idebug(line)
- map.append(list(line))
- idebug(map)
- sea = [(x, y) for x in range(width) for y in range(height) if map[x][y] == '.']
- x, y = random.choice(sea)
- history = [(x, y)]
- print(f'{x} {y}')
- def do_turn():
- line = input()
- idebug(line)
- x, y, my_life, opp_life, torpedo_cooldown, sonar_cooldown, silence_cooldown, mine_cooldown = [int(i) for i in line.split()]
- sonar_result = input()
- idebug(sonar_result)
- opponent_orders = input()
- idebug(opponent_orders)
- '''
- 1 - Read opponent orders:
- MOVE N
- MOVE N | TORPEDO x y
- SURFACE n
- '''
- # opponent_orders = 'MOVE N'
- # opponent_orders = 'MOVE N | TORPEDO 3 5'
- op_orders = [order.strip() for order in opponent_orders.split('|')]
- debug(f'op_orders: {op_orders}')
- print("MOVE N TORPEDO")
- if __name__ == '__main__':
- init_game()
- # init_game_tester()
- # game loop
- while True:
- do_turn()
- # debug('Tester')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement