Legends of Code & Magic - Puzzle discussion

Feel free to send your feedback or ask some help here! :game_die:

1 Like

The forum link on the sidebar of the IDE links to https://www.codingame.com/forum/t//t/legends-of-code-magic-puzzle-discussion/54294
That’s wrong and leads to nowhere.

1 Like

Fixed :slight_smile:

For anyone trying to reuse contest code:

  • First two input lines have an extra int on the end (card draw)
  • Third line has an extra int on the end (number of opponent actions)
  • Then there are is a line for each opponentaction - these are slightly awkward to parse if you aren’t reading entire lines in as they can have 3 or 4 fields.I’m just reading the entire line as a string and ignoring for now.
  • After that all inputs are the same as the contest (number of cards, then lines of card details).

According to my preliminary local self-play testing, and hoping I have no bugs related to changes, my winrate as P1 between contest and multi decreased from 67.5 to 57.8%. So it seems the balance has gotten significantly better as a result of the mana change, though not entirely fixed. It’s also possible the gap can be further closed by adjusting the P2 AI and etc. to the new rule.


The inputs changed but the statement is pretty messy. For example the english statement says First 2 lines: for each player, playerHealth, playerMana, playerDeck and playerRune, but we now have a additional int (playerDraw).

1 Like

I noticed the the list of cards available for the draft is displayed in the viewer at the very beginning of games.

It doesn’t seem to be available in the game inputs though. Am I missing something?


What did you change at your strategy after the extra Mana update?

I didn’t change anything yet…

I notice someting strange in attack resolution :
[Warning] Action is not legal: ATTACK 5 16 : 5 is a Flying Corpse Guzzler(6/6), and 16 is a Giant Louse(2/7).
This action is not performed on it’s summoning turn.
I don’t understand. Does this mean that Creatures with Charge can only attack on summoning turn ?
Or does this mean that Breakthrough creatures must attack opponents with lower defense?

Found it ! We must kill Guard creatures BEFORE attacking others .
This should be written in wood league documentation.

Can someone explain me the scoring system? I’m in bronze league. The BattleMage have a score of 21,95. Is this score reset with league change ? If no, there is something stange, because, 21.95 correspond to mid gold league. There is also another strange.thing : BattleMage score always raise. As I approach this score, it raises, so I can’t defeat it. How this score is computed ? Currently bronze league scores goes from 5,72 to 20,95, silver league goes from 13,77 to 20,48 and gold goes from 14,82 to 30,11, so I think 21,95 for Bronze boss is pretty high according to me.

Don’t compare scores in-between leagues, they’re unrelated and not comparable.
About boss being high, yes that’s an issue, the only solution is to wreck him. When you’re in bronze, it’s definitely doable.


Scores are based on the trueskill algorithm - you get points for winning and lose for losing based on how likely you were to win, so scores are relative to people in your league. The actual value of the score doesn’t really mean anything, it’s only useful for comparing two people in the same league.


That input update post was a super helpful! Thanks, @RoboStac! :sunglasses:

Does anyone have any good tips for pushing to silver league?

1 Like

here: https://www.codingame.com/forum/t/legends-of-code-magic-cc05-feedback-strategies/50996

Thanks dude. I spend an hour trying to find where my timeout came from before reading this…

Hi, I’m incredibly lost. What do I target to view my hand? I know the ‘location’ will equal 0 but I can’t for the life of me figure out where/what I’m supposed to search.

Do I make an array while drafting? If so, how do I grab those cards?

It seems like the only things I have access to are integers and 1 string (abilities). I’m sorry if this is a dumb question this is only my second game on here.

Hey !
You will receive the visible cards list each turn (board + your hand) in the form of integers and strings. It belong to you to sort and store them in the form you prefer.

1 Like

I’m coding in Javascript.

I’m having a hard time with understanding the inputs for this puzzle. Beginning from the default-start code, if I add console.error(cardNumber), it isn’t defined. Presumably, this is because it’s the property of given card that I need to “target” somehow to get information about it.

If I add instead console.error(inputs), I’m only seeing information on the right-most card in the draft, and then, during the Battle Phase, the right-most card in my hand.

How am I to get information on the whole board?