- struct result r = {.p1wins=0, .p2wins=0};
- if (p1.score >= 21) {
- r.p1wins++;
- } else if (p2.score >= 21) {
- r.p2wins++;
- } else if (p1turn) {
- for (int i = 1; i<=3; i++)
- for (int j = 1; j<=3; j++)
- for (int k = 1; k<=3; k++)
- add_result(&r, play(!p1turn, move(p1, i+j+k), p2));
- } else {
- for (int i = 1; i<=3; i++)
- for (int j = 1; j<=3; j++)
- for (int k = 1; k<=3; k++)
- add_result(&r, play(!p1turn, p1, move(p2, i+j+k)));
- }
+ struct result r = {.p1=0, .p2=0};
+ if (p1.score >= 21)
+ r.p1++;
+ else if (p2.score >= 21)
+ r.p2++;
+ else if (p1turn)
+ FOR_THROWS(add_result(&r, play(!p1turn, move(p1, i+j+k), p2)));
+ else
+ FOR_THROWS(add_result(&r, play(!p1turn, p1, move(p2, i+j+k))));