[Community Puzzle] Simple AI duels

Coding Games and Programming Challenges to Code Better

Send your feedback or ask for help here!

Created by @nicola,validated by @5DN1L,@LittleDarkBug and @FredericLocquet.
If you have any issues, feel free to ping them.

The puzzle doesn’t define what “dominated” means.

1 Like

There are only two possible actions: C or D.
If the player made more C actions than D then C is dominating.


Oh, so it’s just about which of C and D are more common in the historical actions? I don’t think this is what dominated usually means. I think with the usual definition D dominates everything because your opponent can never beat you if you play D (C gives them a loss, D gives them a draw).

1 Like

Yes, it’s about the history of the actions.

1 Like

You should probably replace it by " is more common" or something like that.
Also, you should specify “strictly more”, cause testcase 5 fails with >= instead of > (but all validators work anyway).

“>=” wouldn’t make sense. That would mean C dominates D and D dominates C could both be true simultaneously. If it were to be changed my choice of wording would maybe be to use “outnumber” or “outnumbers”. But “dominates” seems pretty straight forward.

A condition like “greater/better” can mean either “striclty greater/better” or “greater/better or equivalent”.

It might be implicit for you that it’s the first one but truth is, there is no universal rule for these things that apply in all contexts/fields/languages.

So even if it seems implicit for you, I think it should always be specified.

Could someone clarify what this means “If the binary decomposition of the calculated x has an even number of 1, choose D. Else, choose C.”

Convert the decimal x value into binary number.
Count how many '1’s are in the binary number.
Even count → D,
Odd count → C.


I was also tripped up by the definition of “dominated”. The meaning of dominance has a clear definition in game theory, and people who’ve taken game theory courses or classes could use that instead of the frequency of choices.

Can some explain to me how this test case (5) is expecting a DRAW ?

3 NiceGuyBut
* C
3 FlipFlop
ME -1 D C
ME -1 C D

To me, NiceGuyBut will always play C and ends up with 100 and FlipFlop 250.
FlipFlop will have at max same number of C and D, so OPP MAX D D should never be triggered.

As additionnal info, i also fail test case 6 expecting BirdyNiceGuy, with following results:
BirdyNiceGuy 147
TitForTat 153

I’m clueless :sweat_smile:

EDIT: Submitting my code i also fail Validators 3 & 7 …

The score is 150 for both in BirdyNiceGuy.
Perhaps you forgot the * C line?

This puzzle wasn’t so easy ! I think the difficulty “medium” is more appropriate.
However, it is an interesting puzzle, it should has had a better ranking. I upvote !

1 Like