|
|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T e
Length: 3678 (0xe5e)
Types: TextFile
Names: »exper.c«
└─⟦b20c6495f⟧ Bits:30007238 EUUGD18: Wien-båndet, efterår 1987
└─⟦this⟧ »EUUGD18/General/Bidding/exper.c«
/* experiment.c */
/*
Bridge Bidder Version 3.0
by John Oswalt and Nathan Glasser
..!sun!megatest!jao (usenet)
nathan@brokaw.lcs.mit.edu (internet)
nathan@mit-eddie.uucp (usenet)
June, 1989
------------------------------------------------------------------------------
Copyright 1988, 1989 by Nathan Glasser and John Oswalt.
You may feel free to distribute this program in its current form.
Please do not remove this copyright information.
*/
/*
*
* Routines to do an experiment.
* John Oswalt
* (Using structures by Nathan Glasser.)
*/
#include "bidding.h"
#define TRUE 1
#define FALSE 0
#define SPADE2 0
#define SPADE3 1
#define SPADE4 2
#define SPADE5 3
#define SPADE6 4
#define SPADE7 5
#define SPADE8 6
#define SPADE9 7
#define SPADETEN 8
#define SPADEJACK 9
#define SPADEQUEEN 10
#define SPADEKING 11
#define SPADEACE 12
#define HEART2 13
#define HEART3 14
#define HEART4 15
#define HEART5 16
#define HEART6 17
#define HEART7 18
#define HEART8 19
#define HEART9 20
#define HEARTTEN 21
#define HEARTJACK 22
#define HEARTQUEEN 23
#define HEARTKING 24
#define HEARTACE 25
#define DIAMOND2 26
#define DIAMOND3 27
#define DIAMOND4 28
#define DIAMOND5 29
#define DIAMOND6 30
#define DIAMOND7 31
#define DIAMOND8 32
#define DIAMOND9 33
#define DIAMONDTEN 34
#define DIAMONDJACK 35
#define DIAMONDQUEEN 36
#define DIAMONDKING 37
#define DIAMONDACE 38
#define CLUB2 39
#define CLUB3 40
#define CLUB4 41
#define CLUB5 42
#define CLUB6 43
#define CLUB7 44
#define CLUB8 45
#define CLUB9 46
#define CLUBTEN 47
#define CLUBJACK 48
#define CLUBQUEEN 49
#define CLUBKING 50
#define CLUBACE 51
/*
* Variables used by deal_hand(). The trick is to fill one or more
* hand, using some of the cards, and let deal_hand() deal out the
* rest randomly. Set hand_setup[n] iff hand n is pre-dealt.
* mark cardsused[n] iff card n has been pre-dealt. Set cards left
* to 52 - 13N, where N is number of pre-dealt hands.
*
* default_predeal() is provided for when no hands are predealt.
*
* experimentq is a function provided to test whether the deal qualifies
* under the terms of the experiment.
*/
experimentq(pdeal)
deal *pdeal;
{
card *h0 = pdeal->hands[0]; /* Stoopid compiler. */
card *h1 = pdeal->hands[1];
card *h2 = pdeal->hands[2];
card *h3 = pdeal->hands[3];
if (suitcount(h1, DIAMONDS) != 7) return FALSE;
if (hcp(h1) > 11) return FALSE;
if (suitcount(h1, HEARTS) > 3) return FALSE;
if (suitcount(h1, SPADES) > 3) return FALSE;
if (suitcount(h1, CLUBS) > 4) return FALSE;
if (cardinhandq(h1, SPADES, ACE)) return FALSE;
if (!cardinhandq(h1, DIAMONDS, ACE)) return FALSE;
if (hcp(h0) > 11) return FALSE;
if (suitcount(h0, HEARTS) > 5) return FALSE;
if (suitcount(h0, SPADES) > 5) return FALSE;
if (suitcount(h0, CLUBS) > 6) return FALSE;
if (suitcount(h2, SPADES) < 5) return FALSE;
if (countlosers(h2) > 6) return FALSE;
if (countlosers(h2) < 5) return FALSE;
return TRUE;
}
default_predeal(pdeal)
deal *pdeal;
{
int player, cardnum;
for (cardnum = 0; cardnum < 52; cardnum++) {
cardsused[cardnum] = 0;
}
for (player = 0; player < 4; player++) {
hand_setup[player] = 0;
}
cardsleft = 52;
}
int experiment_hand[13] = {
SPADE9,
HEARTACE, HEARTKING, HEARTQUEEN, HEART9, HEART3, HEART2,
DIAMONDKING, DIAMONDQUEEN, DIAMONDJACK,
CLUBACE, CLUB6, CLUB2
};
experiment_predeal(pdeal)
deal *pdeal;
{
int i, cardnum;
card *thehand = pdeal->hands[3];
default_predeal(pdeal);
hand_setup[3] = 1;
cardsleft -= 13;
for (i=0; i<13; i++) {
cardnum = experiment_hand[i];
cardsused[cardnum] = 1;
thehand[i].suit = cardnum / 13;
thehand[i].rank = 2 + (cardnum % 13);
}
}