0

I'm programming a card game (of Uno / Mau Mau type) and my "problem" is as follows:

The high level AI players can cheat by being able to check what cards the other players have in their hands. Two solutions come to my mind:

1) Add getters to players, these getters would be used to access the cards held by players. However, this would break the "accessors are evil" principle.

2) The high level AI players would be observers observing the other players. Whenever a player draws a card, they will notify the observers and send them the drawn card as a parameter of the notify method. The observers can then decide to either "remember" the card and who played it or to ignore it. This would make it easy for the AI players to check a given percentage of other players' cards (anywhere from 0 to 100% of opponents' cards).

Could you please tell me which option is better OOP or can you come with a different solution?

Caroline
  • 33
  • 3
  • Is this a language-agnostic question or you're interested to see some answer in some language you're programming? Also where's your reference code? Otherwise seems like you're expecting loads of vague answers... – Roko C. Buljan Mar 04 '17 at 13:36
  • This is a language-agnostic question, however I'll most likely be implementing it in C++. I'm in the process of designing the program. – Caroline Mar 04 '17 at 13:43

0 Answers0