# [Community Puzzle] Simple AI duels

Coding Games and Programming Challenges to Code Better

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.

2 Likes

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.

2 Likes

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 ?

100
3 NiceGuyBut
START C
OPP MAX D D
* C
3 FlipFlop
START RAND
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

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 !

2 Likes

What is testing in â€śNot so niceâ€ť i probably miss some statement but i dont see which one;

Writing a little VM to run this in Rust was really good fun. I think this may be the most actual structure Iâ€™ve had to put into a puzzle solution so far.
Thanks for the great puzzle.

Thank you for this puzzle. That doesnâ€™t test the case â€śME WIN Yâ€ť

Hi, Iâ€™m ok with all tests but not with validator 6.
Could someone give me a specific test for this validator ?
Thanks,

You can send me your code, Iâ€™ll send back whatâ€™s wrong.