Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!rutgers!mcnc!seismo!uunet!munnari!basser!games-request From: games-request@basser.UUCP Newsgroups: comp.sources.games Subject: v02i031: Blue Moon, a solitaire/patience game Message-ID: <995@basser.oz> Date: Thu, 13-Aug-87 08:17:53 EDT Article-I.D.: basser.995 Posted: Thu Aug 13 08:17:53 1987 Date-Received: Sat, 15-Aug-87 17:08:04 EDT Sender: john@basser.oz Lines: 410 Approved: john@basser.cs.su.oz.AU Submitted by: Tim Lister Comp.sources.games: Volume 2, Issue 31 Archive-name: bluemoon # This is a shell archive. Remove anything before this line, # then unpack it by saving it in a file and typing "sh file". # # Contents: README blue.c echo x - README sed 's/^@//' > "README" <<'@//E*O*F README//' This is an implementation of the patience game Blue Moon. It uses curses, but is otherwise written as simply as possible, and should work under any Un*x variant. The details of the game are included in the game, and the instructions are self evident. A graphics version is under preparation for the Sun, and may be released soon. Save the file as: blue.c Compile with: cc -O blue.c -lcurses -ltermlib @//E*O*F README// chmod u=rw,g=r,o=r README echo x - blue.c sed 's/^@//' > "blue.c" <<'@//E*O*F blue.c//' /***************************************************************************** * * * B l u e M o o n * * ================= * * * * A patience game by T.A.Lister * * * *****************************************************************************/ /* #include made redundant by "curses". tal */ #include #include long time(); #define NOCARD -1 #define HEARTS 0 #define SPADES 1 #define DIAMONDS 2 #define CLUBS 3 #define ACE 0 #define TWO 1 #define THREE 2 #define FOUR 3 #define FIVE 4 #define SIX 5 #define SEVEN 6 #define EIGHT 7 #define NINE 8 #define TEN 9 #define JACK 10 #define QUEEN 11 #define KING 12 #define SUIT_LENGTH 13 #define GRID_WIDTH 14 /* 13+1 */ #define GRID_LENGTH 56 /* 4*(13+1) */ #define PACK_SIZE 52 int deck_size=PACK_SIZE; /* initial deck */ int deck[PACK_SIZE]; int grid[GRID_LENGTH]; /* card layout grid */ int freeptr[4]; /* free card space pointers */ int deal_number=0; die() { signal(SIGINT, SIG_IGN); mvcur(0, COLS-1, LINES-1, 0); endwin(); exit(0); } init_vars() { int i; deck_size=PACK_SIZE; for(i=0;i to continue OOOOOooooo....."); refresh(); (void) getchar(); } shuffle(size) int size; { int i,j,numswaps,swapnum,temp; numswaps=size*10; /* an arbitrary figure */ for (swapnum=0;swapnum=PACK_SIZE)) return NOCARD; for(i=0;i'd'))&&(c!='r')&&(c!='R')); if ((c=='r')||(c=='R')) wrefresh(curscr); else { i=c-'a'; if (select[i]!=NOCARD) { movecard(select[i], freeptr[i]); freeptr[i]=select[i]; } } } } for (i=0;i<4;i++) { move(12+i,0); printw("%c: ",'a'+i); printw("DEAD "); } move(20,0); printw(".....oooooOOOOO Finished Deal %d - Press to Continue OOOOOooooo.....", deal_number); refresh(); (void) getchar(); } collect_discards() { int row, col, cardno=0, finish, gridno; for (row=HEARTS;row<=CLUBS;row++) { finish=0; for (col=1;col