RandAI makes illegal plays
Closed this issue · 2 comments
mgaree commented
Sometime after my refactoring of cards.py, RandAI has gained the ability to make illegal plays.
mgaree commented
In checking play legality in AIBase, numbers were being checked for equality using is
instead of ==
. The function was copied from game.py where is
was also used. While is
is lovely and pythonic, it is wrong. See here: http://stackoverflow.com/a/133024
After the refactoring of cards.py, ranks and suits are showing up as floats instead of ints. So the fact everything worked before refactoring was due to an unusual implementation (caching) in Python, not because it was the correct thing to do.
I changed is
to ==
as appropriate in some other places, but not everywhere.
mrpoodlepants commented
:(