Winter Challenge 2024 - Feedback and Strategies

What’s wrong with my code ? The analysis function don’t work and my organism try to reach walls sometimes.

import sys
import math
from random import randint
width, height = [int(i) for i in input().split()]
def near_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
dir=“N”
def analysis(thing,organism):
if (organism==“HARVESTER” and my_c * my_d==1) or (organism==“TENTACLE” and my_b *my_c==1):
enough=True
else:
enough=False
for i in thing:
for j in positions:
if diagonal(j,i)==True and enough==True:
typ=organism
liste=[i[0],i[1],j[2]]
if i[1]>j[1]:
dir=‘E’
elif i[1]<j[1]:
dir=‘W’
if i[0]>j[0]:
liste[0]-=1
elif i[0]<j[0]:
liste[0]+=1
while True:
positions=[]
proteins=[]
enemy=[]
walls=[]
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]
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,organ_id])
organ_parent_id = int(inputs[6])
organ_root_id = int(inputs[7])
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):
liste=[randint(1,width-1),randint(1,height-1),1]
while (liste in positions) or (liste in enemy) or (liste in walls):
liste=[randint(1,width-1),randint(2,height-2),1]
if my_a>0:
typ=“BASIC”
analysis(enemy,“TENTACLE”)
analysis(proteins,“HARVESTER”)
print(“GROW”,liste[2],liste[0],liste[1],typ,dir)

is there a way to jump back a league to do some practice? I mean I can use Boss N as an enemy, but I need some seed for “simpler” maps as well; is there any chance to get those?

2 Likes

same need here. I got into wood 1 ater only one game in wood2 without using the tentacle and would like to try it in wood2

i think you can consider the first 4 boss as tutorials to understand how each organ works.

need help, I’m at wood level 1, I beat the boss every time, but I don’t move up to the bronze league, I remain stuck in the places between 7 and 3, I have modified my code, I don’t see what is blocking and how the points are calculated, I currently have a score of 22.64, the one just before me has a score of 23.09 but I don’t see any difference, he wins all his fights also against the boss, who can help me understand, thanks in advance :slight_smile:

It’s the same for me. I don’t understand how beat the boss because the only possibility is to create a TENTACULE but it’s not possible, we have not enough B proteine. One is needed to create the SPORER and second one to create the second ROOT. And you start with only 2 B proteines…

you need to create a harvester next to the protein, not consume it like the boss. Then you just grow BASIC organs until you win

1 Like

thank youuuuu

thx a lot !!!

I saw it in Bronze League

Constraints

Response time per turn ≤ 50ms
Response time for the first turn ≤ 1000ms
16 ≤ width ≤ 24
8 ≤ height ≤ 12

npm -i in src/main/resources, then npm start.
And then launch Main in src/test/java

Why isn’t my code working ? (in python, website don’t show spaces so I arranged this to make it readable, and making you understand how it is on my code)
|def diagonal(pos1,pos2):
| |if abs(pos1[0]-pos2[0]) * abs(pos1[1]-pos2[1])==1:
| | |return True
| |else:
| | |return False
|dir=“N”
|def analysis(thing,organism):
| |if (organism==“HARVESTER” and my_c * my_d==1) or (organism==“TENTACLE” and my_b * my_c==1):
| | |enough=True
| |else:
| | |enough=False
| |for i in thing:
| | |for j in positions:
| | | |if diagonal(j,i)==True and enough==True:
| | | | |typ=organism
| | | | |liste=[i[0],i[1],j[2]]
| | | | |if i[1]>j[1]:
| | | | | |dir=‘E’
| | | | |elif i[1]<j[1]:
| | | | | |dir=‘W’
| | | | |if i[0]>j[0]:
| | | | | |liste[0]-=1
| | | | |elif i[0]<j[0]:
| | | | | |liste[0]+=1

This only checks that my_c and my_d are strictly equal to 1, what you want to check is whether you have at least one of each protein, so you must replace the condition with my_c * my_d >= 1. (Same issue with my_b * my_c == 1 for the tentacle)

Thanks, but it still don’t work. What’s wrong ?

is it normal what happen here at turn 29 ? it creates a wall.

thank you.

Yes, that’s according to the game rules. Two organisms tried to grow an organ in the same square “(6, 2)” and “growth collision” creates a wall, described in “Action order for one turn” in the rules. Note that the same player can also have multiple organisms and a wall is created regardless of whether the organisms attempting growth in same square belong to the same or different players.

2 Likes

How do you make your organism talking ???

Add any text after the command, it will end up in a speech bubble, long text will be cut, e.g.:

print("GROW 1 7 2 BASIC grow basic cell")
1 Like

Bug: When the player’s y-coordinate is 0, the speech bubble/player comment appears outside the border https://imgur.com/a/XBQb28A

2 Likes

Wow, proteins matter!

2024-12-29_12-28

1 Like