int main(int argc, char *argv[]) { int ch, move; while ((ch = getopt(argc, argv, "ph")) != -1) switch(ch) { case 'p': promode = 1; break; case '?': case 'h': default: usage(); } srandomdev(); instructions(); init(); if (nrandom(2) == 1) { printplayer(COMPUTER); (void)printf("get to start.\n"); goto istart; } printplayer(USER); (void)printf("get to start.\n"); for (;;) { move = usermove(); if (!comphand[move]) { if (gofish(move, USER, userhand)) continue; } else { goodmove(USER, move, userhand, comphand); continue; } istart: for (;;) { move = compmove(); if (!userhand[move]) { if (!gofish(move, COMPUTER, comphand)) break; } else goodmove(COMPUTER, move, comphand, userhand); } } /* NOTREACHED */ }
int main (void) { initialize_curses(); initialize_windows(); shuffle_deck_and_deal(); instructions(); enum EPlayer player = nrand(NPLAYERS); printplayer (player); waddstr (_wmsg, "get to start.\n"); for (;;) { unsigned m = makemove (player); if (_hand[OTHER(player)][m]) goodmove (player, m); else if (!gofish (player, m)) player = OTHER(player); } return EXIT_SUCCESS; }