The Wildcats application gives a player a turn when available and rested, or when a coach requests an override. C# operator precedence determines how an expression groups when parentheses are omitted.
Logical NOT is applied before AND, and AND before OR.
Read the example once before trying to explain every line. Then use the short explanations below to connect each part of the code with the soccer task.
bool isAvailable = false;
bool isRested = false;
bool coachOverride = true;
bool firstRule = isAvailable && isRested || coachOverride;
bool secondRule = isAvailable && (isRested || coachOverride);Read the table one row at a time. Check when each value is observed: a value before a statement may differ from the value after that statement runs. Cover the result column and predict an answer before checking it.
| Available | Rested | Override | First rule | Second rule |
|---|---|---|---|---|
| False | False | True | True | False |
| True | False | True | True | True |
| True | False | False | False | False |
| True | True | False | True | True |
Use the diagram to follow the same soccer example in a different form. Start at the beginning and follow one execution at a time. Compare the labeled actions with the source code; do not assume every action in the picture runs.
Write your prediction and a short reason first. If you test the change, compare the observed values with that prediction. When they differ, find the first statement or decision where your explanation stops matching the code.