home *** CD-ROM | disk | FTP | other *** search
- /*LINTLIBRARY*/
-
- /*
- * Copyright (C) 1991 by Jay Konigsberg. mail: jak@sactoh0
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation is hereby granted, provided that the above copyright
- * notice appear in all copies and that both the copyright notice and
- * this permission notice appear in supporting documentation. This software
- * is provided "as is" without express or implied warranty. However, the
- * author retains all Copyright priviliges and rights to renumeration if
- * this software is sold.
- *
- * Also, and very important. This game is for recrecation ONLY and is NOT
- * to be used for gambling in any way.
- */
-
- /*
- * main for "video_poker" - just like the ones in Nevada.
- * Jay Konigsberg
- * jak@sactoh0 - pacbel!sactoh0!jak
- */
-
- #include "vid_local.h"
- #include <signal.h>
- #include "vid_curses.h"
- #include "vid_poker.h"
-
- int bet,
- credits;
-
- void main()
- {
- int deck[10], /* The random numbers as they were generated */
- value[10], /* The card values - A, 2 ... 12=Q, 13=K */
- loop; /* loop while bet is selected */
- char *suite[10]; /* Corasponding suites (Spades, Hearts, ... */
- int cardinx; /* Just a loop variable */
-
- credits=0;
- rawmode(); /* set up char-at-a-time processing */
- signal(SIGINT, cleanup);/* trap inturrepts (also in rawmode) */
-
- initscr();
- payoff_val(0); /* Put the payoff values on the screen */
-
- for (;;)
- {
- for (cardinx=0; cardinx<10; ++cardinx)
- {
- deck[cardinx] = 0;
- value[cardinx] = 0;
- suite[cardinx] = (char *)0;
- }
- bet = 0;
- loop = TRUE;
- while (loop)
- {
- mvaddstr(21,0,"B/b=bet one credit, M/m=bet max credits, Q/q=quit?\t\t");
- move(21,51);
- refresh();
- switch (getch())
- {
- case '\n':
- case '\r':
- loop=FALSE;
- break;
- case 'q':
- case 'Q':
- case 'n':
- case 'N':
- loop=FALSE;
- cleanup();
- break;
- case 'M':
- case 'm':
- case ' ':
- loop=FALSE;
- credits -= (5 - bet);
- bet = 5;
- move(21,65);
- printw("Bet %-6d", bet);
- payoff_val(bet); /* Put the payoff values on the screen */
- break;
- case 'b':
- case 'B':
- ++bet;
- if ( bet == 5 )
- loop=FALSE;
- else
- loop=TRUE;
- payoff_val(bet); /* Put the payoff values on the screen */
- move(21,65);
- printw("Bet %-6d", bet);
- --credits;
- break;
- }
- mvprintw(22, 65, "Credits %-5d ", credits);
- refresh();;
- if (bet == 0)
- loop=TRUE;
- }
- deal(deck, 5);
- setup_deck(deck, value, suite, 5);
- sort(value, suite, 5);
- display_hand(value, suite, 5);
- (void)display_val(id_hand(value, suite));
- draw(deck, value, suite);
- }
- /*NOTREACHED*/
- }
-