Winter Challenge 2024 - Feedback and Strategies

Hi all,

How did you make it through the 4th boss? I get the basics, I build a sporer, shoot at the A shaped thing. The A thing turns into a root and then I grow, but at the end I end up with the same amount of points like the boss and no resources left.

This question has already been raised (by @Dadacticiel) and resolved (by @Dadacticiel and @Rokerjea) in the thread. Here is a recap of the discussion:

Cheers.

1 Like

I ask again : whatā€™s wrong with my code ?

import sys
import math
from random import randint
width, height = [int(i) for i in input().split()]
def next_to(pos1,pos2):
| |if (pos1[0]==pos2[0] and abs(pos1[1]-pos2[1])==1) or (pos1[1]==pos2[1] and abs(pos1[0]-pos2[0])==1):
| | |return True
| |else:
| | |return False
def diagonal(pos1,pos2):
| |if abs(pos1[0]-pos2[0]) * abs(pos1[1]-pos2[1])==1:
| | |return True
| |else:
| | |return False
def close_to(pos1,pos2):
| |if abs(pos1[0]-pos2[0]) * abs(pos1[1]-pos2[1])<4 and abs(pos1[0]-pos2[0])<3 and abs(pos1[1]-pos2[1])<3:
| | |return True
| |else:
| | |return False
dir=ā€œNā€
def analysis(_root,thing,organism):
| |if (organism==ā€œHARVESTERā€ and my_c * my_d>0) or (organism==ā€œTENTACLEā€ and my_b * my_c>0):
| | |enough=True
| |else:
| | |enough=False
| | |return ā€œnothingā€
| |for i in thing:
| | |for j in _root:
| | | |if close_to(j[1],i)==True and enough==True:
| | | | |typ=organism
| | | | |if diagonal[i,j]==True:
| | | | | |liste=[i[0],i[1],j[0]]
| | | | | |if i[1]>j[1][1]:
| | | | | | |dir=ā€˜Eā€™
| | | | | |elif i[1]<j[1][1]:
| | | | | | |dir=ā€˜Wā€™
| | | | | |if i[0]>j[1][0]:
| | | | | | |liste[0]-=1
| | | | | |elif i[0]<j[1][0]:
| | | | | | |liste[0]+=1
| | | | |elif i[0]-j[1][0]==0:
| | | | | |if i[1]-j[1]>0:
| | | | | | |liste[1]-=1
| | | | | |else:
| | | | | | |liste[1]+=1
| | | | |elif i[1]-j[1][1]==0:
| | | | | |if i[0]-j[0]>0:
| | | | | | |liste[0]-=1
| | | | | |else:
| | | | | | |liste[0]+=1

game loop

while True:
| |positions=[]
| |proteins=[]
| |enemy=[]
| |walls=[]
| |organs={}
| |my_roots=[]
| |entity_count = int(input())
| |for i in range(entity_count):
| | |inputs = input().split()
| | |x = int(inputs[0])
| | |y = int(inputs[1])
| | |_type = inputs[2]
| | |owner = int(inputs[3])
| | |organ_id = int(inputs[4])
| | |organ_dir = inputs[5]
| | |organ_parent_id = int(inputs[6])
| | |organ_root_id = int(inputs[7])
| | |if _type==ā€˜Aā€™ or _type==ā€˜Bā€™ or _type==ā€˜Cā€™ or _type==ā€˜Dā€™:
| | | | |proteins.append([x,y])
| | |elif _type==ā€œWALLā€:
| | | | |walls.append([x,y])
| | |elif owner==0:
| | | |enemy.append([x,y])
| | |elif owner==1:
| | | |positions.append([x,y])
| | | |if organ_root_id in organs:
| | | | |l=[]
| | | | |l.append(organs[organ_root_id])
| | | | |l.append(organ_id)
| | | | |l.append([x,y])
| | | | |organs[organ_root_id]=l
| | | |else:
| | | | |organs[organ_root_id]=organ_id
| | | | |my_roots.append([organ_id,[x,y]])
| |my_a, my_b, my_c, my_d = [int(i) for i in input().split()]
| |opp_a, opp_b, opp_c, opp_d = [int(i) for i in input().split()]
| |required_actions_count = int(input()) # your number of organisms, output an action for each one in any order
| |for i in range(required_actions_count):
| | |if len(positions)==1:
| | | |print(ā€œGROWā€,1,positions[0][0],positions[0][0]+2,ā€œSPORERā€,ā€œEā€)
| | |elif len(positions)==2:
| | | |print(ā€œSPOREā€,3,positions[1][0]+13,positions[1][1])
| | |else:
| | | |if my_a==0 and i+1<required_actions_count:
| | | | |print(ā€œWAITā€)
| | | |else:
| | | | |liste=[randint(1,width-1),randint(1,height-1)]
| | | |print(organs,file=sys.stderr,flush=True)
| | | |while (liste in positions) or (liste in enemy) or (liste in walls):
| | | | |liste=[randint(1,width-1),randint(1,height-1)]
| | | |if my_a>0:
| | | | |typ=ā€œBASICā€
| | | |elif my_b*my_c>0:
| | | | |typ=ā€œTENTACLEā€
| | | |else:
| | | | |typ=ā€œHARVESTERā€
| | | | |thing_that_dont_work_else=my_roots[i]
| | | | |organ_group=organs[thing_that_dont_work_else]
| | | | |analysis(organ_group,enemy,ā€œTENTACLEā€)
| | | | |analysis(organ_group,proteins,ā€œHARVESTERā€)
| | | | |print(ā€œGROWā€,my_roots[i],liste[0],liste[1],typ,dir,ā€œslimy soundsā€)

I did it but Iā€™m still stuck in wood 1 league. Every times I get a score of 12 (and 0 proteins) like the boss. I did create harvester too but Iā€™m still in wood 1ā€¦ :frowning: . What do I miss?

Is your harvester harvesting the protein A, thus allowing you to create plenty of BASIC organs ?

Thanks yhurbrla, but itā€™s impossible. In wood 1 league you start with only 6 A protein, and the A protein is 15 cells away. Itā€™s impossible to reach it and harvest it in wood 1 league.

Thatā€™s why you must make a sporer, I guess

Here is the explicit solution to beat that one tricky puzzle in wood 1 league.

  1. Build sporer next to root organ, aiming towards A protein.
  2. Shoot sporer as to build new root close to A protein.
  3. Build harvester next to A protein in order to harvest it.
  4. Fill grid with BASIC organs.

Best of luck in the silver league.

1 Like

Oh thanks, I was misundertanding!! I thought it was necessary to shoot the protein to cerate a new organ! So what I missed is that it is possible to create a new organ with a spore at any place in the direction of the sporer.
Thanks @yhuberla

1 Like

When I try to grow a spore at the first turn, it fails with an error message: ((23,1)) is not to the E of ((0,1)). Is it a bug?

Hello, this should now be fixed.

Hello, you cannot spore there because a wall is in the way. The error message is wrong, this is now fixed:
image

Hello, I have a strange error message telling me that I havenā€™t read all the input before writing on the output. I know itā€™s false because if I disable my current function and use another that also writes on the output I donā€™t get it anymore. Someone has suggested that it might be because the game runs out of time but the function in question runs very fast.
It might be linked to a bug I sometimes have when what is written on the output is what I wrote last turn, again. I log on the error output at the same time so I know what I actually sent. Since I canā€™t grow on the same place twice it makes me lose turns and makes me fall behind the AI.
Anyone knows what could trigger this behavior please? In the meantime Iā€™m trying to figure out in my function what makes the engine so mad.

The line that causes the error to appear is when I poll a member Queue. Iā€™m not even iterating on it, but the engine freaks out if I poll it, remove a component from it. I tried replacing it by an ArrayList and itā€™s the same. Itā€™s not static either. I have no idea why I canā€™t reduce this collection. I can try some ugly work around I guess, but if someone knows what the matter is Iā€™m very interested to know please.

The engineā€™s logic is that if I look at whatā€™s in my queue I can never ever poll it afterward. I tried to create a fresh new object and only interact with it, but it didnā€™t work. This simplified code shows what causes that error (and makes me lose unfairly):
Queue< a > queueCopy = new Queue < > (mainQueue.peek());
// I do operations on queueCopy and need to remove it afterward
mainQueue.poll()