War (puzzle): order of cards

Hi there!
Just finished the Winamax Challenge, and I got some difficulties understanding the explanation about in which order the algorithm should consider the cards in the deck. First,

Cards are placed face down on top of each deck.

This led me to thinking that at game initialisation, the first card given should be at the bottom and the last at the top (give first card to player, they place it face down on to of their deck, then give second card, they place it on top of first card, an so on…).

for a “war”, all the cards from the first player then all the cards from the second player –

But it doesn’t tell anything about the order of how “all the cards” are to be considered. The given example answers somewhat the question but it is not that easy to grasp…

BTW, big up to the Team, thanks for the great work! :slight_smile:

2 Likes

Hi gaknar,

I agree it is not terribly clear. I also initially misunderstood the order in which the cards were read during the initialisation stage. I read the cards into a list for each player and assumed that the first card read was intended to be at the “bottom” of the deck. Consequently, I reversed my lists at the end of the initialisation process, with the intention that the “start” of each list would represent the “top” of each deck.

This was a big mistake. It was only whilst struggling to pass test 3, that in desperation I commented out my reversal statements and suddenly everything worked perfectly.

I agree. I tried different permutations until I found one that worked. The two primary questions are:

  1. What is added to the war pile first in a war, the face up cads or the 3 face down cards from the deck?
  2. At the end of a war, do you add the war pile first or the face up card first for each player/

The thing that surprise me the most is that winamax challenge is back ( go check if my achievement are too )

Why is it rewarded 60 GP? It’s a medium difficulty puzzle.
Maybe it’s an easy puzzle?

I think it’s maybe because it wasn’t changed from the old system?

EDIT: I’ve checked, it gives 100CP not 60CP

Hum @CvxFous, well… to be honest, we’ve just fixed that about 1min ago… so, yes @nicolas_patrois you was right ! It’s now fixed and this will be recalculated this night.

1 Like

@G_Rom wouhou 40 more CP :slight_smile:

I understand that Winamax is only interested in certain languages, but I think you should not restrict the whole game to these languages. You could restrict just the ability to send in a solution. This way you wouldn’t prevent the people doing the game “just for fun” to use their favourite language.

2 Likes

For a basic battle, you put the card of the first player and then the card of the second player.

For a war, you put ALL the cards of first player ( the basic battle card + the 3 others) and then those of the second player.
Becarful, you can have several following wars.

You can notice how it works (Which order, what to remain, …) if you play it for real with someone.

1 Like

there is some error that makes debug impossible:
i can not pass tests 05 (one game one battle), 07 and 08 (pat) from ide window, but on validation only test 07 (long game) is wrong
can you check, please? because i think that my algorithm is correct just very slow, so now i need to think only about speed, not about internal logic

Are you sure of your way the cards are put in the decks?
I had a similar error, I read again, then…

I’m having an issue with test 3. I’m not getting the expected number of game rounds. I checked the in.txt file and played out the game for real, and my game in real life matched correctly with my program, but the test’s expected answer still claims I’m wrong.

Has anyone else had an issue with test 3? I’m having trouble with some of the other tests as well, but I haven’t physically played out any others yet.

Just change your code and your real playstyle to match with the statement so :slight_smile:

Hi!

I see that I am not the only one having a hard time understanding which order is considered correct.
Can somebody confirm which is the correct order.
Let’s say the players have these cards:
A1,A2,A3,A4,A5,A6
B1,B2,B3,B4,B5,B6

Scenario 1:
We compare the top card (last) A6 and B6. Let’s say A6>B6 so we get:
A1,A2,A3,A4,A5
B1,B2,B3,B4,B5,A6,B6
or:
A1,A2,A3,A4,A5
A6,B6,B1,B2,B3,B4,B5

Scenario 2:
A6 and B6 are tied so we take extra 3 cards and p1 wins again.
A1,A2,
B1,B2,A6,B6,A3,A4,A5,B3,B4,B5
or
B1,B2,A3,A4,A5,B3,B3,B4,B5,A6,B6
or
A1,A2,
A6,B6,A3,A4,A5,B3,B4,B5,B1,B2
or
A3,A4,A5,B3,B3,B4,B5,A6,B6,B1,B2

or something I am missing :stuck_out_tongue:
Thanks!

Scenario 1: 2nd answer but beware of the cards’ order when won.

2 Likes

Thanks. In the meantime I realized that there is another question: What is considered in the input the ‘top card of the deck’. Is it the first card of the input string or the last card?
(A1 or A6 as I assumend in my example)?

The first one (index 0) is the drawn card.

1 Like

And i have problem with 3th test i got 34 rounds and i dont understand where i mistake because when i go step by step i finish in 34 rounds but i need 56 soo if some1 have same problem write please

Ok i found solution it is all abaout how u return cards! We return cards from winer 1st then from looser but you need to retrun 1st cards from player1 then from player2 no metter who win so if player 2 win when you return cards 1st return from player1 then from player2
I hope this will help some1

13 Likes