[comp.sources.games] v03i065: miles - another version of Mille Bournes, Part01/02

games-request@tekred.TEK.COM (01/22/88)

Submitted by: Brett K. Carver <hpsrlc!brett@hplabs.HP.COM>
Comp.sources.games: Volume 3, Issue 65
Archive-name: miles/Part01

#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of archive 1 (of 2)."
# Contents:  README MANIFEST Makefile heuristic.c miles.6 move.c
#   screen.c
# Wrapped by billr@tekred on Wed Jan 20 10:20:48 1988
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f README -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"README\"
else
echo shar: Extracting \"README\" \(289 characters\)
sed "s/^X//" >README <<'END_OF_README'
X	Here's YAV (Yet Another Version) of Mille Bournes that I've
Xhad sitting around for a few years.  It's not as flashy as xmille
Xfrom a few months back, but its interface allows for a much faster
Xplaying game.  I enjoy it, perhaps others will too.
X
X
X				Brett Carver
X				hplabs!hpsrla!brett
END_OF_README
if test 289 -ne `wc -c <README`; then
    echo shar: \"README\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f MANIFEST -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"MANIFEST\"
else
echo shar: Extracting \"MANIFEST\" \(504 characters\)
sed "s/^X//" >MANIFEST <<'END_OF_MANIFEST'
X   File Name		Archive #	Description
X-----------------------------------------------------------
X MANIFEST                  1	This shipping list
X Makefile                  1	
X README                    1	
X card.c                    2	
X data.c                    2	
X heuristic.c               1	
X io.c                      2	
X main.c                    2	
X miles.6                   1	
X miles.h                   2	
X move.c                    1	
X random.c                  2	
X screen.c                  1	
END_OF_MANIFEST
if test 504 -ne `wc -c <MANIFEST`; then
    echo shar: \"MANIFEST\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f Makefile -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"Makefile\"
else
echo shar: Extracting \"Makefile\" \(371 characters\)
sed "s/^X//" >Makefile <<'END_OF_Makefile'
X#
X# Makefile:	makefile for Mille Bornes
X#
X
X#
X# Files
X#
XHDRS	=	miles.h
XOBJS	=	card.o data.o heuristic.o io.o main.o move.o random.o screen.o
XSRCS	=	card.c data.c heuristic.c io.c main.c move.c random.c screen.c
X
X#
X# Flags section
X#
XCFLAGS	=	-O
XLDFLAGS	=	-s -o miles
XCRLIB	=	-lcurses
X
Xmiles:		$(OBJS)
X		cc $(LDFLAGS) $(OBJS) $(CRLIB)
X
X$(OBJS):	$(HDRS)
X
Xclean:
X		rm $(OBJS)
END_OF_Makefile
if test 371 -ne `wc -c <Makefile`; then
    echo shar: \"Makefile\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f heuristic.c -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"heuristic.c\"
else
echo shar: Extracting \"heuristic.c\" \(17947 characters\)
sed "s/^X//" >heuristic.c <<'END_OF_heuristic.c'
X/* heuristics.c */
X/* transportable */
X
X/**********************************************************************/
X/*                                                                    */
X/*           MM   MM  IIIIIII  L        L        EEEEEEE              */
X/*           M M M M     I     L        L        E                    */
X/*           M  M  M     I     L        L        EEEE                 */
X/*           M     M     I     L        L        E                    */
X/*           M     M  IIIIIII  LLLLLLL  LLLLLLL  EEEEEEE              */
X/*                                                                    */
X/*      BBBBBB    OOOOO   RRRRRR   NN    N  EEEEEEE   SSSSSS          */
X/*      B     B  O     O  R     R  N N   N  E        S                */
X/*      BBBBBB   O     O  RRRRRR   N  N  N  EEEEE     SSSSS           */
X/*      B     B  O     O  R    R   N   N N  E              S          */
X/*      BBBBBB    OOOOO   R     R  N    NN  EEEEEEE  SSSSSS           */
X/*                                                                    */
X/*                                                                    */
X/* Creation: Edmond Dujardin                                          */
X/*           (c) 1962 Parker Brothers, Inc.                           */
X/*                                                                    */
X/* Written by: Brett K. Carver                                        */
X/*             Hewlett-Packard, 1983.                                 */
X/*                                                                    */
X/* Copyright: (c) Brett K. Carver, Hewlett-Packard, 1986.             */
X/*                                                                    */
X/**********************************************************************/
X
X#include "miles.h"
X
X/*********************************/
X/* external variable definitions */
X/*********************************/
X
Xextern int cards_played[20];    /* set of cards already played */
Xextern int hand[2][15];         /* current status of players */
Xextern int extension;           /* boolean for extension */
X
X/**********************************************************************/
X/*                                                                    */
X/*              HEURISTIC ALGORITHMS FOR ME TO PLAY/DISCARD           */
X/*                                                                    */
X/**********************************************************************/
X
X/**********************************************************************/
X/*                                                                    */
X/* 100 -> Must play card                                              */
X/*     /                                                              */
X/*  75 -> Must play miles                                             */
X/*     /                                                              */
X/*  50 -> Can play or discard                                         */
X/*     /                                                              */
X/*   0 -> Don't discard                                               */
X/*                                                                    */
X/**********************************************************************/
X/*                                                                    */
X/* Card            Play    Weight Conditions                          */
X/* ----            ----    ------ ----------                          */
X/*                                                                    */
X/* safety          play    100    have its hazard                     */
X/* safety          play    80     have its hazard, just drawn         */
X/* safety          play    97     your score >= 600/900               */
X/* safety          play    80     my score >= 600/900                 */
X/* safety          play    51     both hazards played                 */
X/* safety          play    6      need room                           */
X/* safety          discard 0      never                               */
X/*                                                                    */
X/* hazard          play    95     rolling                             */
X/* hazard          discard 50     he has safety                       */
X/* hazard          discard 3      need room                           */
X/* speed limit     play    90     rolling                             */
X/* speed limit     discard 50     he has safety                       */
X/* speed limit     discard 6      need room                           */
X/*                                                                    */
X/* remedy          play    85     have hazard                         */
X/* remedy          discard 50     have safety                         */
X/* remedy          discard 50     both hazards played                 */
X/* remedy          discard 50     one hazards played, > 1 in hand     */
X/* remedy          discard 40     > 2 in hand                         */
X/* remedy          discard 10     > 1 in hand                         */
X/* remedy          discard 2      need room                           */
X/* roll            play    80     have remedy or stop                 */
X/* roll            discard 50     have safety                         */
X/* roll            discard 40     > 3 in hand                         */
X/* roll            discard 10     > 2 in hand                         */
X/* roll            discard 1      need room                           */
X/*                                                                    */
X/* 200             play    75     score = 500/800                     */
X/* 200             play    63     score < 400/700                     */
X/* 200             play    73     your score >= 600/900               */
X/* 200             play    35     need points                         */
X/* 100             play    75     score = 600/900                     */
X/* 100             play    61     score < 500/800                     */
X/* 100             play    71     your score >= 600/900               */
X/* 100             play    30     need points                         */
X/* 75              play    75     score = 625/925                     */
X/* 75              play    59     score < 525/825                     */
X/* 75              play    69     your score >= 600/900               */
X/* 75              play    25     need points                         */
X/* 75              play    54     600/900 miles, 25 in hand           */
X/* 50              play    75     score = 650/950                     */
X/* 50              play    57     score < 550/850                     */
X/* 50              play    67     your score >= 600/900               */
X/* 50              play    20     need points                         */
X/* 50              play    53     600/900 miles, 50 or 2 50 in hand   */
X/* 50              play    53     625/925 miles, 25 in hand           */
X/* 25              play    75     score = 675/975                     */
X/* 25              play    55     score < 575/875                     */
X/* 25              play    65     your score >= 600/900               */
X/* 25              play    15     need points                         */
X/* 25              play    52     600/900 miles, 3 25 in hand         */
X/* 25              play    52     625/925 miles, 2 25 in hand         */
X/* 25              play    52     650/950 miles, 1 25 in hand         */
X/* 200             discard 50     two played                          */
X/* 200             discard 50     > 800 miles                         */
X/* 200             discard 50     one played, > 1 in hand             */
X/* 100             discard 50     > 900 miles                         */
X/* 75              discard 50     > 950 miles                         */
X/* 50              discard 50     > 950 miles                         */
X/* 200             discard 4      need room                           */
X/* 100             discard 5      need room                           */
X/* 75              discard 3      score = 625/925, 1 in hand          */
X/* 75              discard 7      need room                           */
X/* 50              discard 3      score = 650/950, 1 in hand          */
X/* 50              discard 8      need room                           */
X/* 25              discard 3      score = 675/975, 1 in hand          */
X/* 25              discard 9      need room                           */
X/*                                                                    */
X/**********************************************************************/
X
X/*********************************************/
X/* counts the number of this card in me hand */
X/*********************************************/
Xcount_card(card)
Xint card;
X{
Xint count;
Xint i;
Xcount = 0;
Xfor (i=0; i<7; i++)
X    if (hand[me][i] == card)
X         count += 1;
Xreturn(count);
X}
X
X/*******************************************/
X/* computes a weight for playing this card */
X/*******************************************/
Xcompute_play_weight(num)
Xint num;
X{
Xint score_limit;
Xscore_limit = extension ? 1000 : 700;
Xswitch (hand[me][num]) {
X    case extra_tank: {
X         if (hand[me][battle] == out_of_gas)
X              if (num != 6)
X                   return(100);
X              else
X                   return(80);
X         if (hand[you][miles] + 100 >= score_limit)
X              return(97);
X         if (hand[me][miles] + 100 >= score_limit)
X              return(80);
X         if (cards_played[out_of_gas] == 0)
X              return(51);
X         return(6);
X         }
X    case puncture_proof: {
X         if (hand[me][battle] == flat_tire)
X              if (num != 6)
X                   return(100);
X              else
X                   return(80);
X         if (hand[you][miles] + 100 >= score_limit)
X              return(97);
X         if (hand[me][miles] + 100 >= score_limit)
X              return(80);
X         if (cards_played[flat_tire] == 0)
X              return(51);
X         return(6);
X         }
X    case driving_ace: {
X         if (hand[me][battle] == accident)
X              if (num != 6)
X                   return(100);
X              else
X                   return(80);
X         if (hand[you][miles] + 100 >= score_limit)
X              return(97);
X         if (hand[me][miles] + 100 >= score_limit)
X              return(80);
X         if (cards_played[accident] == 0)
X              return(51);
X         return(6);
X         }
X    case right_of_way: {
X         if (hand[me][battle] == stop || hand[me][limit] == speed_limit)
X              if (num != 6)
X                   return(100);
X              else
X                   return(80);
X         if (hand[you][miles] + 100 >= score_limit)
X              return(97);
X         if (hand[me][miles] + 100 >= score_limit)
X              return(80);
X         if (cards_played[stop] == 0 && cards_played[speed_limit] == 0)
X              return(51);
X         return(6);
X         }
X    case gasoline: {
X         return(85);
X         }
X    case spare_tire: {
X         return(85);
X         }
X    case repairs: {
X         return(85);
X         }
X    case end_of_limit: {
X         return(85);
X         }
X    case roll: {
X         return(85);
X         }
X    case out_of_gas: {
X         return(95);
X         }
X    case flat_tire: {
X         return(95);
X         }
X    case accident: {
X         return(95);
X         }
X    case speed_limit: {
X         return(90);
X         }
X    case stop: {
X         return(95);
X         }
X    case miles_200: {
X         if (hand[me][miles] + 200 == score_limit)
X              return(75);
X         if (hand[you][miles] + 100 >= score_limit)
X              return(73);
X         if (hand[me][miles] + 200 <= score_limit - 100)
X              return(63);
X         return(35);
X         }
X    case miles_100: {
X         if (hand[me][miles] + 100 == score_limit)
X              return(75);
X         if (hand[you][miles] + 100 >= score_limit)
X              return(71);
X         if (hand[me][miles] + 100 <= score_limit - 100)
X              return(61);
X         return(30);
X         }
X    case miles_75: {
X         if (hand[me][miles] + 75 == score_limit)
X              return(75);
X         if (hand[you][miles] + 100 >= score_limit)
X              return(69);
X         if (hand[me][miles] + 75 <= score_limit - 100)
X              return(59);
X         if (hand[me][miles] == score_limit - 100 && count_card(miles_25) >= 1)
X              return(54);
X         return(25);
X         }
X    case miles_50: {
X         if (hand[me][miles] + 50 == score_limit)
X              return(75);
X         if (hand[you][miles] + 100 >= score_limit)
X              return(67);
X         if (hand[me][miles] + 50 <= score_limit - 100)
X              return(57);
X         if (hand[me][miles] == score_limit - 100 && count_card(miles_50) >= 2)
X              return(53);
X         if (hand[me][miles] == score_limit - 100 && count_card(miles_25) >= 2)
X              return(53);
X         if (hand[me][miles] == score_limit - 75 && count_card(miles_25) >= 1)
X              return(53);
X         return(20);
X         }
X    case miles_25: {
X         if (hand[me][miles] + 25 == score_limit)
X              return(75);
X         if (hand[you][miles] + 100 >= score_limit)
X              return(65);
X         if (hand[me][miles] + 25 <= score_limit - 100)
X              return(55);
X         if (hand[me][miles] == score_limit - 100 && count_card(miles_25) >= 4)
X              return(52);
X         if (hand[me][miles] == score_limit - 75 && count_card(miles_25) >= 3)
X              return(52);
X         if (hand[me][miles] == score_limit - 50 && count_card(miles_25) >= 2)
X              return(52);
X         return(15);
X         }
X    }
Xreturn(0);	/* never gets here */
X}
X
X/**********************************************/
X/* computes a weight for discarding this card */
X/**********************************************/
Xcompute_discard_weight(num)
Xint num;
X{
Xint score_limit;
Xscore_limit = extension ? 1000 : 700;
Xswitch (hand[me][num]) {
X    case extra_tank: {
X         return(0);
X         }
X    case puncture_proof: {
X         return(0);
X         }
X    case driving_ace: {
X         return(0);
X         }
X    case right_of_way: {
X         return(0);
X         }
X    case gasoline: {
X         if (hand[me][safety] & 0x1)
X              return(50);
X         if (cards_played[out_of_gas] == 0)
X              return(50);
X         if (cards_played[out_of_gas] == 1 && count_card(gasoline) > 1)
X              return(50);
X         if (count_card(gasoline) > 2)
X              return(40);
X         if (count_card(gasoline) > 1)
X              return(10);
X         return(2);
X         }
X    case spare_tire: {
X         if (hand[me][safety] & 0x2)
X              return(50);
X         if (cards_played[flat_tire] == 0)
X              return(50);
X         if (cards_played[flat_tire] == 1 && count_card(spare_tire) > 1)
X              return(50);
X         if (count_card(spare_tire) > 2)
X              return(40);
X         if (count_card(spare_tire) > 1)
X              return(10);
X         return(2);
X         }
X    case repairs: {
X         if (hand[me][safety] & 0x4)
X              return(50);
X         if (cards_played[accident] == 0)
X              return(50);
X         if (cards_played[accident] == 1 && count_card(repairs) > 1)
X              return(50);
X         if (count_card(repairs) > 2)
X              return(40);
X         if (count_card(repairs) > 1)
X              return(10);
X         return(2);
X         }
X    case end_of_limit: {
X         if (hand[me][safety] & 0x8)
X              return(50);
X         if (cards_played[speed_limit] == 0)
X              return(50);
X         if (cards_played[speed_limit] == 1 && count_card(end_of_limit) > 1)
X              return(50);
X         if (count_card(end_of_limit) > 2)
X              return(40);
X         if (count_card(end_of_limit) > 1)
X              return(10);
X         return(2);
X         }
X    case roll: {
X         if (hand[me][safety] & 0x8)
X              return(50);
X         if (count_card(roll) > 3)
X              return(40);
X         if (count_card(roll) > 2)
X              return(10);
X         return(1);
X         }
X    case out_of_gas: {
X         if (hand[you][safety] & 0x1)
X              return(50);
X         return(3);
X         }
X    case flat_tire: {
X         if (hand[you][safety] & 0x2)
X              return(50);
X         return(3);
X         }
X    case accident: {
X         if (hand[you][safety] & 0x4)
X              return(50);
X         return(3);
X         }
X    case speed_limit: {
X         if (hand[you][safety] & 0x8)
X              return(50);
X         return(6);
X         }
X    case stop: {
X         if (hand[you][safety] & 0x8)
X              return(50);
X         return(3);
X         }
X    case miles_200: {
X         if (hand[me][cnt_200] == 2)
X              return(50);
X         if (hand[me][cnt_200] == 1 && count_card(miles_200) > 1)
X              return(50);
X         if (hand[me][miles] + 200 > score_limit)
X              return(50);
X         return(4);
X         }
X    case miles_100: {
X         if (hand[me][miles] + 100 > score_limit)
X              return(50);
X         return(5);
X         }
X    case miles_75: {
X         if (hand[me][miles] + 75 > score_limit)
X              return(50);
X         if (hand[me][miles] + 75 == score_limit && count_card(miles_75) == 1)
X              return(3);
X         return(7);
X         }
X    case miles_50: {
X         if (hand[me][miles] + 50 > score_limit)
X              return(50);
X         if (hand[me][miles] + 50 == score_limit && count_card(miles_50) == 1)
X              return(3);
X         return(8);
X         }
X    case miles_25: {
X         if (hand[me][miles] + 25 > score_limit)
X              return(50);
X         if (hand[me][miles] + 25 == score_limit && count_card(miles_25) == 1)
X              return(3);
X         return(9);
X         }
X    }
Xreturn(0);	/* never gets here */
X}
X
X/*********** end of program **********/
END_OF_heuristic.c
if test 17947 -ne `wc -c <heuristic.c`; then
    echo shar: \"heuristic.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f miles.6 -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"miles.6\"
else
echo shar: Extracting \"miles.6\" \(2745 characters\)
sed "s/^X//" >miles.6 <<'END_OF_miles.6'
X.TH MILES 6 
X.ad b
X.SH NAME
Xmiles \- the game of Mille Bournes
X.SH SYNOPSIS
X.B miles
X.HU 
X.SH HP-UX COMPATIBILITY
X.TP 10
XLevel:  
XINTERNAL
X.SH DESCRIPTION
X.I Miles\^
Xis a computerized version of the French card game Mille Bournes.
X"In this thrilling game you are pitted against the computer
Xin a death defying automobile race at fantastic speeds trying
Xto gain mileage as you avoid accidents, flat tires, running out of
Xgas, stop signs and speed limits." (Well, the marketing guy liked the hype).
X.PP
XThe game starts with several screens of optional instructions. They
Xbriefly explain the goals of the game, method of play, and scoring as well as
Xthe human interface and other miscellaneous commands. These instructions
Xare not comprehensive, but they should provide enough detail (along with
Xsome practice) to play the game.  If you want a
Xmore detailed set of instructions, buy the game.
X.PP
XThe main differences between this implementation and others that are around
Xare the way the computer plays (its heuristics if you will) and the
Xhuman interface. Traditional games force the player to enter a card
Xnumber, an action (play or discard) and hit return, for example:
X3d<cr>. This makes for a slow playing game. This version allows the
Xplayer to place his hand on the keyboard and play the entire game
Xwithout moving his hand from that position. The locations allowed
Xare the left hand home position, the right hand home position, and
Xthe right hand on the numeric keypad. During the game, a pointer
Xlabeled either
X.B play
Xor
X.B discard
Xwill be pointing at a card. With the hand in one of the three allowed
Xpositions, each finger will perform an action.
XThe index finger will move the pointer up (with wrapping). The ring
Xfinger will move it down. The middle finger will toggle the label
X(this also applies to any yes/no questions asked during the game).
XAnd the thumb or little finger will perform the action (defined
Xby the label) on the card pointed to. It takes a little practice
Xbut once the actions are associated with the correct finger the
Xgame can be played very fast.
X.PP
XIn addition to playing the game, the following commands may
Xbe entered any time the game is waiting for input.
X.HU 
X.TP 4
X.B !
XPerform a shell escape.
X.HU 
X.TP
X.B ?
XPrint the help information displayed at the game's start.
X.HU 
X.TP
X.B ^L
XRedraw the screen.
X.HU 
X.TP
X.B Q
XQuit the game immediately.
X.HU 
X.TP
X.B V
XPrint author and version information.
X.HU
X.SH BUGS
XProbably.
X.HU 
X.SH AUTHOR
X.PP
XThe original game was created by
XEdmond Dujardin, (c) 1962 Parker Brothers, Inc.
X.PP
XThe computer implementation was written by
XBrett K. Carver (me), 
X(c) Brett K. Carver, Hewlett-Packard, 1986.
XI can be contacted at Network Measurements Division, hpsrla!brett.
X.HU 
END_OF_miles.6
if test 2745 -ne `wc -c <miles.6`; then
    echo shar: \"miles.6\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f move.c -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"move.c\"
else
echo shar: Extracting \"move.c\" \(17881 characters\)
sed "s/^X//" >move.c <<'END_OF_move.c'
X/* move.c */
X/* transportable    */
X
X/**********************************************************************/
X/*                                                                    */
X/*           MM   MM  IIIIIII  L        L        EEEEEEE              */
X/*           M M M M     I     L        L        E                    */
X/*           M  M  M     I     L        L        EEEE                 */
X/*           M     M     I     L        L        E                    */
X/*           M     M  IIIIIII  LLLLLLL  LLLLLLL  EEEEEEE              */
X/*                                                                    */
X/*      BBBBBB    OOOOO   RRRRRR   NN    N  EEEEEEE   SSSSSS          */
X/*      B     B  O     O  R     R  N N   N  E        S                */
X/*      BBBBBB   O     O  RRRRRR   N  N  N  EEEEE     SSSSS           */
X/*      B     B  O     O  R    R   N   N N  E              S          */
X/*      BBBBBB    OOOOO   R     R  N    NN  EEEEEEE  SSSSSS           */
X/*                                                                    */
X/*                                                                    */
X/* Creation: Edmond Dujardin                                          */
X/*           (c) 1962 Parker Brothers, Inc.                           */
X/*                                                                    */
X/* Written by: Brett K. Carver                                        */
X/*             Hewlett-Packard, 1983.                                 */
X/*                                                                    */
X/* Copyright: (c) Brett K. Carver, Hewlett-Packard, 1986.             */
X/*                                                                    */
X/**********************************************************************/
X
X#include "miles.h"
X
X/**********************************************************************/
X/*                                                                    */
X/*              CONSTANTS AND VARIABLES                               */
X/*                                                                    */
X/**********************************************************************/
X
X/**********************************/
X/* external procedure definitions */
X/**********************************/
X
Xextern move_string();
Xextern message ();
X
X/*********************************/
X/* external variable definitions */
X/*********************************/
X
Xextern int hand[2][15];         /* current status of players */
Xextern int change[2][15];       /* parallel structure of booleans */
Xextern int discard;             /* card being discarded */
Xextern int extension;           /* boolean for extension */
Xextern long *card_names[40];    /* array of pointers to pointers to text */
X
Xextern char *T_no_card;
Xextern char *T_cant_play;
Xextern char *T_dont_need;
Xextern char *T_exact_700;
Xextern char *T_exact_1000;
Xextern char *T_only_two_200;
X
X/**********************************************************************/
X/*                                                                    */
X/*              UTILITIES TO VERIFY A MOVE                            */
X/*                                                                    */
X/**********************************************************************/
X
X/************************************/
X/* prints can't play error messages */
X/************************************/
Xcant_play(who,card,beep)
Xint who;
Xint card;
Xint beep;
X{
Xif (who == you && beep) {
X    move_string(card_names[card],T_cant_play + 17,20);
X    message(T_cant_play,FALSE);
X    }
X}
X
X/************************************/
X/* prints don't need error messages */
X/************************************/
Xdont_need(who,card,beep)
Xint who;
Xint card;
Xint beep;
X{
Xif (who == you && beep) {
X    move_string(card_names[card],T_dont_need + 17,20);
X    message(T_dont_need,FALSE);
X    }
X}
X
X/*************************************/
X/* prints exact score error messages */
X/*************************************/
Xexact_miles(who,score_limit,beep)
Xint who;
Xint score_limit;
Xint beep;
X{
Xif (who == you && beep) {
X    if (score_limit == 700)
X         message(T_exact_700,FALSE);
X    else
X         message(T_exact_1000,FALSE);
X    }
X}
X
X/**************************************************/
X/* checks to see if the player can play that card */
X/* returns TRUE if he can, FLASE if he can't      */
X/**************************************************/
Xvalid_move(who,card_number,play,beep)
Xint who;
Xint card_number;
Xint play;
Xint beep;
X{
Xint other_guy;
Xint score_limit;
Xother_guy = who ? you : me; /* find out who the other hand belongs to */
Xscore_limit = extension ? 1000 : 700; /* get maximum miles */
Xswitch (hand[who][card_number]) {
X    case 0: {
X         if (who == you && beep)
X              message(T_no_card,FALSE);
X         return(FALSE);
X         }
X    case extra_tank: {
X         return(TRUE);
X         }
X    case puncture_proof: {
X         return(TRUE);
X         }
X    case driving_ace: {
X         return(TRUE);
X         }
X    case right_of_way: {
X         return(TRUE);
X         }
X    case gasoline: {
X         if (play)
X              if (hand[who][battle] == out_of_gas)
X                   return(TRUE);
X              else {
X                   dont_need(who,gasoline,beep);
X                   return(FALSE);
X                   }
X         else
X              return(TRUE);
X         }
X    case spare_tire: {
X         if (play)
X              if (hand[who][battle] == flat_tire)
X                   return(TRUE);
X              else {
X                   dont_need(who,spare_tire,beep);
X                   return(FALSE);
X                   }
X         else
X              return(TRUE);
X         }
X    case repairs: {
X         if (play)
X              if (hand[who][battle] == accident)
X                   return(TRUE);
X              else {
X                   dont_need(who,repairs,beep);
X                   return(FALSE);
X                   }
X         else
X              return(TRUE);
X         }
X    case end_of_limit: {
X         if (play)
X              if (hand[who][limit] == speed_limit)
X                   return(TRUE);
X              else {
X                   dont_need(who,end_of_limit,beep);
X                   return(FALSE);
X                   }
X         else
X              return(TRUE);
X         }
X    case roll: {
X         if (play)
X              if (hand[who][battle] == stop ||
X                  hand[who][battle] == gasoline ||
X                  hand[who][battle] == spare_tire ||
X                  hand[who][battle] == repairs)
X                   return(TRUE);
X              else {
X                   dont_need(who,roll,beep);
X                   return(FALSE);
X                   }
X         else
X              return(TRUE);
X         }
X    case out_of_gas: {
X         if (play)
X              if (hand[other_guy][battle] == roll &&
X                  ! (hand[other_guy][safety] & 0x1))
X                   return(TRUE);
X              else {
X                   cant_play(who,out_of_gas,beep);
X                   return(FALSE);
X                   }
X         else
X              return(TRUE);
X         }
X    case flat_tire: {
X         if (play)
X              if (hand[other_guy][battle] == roll &&
X                  ! (hand[other_guy][safety] & 0x2))
X                   return(TRUE);
X              else {
X                   cant_play(who,flat_tire,beep);
X                   return(FALSE);
X                   }
X         else
X              return(TRUE);
X         }
X    case accident: {
X         if (play)
X              if (hand[other_guy][battle] == roll &&
X                  ! (hand[other_guy][safety] & 0x4))
X                   return(TRUE);
X              else {
X                   cant_play(who,accident,beep);
X                   return(FALSE);
X                   }
X         else
X              return(TRUE);
X         }
X    case speed_limit: {
X         if (play)
X              if (hand[other_guy][limit] == end_of_limit &&
X                  ! (hand[other_guy][safety] & 0x8))
X                   return(TRUE);
X              else {
X                   cant_play(who,speed_limit,beep);
X                   return(FALSE);
X                   }
X         else
X              return(TRUE);
X         }
X    case stop: {
X         if (play)
X              if (hand[other_guy][battle] == roll &&
X                  ! (hand[other_guy][safety] & 0x8))
X                   return(TRUE);
X              else {
X                   cant_play(who,stop,beep);
X                   return(FALSE);
X                   }
X         else
X              return(TRUE);
X         }
X    case miles_200: {
X         if (play)
X              if (hand[who][miles] + 200 <= score_limit &&
X                  hand[who][battle] == roll &&
X                  hand[who][limit] == end_of_limit &&
X                  hand[who][cnt_200] < 2)
X                   return(TRUE);
X              else {
X                   if (hand[who][miles] + 200 > score_limit)
X                        exact_miles(who,score_limit,beep);
X                   else if (hand[who][cnt_200] == 2) {
X                        if (who == you && beep)
X                             message(T_only_two_200,FALSE);
X                        }
X                   else
X                        cant_play(who,miles_200,beep);
X                   return(FALSE);
X                   }
X         else
X              return(TRUE);
X         }
X    case miles_100: {
X         if (play)
X              if (hand[who][miles] + 100 <= score_limit &&
X                  hand[who][battle] == roll &&
X                  hand[who][limit] == end_of_limit)
X                   return(TRUE);
X              else {
X                   if (hand[who][miles] + 100 > score_limit)
X                        exact_miles(who,score_limit,beep);
X                   else
X                        cant_play(who,miles_100,beep);
X                   return(FALSE);
X                   }
X         else
X              return(TRUE);
X         }
X    case miles_75: {
X         if (play)
X              if (hand[who][miles] + 75 <= score_limit &&
X                  hand[who][battle] == roll &&
X                  hand[who][limit] == end_of_limit)
X                   return(TRUE);
X              else {
X                   if (hand[who][miles] + 75 > score_limit)
X                        exact_miles(who,score_limit,beep);
X                   else
X                        cant_play(who,miles_75,beep);
X                   return(FALSE);
X                   }
X         else
X              return(TRUE);
X         }
X    case miles_50: {
X         if (play)
X              if (hand[who][miles] + 50 <= score_limit &&
X                  hand[who][battle] == roll)
X                   return(TRUE);
X              else {
X                   if (hand[who][miles] + 50 > score_limit)
X                        exact_miles(who,score_limit,beep);
X                   else
X                        cant_play(who,miles_50,beep);
X                   return(FALSE);
X                   }
X         else
X              return(TRUE);
X         }
X    case miles_25: {
X         if (play)
X              if (hand[who][miles] + 25 <= score_limit &&
X                  hand[who][battle] == roll)
X                   return(TRUE);
X              else {
X                   if (hand[who][miles] + 25 > score_limit)
X                        exact_miles(who,score_limit,beep);
X                   else
X                        cant_play(who,miles_25,beep);
X                   return(FALSE);
X                   }
X         else
X              return(TRUE);
X         }
X    }
Xreturn(FALSE);	/* never gets here */
X}
X
X/**********************************************************************/
X/*                                                                    */
X/*              UTILITIES TO MAKE MOVES                               */
X/*                                                                    */
X/**********************************************************************/
X
X/****************************/
X/* makes the requested play */
X/****************************/
Xplay_card(who,card_number,play)
Xint who;
Xint card_number;
Xint play;
X{
Xint other_guy;
Xint play_again;
Xother_guy = who ? you : me; /* find out who the other hand belongs to */
Xplay_again = FALSE;
Xif (play)
X    switch (hand[who][card_number]) {
X         case extra_tank: {
X              hand[who][safety] |= 0x1;
X              change[who][safety] = TRUE;
X              if (hand[who][battle] == out_of_gas) {
X                   hand[who][battle] = roll;
X                   change[who][battle] = TRUE;
X                   if (card_number != 6 && hand[who][coups] & 0x10)
X                        hand[who][coups] |= 0x1;
X                   }
X              play_again = TRUE;
X              break;
X              }
X         case puncture_proof: {
X              hand[who][safety] |= 0x2;
X              change[who][safety] = TRUE;
X              if (hand[who][battle] == flat_tire) {
X                   hand[who][battle] = roll;
X                   change[who][battle] = TRUE;
X                   if (card_number != 6 && hand[who][coups] & 0x10)
X                        hand[who][coups] |= 0x2;
X                   }
X              play_again = TRUE;
X              break;
X              }
X         case driving_ace: {
X              hand[who][safety] |= 0x4;
X              change[who][safety] = TRUE;
X              if (hand[who][battle] == accident) {
X                   hand[who][battle] = roll;
X                   change[who][battle] = TRUE;
X                   if (card_number != 6 && hand[who][coups] & 0x10)
X                        hand[who][coups] |= 0x4;
X                   }
X              play_again = TRUE;
X              break;
X              }
X         case right_of_way: {
X              hand[who][safety] |= 0x8;
X              change[who][safety] = TRUE;
X              if (hand[who][battle] == stop) {
X                   hand[who][battle] = roll;
X                   change[who][battle] = TRUE;
X                   if (card_number != 6 && hand[who][coups] & 0x10)
X                        hand[who][coups] |= 0x8;
X                   }
X              if (hand[who][limit] == speed_limit) {
X                   hand[who][limit] = end_of_limit;
X                   change[who][limit] = TRUE;
X                   if (card_number != 6 && hand[who][coups] & 0x20)
X                        hand[who][coups] |= 0x8;
X                   }
X              if (hand[who][battle] == gasoline ||
X                  hand[who][battle] == spare_tire ||
X                  hand[who][battle] == repairs) {
X                   hand[who][battle] = roll;
X                   change[who][battle] = TRUE;
X                   }
X              play_again = TRUE;
X              break;
X              }
X         case gasoline: {
X              hand[who][battle] = gasoline;
X              change[who][battle] = TRUE;
X              if (hand[who][safety] & 0x8)
X                   hand[who][battle] = roll;
X              break;
X              }
X         case spare_tire: {
X              hand[who][battle] = spare_tire;
X              change[who][battle] = TRUE;
X              if (hand[who][safety] & 0x8)
X                   hand[who][battle] = roll;
X              break;
X              }
X         case repairs: {
X              hand[who][battle] = repairs;
X              change[who][battle] = TRUE;
X              if (hand[who][safety] & 0x8)
X                   hand[who][battle] = roll;
X              break;
X              }
X         case end_of_limit: {
X              hand[who][limit] = end_of_limit;
X              change[who][limit] = TRUE;
X              break;
X              }
X         case roll: {
X              hand[who][battle] = roll;
X              change[who][battle] = TRUE;
X              break;
X              }
X         case out_of_gas: {
X              hand[other_guy][battle] = out_of_gas;
X              change[other_guy][battle] = TRUE;
X              hand[other_guy][coups] |= 0x10;       /* a coup is possible */
X              break;
X              }
X         case flat_tire: {
X              hand[other_guy][battle] = flat_tire;
X              change[other_guy][battle] = TRUE;
X              hand[other_guy][coups] |= 0x10;       /* a coup is possible */
X              break;
X              }
X         case accident: {
X              hand[other_guy][battle] = accident;
X              change[other_guy][battle] = TRUE;
X              hand[other_guy][coups] |= 0x10;       /* a coup is possible */
X              break;
X              }
X         case speed_limit: {
X              hand[other_guy][limit] = speed_limit;
X              change[other_guy][limit] = TRUE;
X              hand[other_guy][coups] |= 0x20;       /* a coup is possible */
X              break;
X              }
X         case stop: {
X              hand[other_guy][battle] = stop;
X              change[other_guy][battle] = TRUE;
X              hand[other_guy][coups] |= 0x10;       /* a coup is possible */
X              break;
X              }
X         case miles_200: {
X              hand[who][miles] += 200;
X              change[who][miles] = TRUE;
X              hand[who][cnt_200]++;
X              change[who][cnt_200] = TRUE;
X              break;
X              }
X         case miles_100: {
X              hand[who][miles] += 100;
X              change[who][miles] = TRUE;
X              break;
X              }
X         case miles_75: {
X              hand[who][miles] += 75;
X              change[who][miles] = TRUE;
X              break;
X              }
X         case miles_50: {
X              hand[who][miles] += 50;
X              change[who][miles] = TRUE;
X              break;
X              }
X         case miles_25: {
X              hand[who][miles] += 25;
X              change[who][miles] = TRUE;
X              break;
X              }
X         }
Xelse
X    discard = hand[who][card_number];
Xhand[who][card_number] = hand[who][6];
Xchange[who][card_number] = TRUE;
Xhand[who][6] = 0;
Xchange[who][6] = TRUE;
Xhand[who][coups] &= 0x0F;        /* remove possible coup */
Xreturn(play_again);
X}
X
X/*********** end of program **********/
END_OF_move.c
if test 17881 -ne `wc -c <move.c`; then
    echo shar: \"move.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f screen.c -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"screen.c\"
else
echo shar: Extracting \"screen.c\" \(13542 characters\)
sed "s/^X//" >screen.c <<'END_OF_screen.c'
X/* screen.c */
X/* maybe */
X
X/**********************************************************************/
X/*                                                                    */
X/*           MM   MM  IIIIIII  L        L        EEEEEEE              */
X/*           M M M M     I     L        L        E                    */
X/*           M  M  M     I     L        L        EEEE                 */
X/*           M     M     I     L        L        E                    */
X/*           M     M  IIIIIII  LLLLLLL  LLLLLLL  EEEEEEE              */
X/*                                                                    */
X/*      BBBBBB    OOOOO   RRRRRR   NN    N  EEEEEEE   SSSSSS          */
X/*      B     B  O     O  R     R  N N   N  E        S                */
X/*      BBBBBB   O     O  RRRRRR   N  N  N  EEEEE     SSSSS           */
X/*      B     B  O     O  R    R   N   N N  E              S          */
X/*      BBBBBB    OOOOO   R     R  N    NN  EEEEEEE  SSSSSS           */
X/*                                                                    */
X/*                                                                    */
X/* Creation: Edmond Dujardin                                          */
X/*           (c) 1962 Parker Brothers, Inc.                           */
X/*                                                                    */
X/* Written by: Brett K. Carver                                        */
X/*             Hewlett-Packard, 1983.                                 */
X/*                                                                    */
X/* Copyright: (c) Brett K. Carver, Hewlett-Packard, 1986.             */
X/*                                                                    */
X/**********************************************************************/
X
X#include "miles.h"
X
X/**********************************************************************/
X/*                                                                    */
X/*              CONSTANTS AND VARIABLES                               */
X/*                                                                    */
X/**********************************************************************/
X
X/**********************************/
X/* external procedure definitions */
X/**********************************/
X
Xextern format();
Xextern place_string();
Xextern initialize_card_set();
Xextern deal_card();
Xextern remove_card();
Xextern message();
Xextern write_screen();
Xextern clear_screen();
X
X/*********************************/
X/* external variable definitions */
X/*********************************/
X
Xextern int hand[2][15];         /* current status of players */
Xextern int change[2][15];       /* parallel structure of booleans */
Xextern int deck[20];            /* shufled deck of cards */
Xextern int cards_played[20];    /* set of cards already played */
Xextern char *card_names[40];    /* array of pointers to pointers to text */
Xextern int discard;             /* card being discarded */
Xextern int extension;           /* boolean for extension */
Xextern int delayed_action;      /* boolean for delayed action game */
Xextern int whose_turn;          /* you, me, or -1 if game done */
Xextern int play;                /* play=TRUE, discard=FALSE, drawn=-1 */
Xextern char *screen;            /* screen buffer */
Xextern int card_number;         /* card to play */
Xextern int debug;               /* flag for debug output */
X
Xextern char *T_dealing_cards;
X
X/**********************************************************************/
X/*                                                                    */
X/*              UTILITIES TO PUT GAME INFORMATION ON THE SCREEN       */
X/*                                                                    */
X/**********************************************************************/
X
X/***********************************************/
X/* writes hand and score information to screen */
X/***********************************************/
Xdisplay_hand(who)
Xint who;
X{
Xint temp;
Xint i;
X/********** put up score **********/
Xif (change[who][miles])
X    format(hand[who][miles],miles_loc + (who * 40));
X/********** put up 200 count **********/
Xif (change[who][cnt_200])
X    switch (hand[who][cnt_200]) {
X         case 0: {
X              place_string(card_names[safe_trip],cnt_200_loc + who_loc,20);
X              break;
X              }
X         case 1: {
X              place_string(card_names[one_200],cnt_200_loc + who_loc,20);
X              break;
X              }
X         case 2: {
X              place_string(card_names[two_200],cnt_200_loc + who_loc,20);
X              break;
X              }
X         }
X/********** put up safeties **********/
Xif (change[who][safety]) {
X    temp = 0;
X    if (hand[who][safety] & 0x1) {
X         place_string(card_names[extra_tank],temp + safety_loc + who_loc,20);
X         if (hand[who][coups] & 0x1)
X              place_string(card_names[coup_fourre],
X                           temp + safety_loc + who_loc + 16,12);
X         else
X              place_string(card_names[blank_line],
X                           temp + safety_loc + who_loc + 16,12);
X         temp++;
X         }
X    if (hand[who][safety] & 0x2) {
X         place_string(card_names[puncture_proof],temp + safety_loc + who_loc,20);
X         if (hand[who][coups] & 0x2)
X              place_string(card_names[coup_fourre],
X                           temp + safety_loc + who_loc + 16,12);
X         else
X              place_string(card_names[blank_line],
X                           temp + safety_loc + who_loc + 16,12);
X         temp++;
X         }
X    if (hand[who][safety] & 0x4) {
X         place_string(card_names[driving_ace],temp + safety_loc + who_loc,20);
X         if (hand[who][coups] & 0x4)
X              place_string(card_names[coup_fourre],
X                           temp + safety_loc + who_loc + 16,12);
X         else
X              place_string(card_names[blank_line],
X                           temp + safety_loc + who_loc + 16,12);
X         temp++;
X         }
X    if (hand[who][safety] & 0x8) {
X         place_string(card_names[right_of_way],temp + safety_loc + who_loc,20);
X         if (hand[who][coups] & 0x8)
X              place_string(card_names[coup_fourre],
X                           temp + safety_loc + who_loc + 16,12);
X         else
X              place_string(card_names[blank_line],
X                           temp + safety_loc + who_loc + 16,12);
X         temp++;
X         }
X    }
X/********** put up limit **********/
Xif (change[who][limit])
X    place_string(card_names[hand[who][limit]],limit_loc + who_loc,20);
X/********** put up battle **********/
Xif (change[who][battle])
X    place_string(card_names[hand[who][battle]],battle_loc + who_loc,20);
X/********** put up hand **********/
Xtemp = 0;
Xif (who == you || debug)        /* <=========================== debug */
X    for (i=0; i<7; i++) {
X         if (change[who][i])
X              place_string(card_names[hand[who][i]],
X                           temp + hand_loc + who_loc,20); /* place card name */
X         temp++;
X         }
Xelse                            /* <=========================== debug */
X    for (i=0; i<7; i++) {
X         if (change[who][i])
X              place_string(card_names[0],
X                           temp + hand_loc + who_loc,20); /* blank out cards */
X         temp++;
X         }                      /* <=========================== debug */
X/********** put up discard and card count **********/
Xplace_string(card_names[discard],discard_loc,20);
Xformat(deck[0],cards_left_loc);
Xwrite_screen();
Xfor (i=0; i<15; i++)
X    change[who][i] = FALSE;
X}
X
X/***********************************************/
X/* shows which card and how it is to be played */
X/* -2 for direction means clear play           */
X/***********************************************/
Xdisplay_pick(direction)
Xint direction;
X{
Xchar *string;
Xplace_string(card_names[blank_line],card_number + hand_loc - 10,10);
Xif (direction == -2) {
X    write_screen();
X    return;
X    }
Xcard_number += direction;
Xif (card_number < 0)            /* this allows wrapping of the pointer */
X    card_number = 6;
Xif (card_number > 6)
X    card_number = 0;
Xif (play == TRUE)
X    string = card_names[Play];
Xif (play == FALSE)
X    string = card_names[Discard];
Xif (play == -1) {
X    string = card_names[Drawn];
X    play = TRUE;
X    };
Xplace_string(string,card_number + hand_loc - 10,10);
Xwrite_screen();
X}
X
X/**********************************/
X/* debug routine to show the deck */
X/**********************************/
Xdisplay_deck()  /* <=========================================== debug */
X{
Xint temp;
Xint i;
Xtemp = 0;
Xfor (i=5; i<20; i++) {
X    format(cards_played[i],temp + safety_loc + 64);
X    temp++;
X    }
Xwrite_screen();
X}
X
X/***********************************/
X/* initializes the screen for play */
X/***********************************/
Xinitialize_game ()
X{
Xint i;
Xmessage(T_dealing_cards,TRUE);
X/* initilaize the variables */
Xinitialize_card_set(&cards_played[0]);
Xinitialize_card_set(&deck[0]);
Xfor (i=0; i<15; i++) {
X    change[you][i] = TRUE;
X    change[me][i] = TRUE;
X    }
Xhand[you][miles]= hand[me][miles]= 0;
Xhand[you][cnt_200] = hand[me][cnt_200] = 0;
Xhand[you][safety] = hand[me][safety] = 0x0;
Xhand[you][limit] = hand[me][limit] = end_of_limit;
Xhand[you][battle] = hand[me][battle] = stop;
Xhand[you][coups] = hand[me][coups] = 0;
Xdiscard = 0;
Xextension = FALSE;
Xdelayed_action = FALSE;
Xwhose_turn = you;               /* you move first */
Xfor (i=0; i<6; i++) {
X    hand[you][i] = deal_card();
X    hand[me][i] = deal_card();
X    remove_card(&cards_played[0],hand[me][i]);  /* mark cards me seen */
X    }
Xhand[you][6] = hand[me][6] = 0;
X/* initilaize the screen */
Xrefresh_screen(FALSE);
X}
X
X/*************************/
X/* refresh entire screen */
X/*************************/
Xrefresh_screen(score_too)
Xint score_too;
X{
Xint i;
Xclear_screen(start_loc);
Xplace_string(card_names[YOUR_STATUS],start_loc + 10,16);
Xplace_string(card_names[MY_STATUS],start_loc + 50,16);
Xplace_string(card_names[Miles],miles_loc - 10,16);
Xplace_string(card_names[Miles],miles_loc + 30,16);
Xplace_string(card_names[Hand],-1 + hand_loc - 10,16);
Xplace_string(card_names[Last_Discard],discard_loc - 20,16);
Xplace_string(card_names[Cards_Left],discard_loc + 20,16);
Xfor (i=0; i<15; i++) {
X    change[you][i] = TRUE;
X    change[me][i] = TRUE;
X    }
Xdisplay_hand(you);
Xdisplay_hand(me);
Xif (score_too)
X    tabulate_score(FALSE);
X}
X
X/**********************************************************************/
X/*                                                                    */
X/*              UTILITIES TO COMPUTE THE SCORE FOR THIS GAME          */
X/*                                                                    */
X/**********************************************************************/
X
X/***************************************/
X/* counts the number of bits on in lsb */
X/***************************************/
Xcount_bits(value)
Xint value;
X{
Xint count;
Xint i;
Xcount = 0;
Xfor (i=0; i<4; i++) {
X    if (value & 1)
X         count++;
X    value >>= 1;
X    }
Xreturn(count);
X}
X
X/************************************/
X/* tabulate the score for this game */
X/************************************/
Xcompute_score(who,keepers)
Xint who;
Xint keepers;
X{
Xint other_guy;
Xint the_score;
Xint trip_complete;
Xint count;
Xint temp;
Xother_guy = who ? you : me;
Xthe_score = 0;
Xplace_string(card_names[Scoring],result_loc + who_loc - 20,16);
Xformat(hand[who][miles],result_loc + who_loc - 10);
Xplace_string(card_names[S_miles],result_loc + who_loc,20);
Xtemp = 1;
Xthe_score += hand[who][miles];
Xcount = count_bits(hand[who][safety]);
Xif (count > 0) {
X    format(count,temp + result_loc + who_loc - 10);
X    place_string(card_names[S_safety],temp + result_loc + who_loc,20);
X    temp++;
X    the_score += count * 100;
X    }
Xif (count == 4) {
X    place_string(card_names[S_4_safeties],temp + result_loc + who_loc,20);
X    temp++;
X    the_score += 300;
X    }
Xcount = count_bits(hand[who][coups]);
Xif (count > 0) {
X    format(count,temp + result_loc + who_loc - 10);
X    place_string(card_names[S_coup_fourre],temp + result_loc + who_loc,20);
X    temp++;
X    the_score += count * 300;
X    }
Xif (trip_complete = hand[who][miles] == (extension ? 1000 : 700)) {
X    place_string(card_names[S_trip_complete],temp + result_loc + who_loc,20);
X    temp++;
X    the_score += 400;
X    }
Xif (trip_complete && deck[0] == 0) {
X    place_string(card_names[S_delayed_action],temp + result_loc + who_loc,20);
X    temp++;
X    the_score += 300;
X    }
Xif (trip_complete && hand[who][cnt_200] == 0) {
X    place_string(card_names[S_safe_trip],temp + result_loc + who_loc,20);
X    temp++;
X    the_score += 300;
X    }
Xif (trip_complete && extension - 1 == who) {
X    place_string(card_names[S_extension],temp + result_loc + who_loc,20);
X    temp++;
X    the_score += 200;
X    }
Xif (trip_complete && hand[other_guy][miles] == 0) {
X    place_string(card_names[S_shut_out],temp + result_loc + who_loc,20);
X    temp++;
X    the_score += 500;
X    }
Xplace_string(card_names[Hand],score_loc + who_loc,16);
Xformat(the_score,score_loc + who_loc + 10);
Xplace_string(card_names[Game],score_loc + who_loc + 20,16);
Xif (keepers)
X    hand[who][score] += the_score;
Xformat(hand[who][score],score_loc + who_loc + 30);
X}
X
X/***********************************************/
X/* figures out this games score for you and me */
X/***********************************************/
Xtabulate_score(keepers)
Xint keepers;
X{
X/* clear lower part of screen */
Xclear_screen(result_loc);
Xcompute_score(you,keepers);
Xcompute_score(me,keepers);
Xwrite_screen();
X}
X
X/*********** end of program **********/
END_OF_screen.c
if test 13542 -ne `wc -c <screen.c`; then
    echo shar: \"screen.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
echo shar: End of archive 1 \(of 2\).
cp /dev/null ark1isdone
MISSING=""
for I in 1 2 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked both archives.
    rm -f ark[1-9]isdone
else
    echo You still need to unpack the following archives:
    echo "        " ${MISSING}
fi
##  End of shell archive.
exit 0