# APCS: AP Computer Science A @sfhs

guess_my_rule

## Guess My Rule

Guess My Rule games are games in which one person thinks up a secret rule, and then gives clues by stating some examples of some that follow the “rule,” and examples of something that doesn't follow the “rule.” Next, rule-guesser(s) try to discover the rule by trying predict whether their own examples follow the rule or not. After the rule-maker answers a few questions from the rule-guesser(s), the rule guesser(s) try to guess the rule.

For example, The secret rule might be that it is an integer that is a prime number. The rule-maker Starts with “2 follows my rule, but 4 does not”. The rule-guesser than asks “Does 3 follow the rule?” and is told “3 follows my rule” Or “15 follows the rule, right?” which the rule-make will respond with “No, 15 does not follow the rule”. The guesser will eventually win by guessing the rule or lose by giving up.

In our computer version, the user asks about a certain `int` or `String`, and the computer answers whether it follows the secret rule or not. After 10 clues are given, the user has to pass a test by answering “yes” or “no” to certain `int` or `Strings`.

To be fair, the secret rule cannot involve any random behavior.