cribbage.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. /* $NetBSD: cribbage.h,v 1.12 2004/02/08 22:23:50 jsm Exp $ */
  2. /*
  3. * Copyright (c) 1980, 1993
  4. * The Regents of the University of California. All rights reserved.
  5. *
  6. * Redistribution and use in source and binary forms, with or without
  7. * modification, are permitted provided that the following conditions
  8. * are met:
  9. * 1. Redistributions of source code must retain the above copyright
  10. * notice, this list of conditions and the following disclaimer.
  11. * 2. Redistributions in binary form must reproduce the above copyright
  12. * notice, this list of conditions and the following disclaimer in the
  13. * documentation and/or other materials provided with the distribution.
  14. * 3. Neither the name of the University nor the names of its contributors
  15. * may be used to endorse or promote products derived from this software
  16. * without specific prior written permission.
  17. *
  18. * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  19. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  20. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  21. * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  22. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  23. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  24. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  25. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  26. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  27. * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  28. * SUCH DAMAGE.
  29. *
  30. * @(#)cribbage.h 8.1 (Berkeley) 5/31/93
  31. */
  32. extern CARD deck[ CARDS ]; /* a deck */
  33. extern CARD phand[ FULLHAND ]; /* player's hand */
  34. extern CARD chand[ FULLHAND ]; /* computer's hand */
  35. extern CARD crib[ CINHAND ]; /* the crib */
  36. extern CARD turnover; /* the starter */
  37. extern CARD known[ CARDS ]; /* cards we have seen */
  38. extern int knownum; /* # of cards we know */
  39. extern int pscore; /* player's score */
  40. extern int cscore; /* comp's score */
  41. extern int glimit; /* points to win game */
  42. extern int pgames; /* player's games won */
  43. extern int cgames; /* comp's games won */
  44. extern int gamecount; /* # games played */
  45. extern int Lastscore[2]; /* previous score for each */
  46. extern BOOLEAN iwon; /* if comp won last */
  47. extern BOOLEAN explain; /* player mistakes explained */
  48. extern BOOLEAN rflag; /* if all cuts random */
  49. extern BOOLEAN quiet; /* if suppress random mess */
  50. extern BOOLEAN playing; /* currently playing game */
  51. extern char explan[]; /* string for explanation */
  52. void addmsg(const char *, ...)
  53. __attribute__((__format__(__printf__, 1, 2)));
  54. int adjust(const CARD [], CARD);
  55. int anymove(const CARD [], int, int);
  56. int anysumto(const CARD [], int, int, int);
  57. void bye(void);
  58. int cchose(const CARD [], int, int);
  59. void cdiscard(BOOLEAN);
  60. int chkscr(int *, int);
  61. int comphand(const CARD [], const char *);
  62. void cremove(CARD, CARD [], int);
  63. int cut(BOOLEAN, int);
  64. int deal(int);
  65. void discard(BOOLEAN);
  66. void do_wait(void);
  67. void endmsg(void);
  68. int eq(CARD, CARD);
  69. int fifteens(const CARD [], int);
  70. void game(void);
  71. void gamescore(void);
  72. char *getline(void);
  73. int getuchar(void);
  74. int incard(CARD *);
  75. int infrom(const CARD [], int, const char *);
  76. void instructions(void);
  77. int is_one(CARD, const CARD [], int);
  78. void makeboard(void);
  79. void makedeck(CARD []);
  80. void makeknown(const CARD [], int);
  81. void msg(const char *, ...)
  82. __attribute__((__format__(__printf__, 1, 2)));
  83. int msgcard(CARD, BOOLEAN);
  84. int msgcrd(CARD, BOOLEAN, const char *, BOOLEAN);
  85. int number(int, int, const char *);
  86. int numofval(const CARD [], int, int);
  87. int pairuns(const CARD [], int);
  88. int peg(BOOLEAN);
  89. int pegscore(CARD, const CARD [], int, int);
  90. int playhand(BOOLEAN);
  91. int plyrhand(const CARD [], const char *);
  92. void prcard(WINDOW *, int, int, CARD, BOOLEAN);
  93. void prcrib(BOOLEAN, BOOLEAN);
  94. void prhand(const CARD [], int, WINDOW *, BOOLEAN);
  95. void printcard(WINDOW *, int, CARD, BOOLEAN);
  96. void prpeg(int, int, BOOLEAN);
  97. void prtable(int);
  98. int readchar(void);
  99. void receive_intr(int) __attribute__((__noreturn__));
  100. int score(BOOLEAN);
  101. int scorehand(const CARD [], CARD, int, BOOLEAN, BOOLEAN);
  102. void shuffle(CARD []);
  103. void sorthand(CARD [], int);
  104. void wait_for(int);