dkirkby / CodeNames

AI for CodeNames
MIT License
18 stars 7 forks source link

Prevent the engine from giving the same clue multiple times #10

Open manurFR opened 7 years ago

manurFR commented 7 years ago

It could happen especially if the first guess was wrong in the previous round, because then the words to guess are the same. I propose we keep a list of previous clues and remove them from future choices.

 NIGHT        BOW          SATURN       HAM         <<<<<<<<<<<< 
 SCUBA_DIVER <<<<<<<<<<<<  RABBIT       TURKEY       CRICKET     
 ICE_CREAM    MICROSCOPE   MEXICO       BILL         KID         
 STREAM       LAP          HOLE         BOTTLE       ANTARCTICA  
 LINE         QUEEN        COMIC        ICE          BACK        
>>> your clue is: england 3
>>> enter your guess #1: queen
>>> Sorry!

(...snip the other team's round...)

<NIGHT       <BOW         -saturn      >HAM         <<<<<<<<<<<< 
<SCUBA_DIVER <<<<<<<<<<<< >RABBIT      -turkey      >CRICKET     
>ICE_CREAM   >MICROSCOPE  >MEXICO      <BILL        #KID         
<STREAM      -lap         -hole        -bottle      -antarctica  
>LINE        <<<<<<<<<<<< >>>>>>>>>>>> <ICE         >BACK        
Thinking...
0.819 HAM + CRICKET + MEXICO = england
0.697 CRICKET = first-class
0.672 MEXICO = mexican
0.661 HAM + CRICKET + LINE = paddington
...
 NIGHT        BOW          SATURN       HAM         <<<<<<<<<<<< 
 SCUBA_DIVER <<<<<<<<<<<<  RABBIT       TURKEY       CRICKET     
 ICE_CREAM    MICROSCOPE   MEXICO       BILL         KID         
 STREAM       LAP          HOLE         BOTTLE       ANTARCTICA  
 LINE        <<<<<<<<<<<< >>>>>>>>>>>>  ICE          BACK        
>>> your clue is: england 3
>>> enter your guess #1: 
dkirkby commented 7 years ago

Just to make sure I understand: this is a question of strategy rather than following the rules? I agree that it is not a good strategy to repeat a clue, but we might want to implement this as a score penalty rather than always preventing a repeated clue (unless there is a rule against this?)

manurFR commented 7 years ago

The rules do not prevent it. But common sense makes me think it's not a good use of a spymaster's only clue to give again an older one ; usually the team remembers this previous clue and they can make use of it thanks to the +1 guesses.

Why do you suggest a score penalty ? Is it technically easier ? Do you want to keep the possibility of repeating a clue if no alternative has a decent score ?

dkirkby commented 7 years ago

Do you want to keep the possibility of repeating a clue if no alternative has a decent score ?

Yes, there are bound to be cases where the next best clue is much worse so a penalty is a flexible way to handle this without explicitly coding any special cases. The size of the penalty gives you a parameter to tune with experience, and very large value effectively forbids repeating a clue so that is still an option.