|
|
|
|
|
|
Writing Rules for Bridge - Organizing the Rules
Back
|
|
|
|
|
|
|
The language as defined so far provides for writing rules that can examine some
number of qualities, make decisions based upon the values of those qualities,
and perform some actions. But, there must also be some way to organize the
rules. That is, there needs to be some way to associate rules which perform
similar functions. For instance, all of the rules pertaining to the opening bid
should be together, separate from the rules which perform the responder's second
bid. To organize a set of rules, the language defines the concept of a
group.
A group of rules consists of a purpose and its associated rules. The purpose is
a one line description of the bidding situation addressed by the group. You have
already seen what the rules themselves look like. To illustrate rule groups,
here is a set of rules as they are displayed in the game's editor.
This is a set of rules for bidding a hand.
Rules name: Simple
File name: E:\bridgex\rbgb2.xml
Opener examines hand before first bid
Opener's first bid
Responder reviews partner's first bid
Responder's first bid
Opener reviews partner's first bid
Opener's second bid
Responder reviews partner's second bid
Responder's second bid
Opener's left opponent's first bid
Opener's right opponent's first bid
|
The first line indicates that this set of rules is used during the bidding
process. The second line gives the name of the rules and the third line the name
of the file where the rules are stored.
The remaining lines are the purposes of each group. You will notice that some
lines are in plain text and are indented while other lines are in bold. The
plain text lines represent groups that are used to review another player's bid.
These groups should be used to set the values of qualities such as the best suit
or the meaning of another player's bid. The bold lines are groups of rules used
to make the player's bids.
The group's purpose describes the bidding situation where the group's rules will
be used. The game keeps track of the bidding process and selects the appropriate
rule group for each player's turn.
The game keeps track of each player's turn and selects the appropriate group of
rules for each bidding situation.
|