The challenge doesn’t seems to work in scala, at least the default implementation provided is throwing exceptions
Stub generator problem … You need to replace
- linkcount by linkCount
- entitycount by entityCount
After modification it should work
Thanks Dwarfie, I’m ashamed to have not seen it ^^
I’m struggling with random timeouts in about a third of the runs. It happens against the boss, against other players and also against an older version of my code. Here’s the code in the main loop where I’m reading the inputs:
# game loop while True: # the number of entities (e.g. factories and troops) e_count = int(input()) troop_lst =  print("Start Input", file=sys.stderr) for i in range(e_count): print("Next!", file=sys.stderr) entity_id, entity_type, arg_1, arg_2, arg_3, arg_4, arg_5 = input().split() print("%d/%d:"%(i+1,e_count),entity_id, entity_type, arg_1, arg_2, arg_3, arg_4, arg_5, file=sys.stderr) entity_id, arg_1,arg_2,arg_3,arg_4,arg_5 = int(entity_id), int(arg_1),int(arg_2),int(arg_3),int(arg_4),int(arg_5) if i<f_count: facs[i]=[entity_id,arg_1,arg_2,arg_3,arg_4,arg_5] else: if entity_type == "TROOP": troop_lst.append([entity_id,arg_1,arg_2,arg_3,arg_4,arg_5]) else: bombs = update_bombs(bombs, entity_id, arg_1, arg_2, arg_3, arg_4) print("Finish Input", file=sys.stderr)
While I don’t get an actual error message, it always happens while reading the last input line. My guess is that it’s waiting for a non-existing input, but I can’t think of any reason for such an issue to occur.
Here’s an (shortened) example log:
Standard Error Stream: Start Input Next! 1/24: 0 FACTORY 0 0 0 0 0 Next! 2/24: 1 FACTORY 1 0 1 1 0 Next! 3/24: 2 FACTORY -1 8 2 0 0 [...] Next! 22/24: 67 TROOP -1 2 9 1 1 Next! 23/24: 70 TROOP -1 6 4 6 2 Next! Game information: Timeout: the program did not provide 1 input lines in due time... hasl3r will no longer be active in this game.
### Standard Error Stream: Start Input Next! 1/20: 0 FACTORY 0 0 0 0 0 Next! 2/20: 1 FACTORY 1 2 0 0 0 Next! 3/20: 2 FACTORY -1 0 0 0 0 [...] Next! 17/20: 47 TROOP -1 10 4 3 3 Next! 18/20: 51 TROOP -1 12 10 1 3 Next! 19/20: 52 TROOP -1 12 9 1 12 Next! Game information: Timeout: the program did not provide 1 input lines in due time... hasl3r will no longer be active in this game.
I’d be very grateful if someone could help me with this issue.
Python buffers messages so you are probably getting past where you think you are but not seeing the message.
Change all your stderr prints to print(msg, file=sys.stderr, flush=True) - you’ll probably see you get past the inputs.
how i can calculate the distance between factories?
Le dernier print à la fin de la ligne ne doit pas avoir de ;
Like you said, You ask one more input but have you removed one before ?
factory_count = int(input())
link_count = int(input())
for i in range(link_count):
factory_1, factory_2, distance = [int(j) for j in input().split()]