Document 11242893

advertisement
100
C*******··A' •••••• *** •••• ** ••••••• *** ••••••• ***.**** •• *.* ••••••••••••••• )
\...,
,(*
(*
.)
'~*
~,(*
PAO\RAM
Pai r _odd_lien (39)
P~POSE
This lIIodule pairs any odd lIan froll ahove and, if
necessary, rellioves an odd lIan froll! the current
score group.
''',..-,(..
,..--C..
,--.
~'
DATE : "'ay 2
-"-C"
...
,--,:; ~AOC EDUR E
.~
~-.
'~
:--YAR
"T7
...... '-
Varying
[1]
;~
..
~
"
"
-'-,
-i---~
--, (
"- -,
"
~
~--.
..
.)
(.
DECLA'~
( ..
EXTERNAL
REFE~ENCES
.,
.)
%Include "47"
%Include 148 1
Wrileln( •
If' Odd_IIIan_pending
Then Regin
Pair_odd_lIIan_frolll_~bove:
Odd_lIan_pending := false:
End:
If
*)
*)
*)
.,
*)
~t*.*****···*··***·*·******·***·**·******************* ••
.~."'~
.)
NUlllber_in_group RE'" 2 )
Then Begin
=1
Rellove_odd_~an_frolll_group;
Odd_IIIan_pending := True;
End:
-End:
of Char:
_* .... * ••••• *** •• )
1 01
(******************* .. *****.* ••• ***.*.**** ••• ** ••• ***** •••••••••••••• ** •• )
(*
{*
*)
PROGRA":
~*
C
!.'
:_'_'
Pair_score_group (3a)
PURPOSE':' Thi s .odule pai rs
(*
~. . - ( *
t
DATE: April 9
he current store group.
~>...;....;..-. (*** ********.** _•••••• A* •• ******* __ **" ***
">, :,-,.'?".~~~.
'<'~'PROC
--- ~~..".:~
,
.ft .•
ft • •
*)
*)
*)
.,
*" ft • • • • A.ft" •• "" ** fr.**.* .. )
EDURE
...
.--
'-_
,
,
..
."'.~~
....
c_,
- .."".~... t.
~~
Varying [1] of Char;
t
---(*
c_~:,~;
*)
DECLARE EXTERNAL REFERENCES
*)
.)
,--"--
%Include '49'
%Include '4a'
Xlnclude '4b'
Begin
Writeln('
Pairinq store qrouo • • • ');
I
Legal_pa1rings_exist := True;
C
"atth_top_with_bottorni
--eli.inate_illegal_oairinqs;
- I f Legal_pairings_exist
Then Allocate_colors
Else Begin
LibSErase_paqe(Row:=l ,Col:=1);
Lib$Set_cursor(Row:~10,Col:=1);
Writeln('
Help!!
A ~ituation has ~risen in one of the score groups');
Writeln('
that I am unable to resolve (1iven the current status of .y');
Writeln('
software!). Take a look at the oairing cards and resolve this');
Write ('
problem. Hit <RETURN> to continue: ');
Readln (Dummy_character);
End;
-...:.
..
102
.(**.*******.**~*
C*
'-:',1,
••• * ••••• *.*.** ••• * ••• ** •• ** ••• ***.*.******* •• *** ••• ***.)
.)
"")
.)
.)
C*
.)
(********.************************ ••• ******** •• **********.***** ••• ******)
PROGRAM
Print_pairing_list <3b)
DATE: I'Iay 9
''-::':'-:: C * '
- , , ' . ' (*
.P,URPOSE
This lIodule prints the newly-made pairing list.
(*
" ',-,~
-,_.'
, ~ -';-1'
.•.~ ~:
'-
•
;-,~.J
.. ,. '~,.
r .. ...:
"
4"
'1,
'_."
........
"
,"
,<'
PROCEDURE
;"
VAR
Du ••,y_charact er
Varying [1) of Char;
Index
I nt,ege r;
Print_selection
Char;
Oesired_queue
Varying
Table_nu.ber
Packed array [1 •• 2) of Chari
Player1_na'lIe
Player2_nalle
(10)
of Char;
,
Packed array (1 •• 30] of Chari
Player1
Player2
Function Character(Oigit
Inteqer)
Begin
,Case Digit of
1
Character:: '1 ,;
2
Character:= '2';
3
Character:= I~';
4
Character:~ '4';
5
Character:= '5';
'6
Character:= .~,;
7
Character:= '7';
8
Character:~ '8';
9
Character:= '9';
End: .
End;
Val" Dtgit1 , Digit2 : Chari
Begin
Char;
103
-,
--~---:-'-.-""
,,-,~;;," ..
,\
,-----
Rudv(Table_nu"ber,oi 9i tl ,Oi qi tZ);
,\
If oigit2 < '9'
Then Table_number := oigitl + Succ(OigitZ)
Else If oigitl = , ,
Then Table_number := '1' + Succ(Oigit2}
Else Table_number := Succ(Oigit1) + Succ(OigitZ):
, End:
,
w
, .:
'1--"
-
- "
, ,-
Procedure Write_header:
. Beg1n
, Writeln( P a i I' i n 9_ list
write-tn( Pairing_lht
·f'-" Writ e l n ( Pairing_list
'WrHeln( Pa i ri n 9_ lis t
. 'Wl'iteln( P a i r1 n 9_ list
writetn( Pairin9_list
WI'Heln( P air i n 9_ t. is t
writeln( Pai ring_l ist
Writeln( Pairing_list
Wrheln( P a i ri n 9_l is t
. End:
) ;
);
, 'TOURNAMENT
)i
, + Character(Round_number) );
, 'ROUND
)
;
)
;
,
'T~~LE
, ,-----
WHITE
)i
Procedure Write_pairing_lines;
Begin
Table_nu~ber
:= , 1';
Playerl
While Playerl <> Nil 00
Begin
Findk(Tourn~ment_roster'O,PlayerlA.P~irin1_number)i
Playerl_name :=
Tourn~ment_rosterA.Na.e;
Then geqin
Player2_name := 'oY:';
Playerl := Pl3yerl A .Next_c3rd;
End
Else Beqin
Playet? := Playerl A .Next_cardi
findk(Tcurnament_roster,O,Play~r2A.Pairino_"umber);
Player2_name :=
Tournament_rosterA.Na~e;
Playerl := Player2 A .Next_c'!rd;
End:
--
BLACK') ;
, - - - - - - - - - - - - - - - - - - - - - - - - ______ 1
104
writeln(Pair in 9_ li st ,
.
~---
.,
<1:
t',
+ Table_number +
• + Player1_name +
+ Player2_name );
r'.".":
End;
'-',
',t'"
,
.~
".". .'
End;
Writeln( •
T
,.'
,
<,,;
'
.
,: ."
:i.
"
"
, "'
(.*
CREATE THE PAIRING LIST
..
Preparing pairing list file • • • ');
)
Rewrlte(Palrlng_llst);
Write_header;
,
Open (Tournament_roster
,
:= Old
History
Organization
:= Indexed ,
);
Access_method
:= Keyed
Rese t k (Tou r,na.en t_ ros t e r,O);
Write_pairing_lines;
Close(Pairing_list);
,-
~Close(Tour',na.ent_roster);
(*.
PRINT THE PAIRINr, LIST
.*)
LibSErase_page(Row:=1Q,Col:=1);
LibSSet_cursor(Row:=10,Col:=1);
Writeln( 1
(1)
Writeln(1
U)
Writ eln( I
(3)
Print oairing list to attached printer');
Print p~iring list on selected queue');
Return to main menu');
LibSSet_cursor(Row:=lt,Col:=l);
Write, (I
Enter your selection
Readln(Print_selectlon);
While Not ( Print_selection in ( 'I' , '2' ,
Begin
');
'3' ] ) Do
LibSErase_page(Row:=1~,Col:=1);
LibSSet_cursor(Row:=17,Col:=l);
Writeln{'
INVALID SELECTION! !');
writeln;
Write ('
Enter your selection: ');
ReadlnCPrint_selection);
End;
Case Print_selection of
'1'
• 2'
For Index := 1 to 3 00 LibSSpawn('QPrt Pairing_llst.dat');
Begin,
fibSE rase_pa,ge(RolI:= 16,Col: =1);
105
-...,...----- -- - ---
• 3'
.";"
~
,.
:Vi
1:
,.,-'~
.
.~.;
-
LibSSet cursor(Ro~:=17'Col:=1);
Write ('
Enter tlesired Queue: ');
Readln (Desired~Queue);
LibSSpawn('Print' + Oesired_queue + ' Pairing_tist.Oat/Copies=3');
Endi
;
LtbSSet_cursor (Row :=19,Col :=1);
Wrtte (.
Hit <RETURN> to continue
R•• dln (Du •• y_character);
r;;·~,~~>.
End;
')i
106
---;--;;;'~.-
,,-..
~"''';'''1
-
'
(************.**.* ••• *•• *** •• * •••• *.* ••• **** •• ~*.* •••• •••••••• ** •••••••• )
. (*
(*
~*
i.'
.,:-:--(*
PROGRAM
Update_pairing_cards (Jc)
PURPOSE
Thi s module updates the player records and the
pairing cards for the new pairings.
-.-'.-;(*
DATE :
~ay
1~
*,
*,
*,
*)
.)
:' i U··,--( *
•)
:~\__ ·/.~C.***.**1fr********.* •••• *** **** * .. * ... * •• *** *.* ... ** .*.* •• It • • fr • • • ,. * ft • • • • • • • ,..)
:""',c~
..,
,~1<i;tltR~C.EOUU
~-r-~
~'..-!'!.-~~
'':':'' Var
Curr , Prey
Score_value
Card_pointer;
Real;
i
...'-:-Y
'..-.r-'''L
. -:--Se9.i n
*.)
Prepare screen display
.~--(**
~lib$Erase_page(Row:=10,Col:=1);
Updating thp
"-""'rit eln('
-- (*.
..
Prepare fHe for reading
)
,
Tournament_roster
,
History
:= Old
Organization
:= Ind'!x~d ,
;
Access_",pthoj
:= Kpypd
.... 'Open
,
-Resetk< Tournament_roster
Initialize pointers
(**
,
0
)
;
.*)
Prev := Paired_pointer;
-'Curr := Prev".Next_card;
".
Perform update for each card
(**
... )
'While ( Prey <> Nil) and ( Curr <> Nil) 00
Begin
(*
Update color
du~
status on pairing cards .. )
Case preyA.Colof_due_status of
+3
-
,
pairin~_cards');
107
'.,.-
,
+2
+1
0
--
/.
V.
~".
',~
l~.
"--.--. ,.' ",' ........,....
t~
!'~~~1.:~:
.. .
'.
,~
.
-2
-3
PrevA.Color_due_status := +1 ;
Pre~A.Color_due_status
:= -1;
End;
Case CurrA.Color~due_$tatus of
+3
CurrA.Color_due_status
+2
CurrA.Color_due_status
+1
CurrA.Color_due_status
o
CurrA.Color_due_status
-1
:= -1;
:= +1.
:= -1;
:= -1;_
,
-2 ,
-3
End;
~
(*
- '-
-1
PrevA.Color_due_status := +2;
PrevA.Color_due_status := +1 ;
PrevA.Color_due_status := +1;
CurrA.Color_due_status := -2;
Update opponent on pairing cards
CurrA.Opponent[Round_numberJ :=
PrevA.Opponent[Round_number] :=
*)
PrevA.Pairin~_nu~ber;
CurrA.Pairing_nu~ber;
~-.
--~
"., .
(*
Update player records
*)
Findk (Tournament_roster, 0 ,
CurrA.Pairing_nu~ber);
:= PrevA.Pairing_nu~ber;
Tourna.ent_rosterA.Opponent[Round_nu~ber]
----
Tourna.ent_rosterA.Color(Round_nu~ber]
Findk (Tournament_roster, 0,
Tournaaent_rosterA.Color(Round number]
Update(Tournaaent_roster);
(*
Advance pointers .)
Prey := CurrA.~ext_card;
1 f Prey <> Nil
Then Curr := PrevA.N~xt_tard;
End;
Update records for byed player
.*)
I f Prey <> Nil
Then Begin
(* Assign byed player's score .)
Case ScorinCl_cyes ';f
'0'
Sccre_value := 1.0;
'1'
Score_value := 0.5;
End;
(*
-
's';
PrevA.Pairino_nu~opr);
~ourna.ent_rosterA.Opponpnt(Round_numb~rJ
(**
:=
Update(Tourna.ent_roster);
Update pairing card
*)
:= CurrA.PafrinQ_number;
:= 'W';
1 08
:= PrevA.Score + Score_value;
:= 'VI;
Pr~v".Score
Pr~v".Bye_given_status
Prev".Opponent[Round_nuMber] :: 'BYE';
<* Update player record
,:.~
....'.<Mo'-~
......
~
..
::~.
Findk (~ourna.ent_roster ~ 0, Prev"~Pairing_number);
Tournament_rosterA.Opponent[Round_number] ~= 'SYE';
TournaMent_roster".Color
[Round_number] ~= , ';
TournaMent_roster".Result [Round number] ~= Score_value;
Tourna.ent_rosterA.Score := Tournament_rosterA.Score + Score_value;
Update( Tournam.nt_r~st~r );
(*
.
Locate second-ta-last card in paired list
*)
Curr := Paired_pointer;
While CurrA.Next~card <> Prev Do Curr := Curr".Next_card;
(*
~--~
*)
Remove byed player from paired list and place in scored list
CurrA.Next_card := Nil;
PrevA.Next_card := Nil;
Scored_pointer := Prev;
End;
-,-'
Close fi le
.**)
End;
/
*)
109
(***** •• A •• *** ••• *********_**** ••• *** ••• ***********.*. ~***.* ••• *********)
(*
(*
\
(
,'-t*
•.-...,i'>;""-'(*
*)
PROGRAM
Create_crosstabll' (3d)
PURPOSE
Th;s .. odult Sl'rves as the control procedure
for creation of a new crosstable.
~(*
"":-- (*
~(*.*.****A*.**
''':'-'" (*
...:... (*
. .i....~ (*
DATE: Apr; l 27
•• *****.****.*.***.****.*.******.**.** • ••••••••••••••••••• )
DECLARE EXTERNAL REFERENCES
*)
*)
*)
%Include I 4c I
XInclude • 4d"
~
.....
XInclude "41.'"
.
==Segin
.... LibSErase_page(Row:=10,Col:=1);
--LibSSet_cursor(Row:=10,Col:=1);
(1)
- Writelne'
( 2)
_. WrftelnC"
(3)
-Wri teln('
(4)
--WrftelnC"
-. ,
Crosstable ;n wallchart order');
Crosstable in Qam~-score order");
Crosst~ble in tiebreak or~er");
Return to the ~ain ~enu');
---LibSSet cursor(Row:=16,Col:=1);
--Write C"
Fnter your selection
ReadlnCOrder_selection)i
');
--While'Not ( Order~select;on in ( "1' , "2 i , '3" , "4' ) ) Do
SeQin
LibSEraSe_pageCRow:=16,Col:=1);
LibSSet cursor(Row:=17,Col:=1);
WritelnC"
INVALID SELECTION!! I)i
Writeln;
Enter your selection: I);
Write (I
Readln(Order_selection)i
End;
---If Order selection <> '4'
Then Begin
(**
(**
ACTUAL PREPARATION OF CROSSTABLE
(**
If Order_selection
--
*)
*)
*)
*)
*)
**)
*.)
**)
~
'3' Then Elillinate_tied_scoresi
1 10
"
.........
Rewrite(Crosstable);
.;"-'"
Write_header_ite~s;
Write_de~ail_lines;
",.~
, ' j•. ..\,.,~
"\..- ..·I~--·
i~>~
,.
..
~nd;
',--
-
Close(Crosstable);
End;
111
(**.*.*****.**** ••• **~****.***.** ••• ****.**.*.* •• ***.* *.*.*** ••• ********)
(*
(*
.)
~*
~(*
'~'
PROGR""
Outllut_cross table (3e)
PURPOSE-
This ",odule serves as the control procedure that
allows the V'ler to 'lee the current cro'lstable.
....-(*
'+-'-(*
DATE :
~ay
14
.,
.)
.,
.,
.)
~t**·******·***···*********·*****·********·***A.*.**** **************** ••• )
:ot--
':¢
~1"ROCEDUR£
X
~{.~: t .~;
,
t,.~~.~
-,.
"
Output_crosstable;
,........--
~~.AR
~1
,~,
DU •• y_character
Desired_queue
Varying [1] of Char;
Varying [10] of Chari
..-.:. ...
~'LibSErase_page(Row:=10,Col:=1);
'. - - l i bS Set_cursor (Row :=1 0, Co l: =1);
.;"--'Writeln('
'-Writeln('
-Writeln('
(1)
(2)
(3)
Print to attached printer');
Print cross table on selected Queue');
Return to main menu');
---LibSSet_cursor(Ro.,:=16,Col:=1);
'-V.rhe ('
Enter your selecqon
-- Readln(Print_selection);
0);
'-'While Not ( Print_selection in [ '1' , °Z' , 'J' J) Do
gegin
LibSErase_page{Pow:=16,Col:=1);
LibSSet_cvrsor(p.ow:=17,Col:=1);
wrfteln('
INVALID SELECTION! !');
Writeln;
Write CO
Enter your selection: ');
ReadlnCPrint selection);
End;
--Case Print_selection of
, 1•
8egin
~ib$£rase_p~~e(Row:=l,Col:=l);
LlbS~et_cursor(Row:=l,Col:=l);
LibSSp3wn('~Prt Crosstable.DatO);
Writeln;
Writeln('
End of cro.stable file.";
IIrite ('
Hit <RETURN> to cont inue : .);
Readln {Dummy_charactert;
End;
'2 •
-
Bl!gin
1 12
LibSErase paQe(Row:=16,Col:=1);
liblSet_c~rSOr(Row:=17,Col:=1);
Write ('
Enter desired Queue: I ) ;
Readln (oesir~d_queue);
libSSpawnC"Pr1nt" + Desired_queue + • Crosstable.Oat");
libSSet_cursorCRow:=19,Col:=1);
Write Co
Hit <RETURN> to continue
Readln (Ou •• y_character);
End;
';:~~~~
.~
~
",,,,!,,,"-
";"~:"
• 3'
End;
;
113
(~**** •••
*******.*.**.* •• ** ••• *.* •• ******.*.*.**** •• ** •••• * •••• ft.**_ •••• )
(*
:~
.)
(*
PROGRA~
Assign_bye_to_odd_Man (45)
DATE: Aoril 30
PURPOSE
Thts'",odule locates the lowest·ranked eligible
pla),er and ass; gns hill a b),e.
-----til'
.. )
......... (*
-(*
,._: . ~******** *" ••••••• If .. "
*It •• "••
ft • • •
~7 PROCEDURE
'.~~."
Asstgn_bye_to_odd_un;
.;-·'VAR
. '-- . _ -r--.
:,~~.
Current
,
Previous
,
Byed.player ,
Before_byed
Card.pointer;
:.:~:.+~
,~
,:,~.
·-'1._~
.~
-;-:-
," -~-
._.- Procedure locate.lolle st_e l igib le_player;
Begin,
-..
Byed.player
Before.byed
Previous
Current
:= Nil ;
:= Nil ;
:= Scored~pointer;
:= Scored.pointer;
'Whiaeglorrent <> Nil 00
If CurrentA.Bye.given.status = 'N'
Then Seqin
Before.byed := Pr~vious;
Byed.olayer := Current;
End;
Prewious := Current;
Current := CurrentA.Next card;
'End;
End;
8egin
-. If Byed,.player = Scored.pointer
Then Scored.pointer
:= ~yed.playerA.Next.card
.Else Before.byedA.hext.card := Byed.playerA.Next.card;
-
.)
.)
* **~* ._" •••• " . . . . . . . . . . . . . . . . ft • • • • • "Ir.* •• )
"'~~
'- ',',t....".."
,~
.)
114
---.,....---,.---
-
Pafred_pofnter
End_of_paired
I.
,
,<
-
:= Oyed_playeri
:= Byed_player;
115
~(*'
PURPOSE
~(*
;~(*
module segregates a score group froM the
scored pointer list.
Thi~
/' . .4-(*
-. ..h~~ (******.*** .... ft*."* •• * •• **
_.
~'!
.......:..
*.*. *.* * *.,..,. .. * •• **** ..
•
ft . . .
* •• *ft • • • * •••• *.* It It* ft. **)
C., ~PROC EDUR E
~"'
'-.~~>
.~
' . ,.tJ-",,-
",,>+.~~.
Current, Previous
Group_score
Card_pointer;
Re al;
+--.-
--Begin
---"rUeln('
Creating a score group • • • ');
- ' I f Not Odd_Man.pendlng
'.
Then NUMber_In_group := 0
Nil
Else I f Odd_ManA.NeKt_c~rd
Then Number_ln_~r9uP : = 1
Else Nu~ber_in_group : = 2;
7-Previous := Scored_ooin~eri
----Current := Scored_pointer;
- ' I f Current <> Ni l
Then Begin
:= CurrentA.Score;
Group_score
:= CurrpntA.NeKt_card;
Current
NUlllber_in_1roup := Number_In_group + 1;
End;
---While ( Current <>
Begin
Previous
Current
NUMber_in_group
End;
Nil) and ( CurrentA.Score
: = Current;
:= CurrentA.Next_cardi
:= Number_in_group + 1;
----Score_group
:=\Scored_oointer;
--Scored_pointer
:= Current:
PreviousA.Next_card := Nil;
--End:
-
Group_score ) 00
116
,.,--,.'
.
.'
~.~
.
(******* •• ******** ••• ********.*********** •• ***********.******,*******.*.)
C*
C*
\....
*)
~*
.,":--C'(*
'~ .. ~*
PROGRAM
Pair_odd_man_from_above (47)
PURPOSE
This Module pai rs the odd man removed frolll the
previous score group with the highest-ranked
eligible player frail the current group.
:..--(*
DATE: Hay 2
- .-(*
*,
*}
*)
*)
*)
.)
-,"(****.***'* •••• ****.* * .*.* •.•• * *.* •••• *.* .... *.* ••• ft *' *** .............. * ...... * .... )
'-'. ,·......."ROCEOURE
.. ~
-'-,
···~AR
Integer;
Index
,
Eligible
El t 9_previous
Current
Current2
Previous
,-
No_eligible_player~
,
They_have_not_played ,
Player_is_eligible
Boolean;
~;.-'-,
Begin
Player_is_eligible := Fals~;
Previous := Score_1 r ou p;
Current := Score_group:
Repeat
They_have_not~played
:=
Tru~;
For Index := 1 to Roun1_number - 1 Do
If CurrentA.Cooonent(Indexl = Odd_"'~nA.Pairing_number
Then They_have_not_played := False:
If They_have_not_played
Then Player_is_eligible := True
Else Begi n
Previous := Current;
Current ~= CurrentA.Ne~t_card;
End;
Until ( Player_,s_eligible ) or ( Current
:
.
If Current
End;
= Nil
= Nil
);
Then No_eligible_players := True;
117
~---.--.~.--~
-
f" .'
---'
--,:
..
..".
8eg1n
If Current = Previous
Then Score_group
:= CurrentA.Next_card
Else preyiousA.Next_card := CurrentA.Next_card;
Current2 := Odd_Nan;
Odd __ an := Odd_ManA. Next_card;
End;
~rocedure
Insert(Var Fointer : Card_pointer);
Var Curr , Prey: Card_pointer;
--::.."-.
.......:....'..
Prey := Paired_pointer;
Curr := Paired_pointer;
While Curr <> End_ot_paired 00
Be,gin
Prey := Curr;
Curr := CurrA.Next_c~rd;
End;
It Paired_pointpr = End_~f_oairpd
Then Paired pointer := Pointer
Else PrevA.Ne~t_cdrd := Pointer:
.End;
Begin
Case CurrentZA.Color_dup_status of
+3
Odd_color := 'b';
+2
Odd_color := 'b';
+1
If CurrentA.Color_dup_status »
Then Odd_color := 'w'
Else Odd_color := 'b';
o
If CurrentA.Color_dup_status < 0
Then Odd_color := 'b'
Else Odd_color := 'w';
-1
If CurrentA.Color_dup_status < -1
Then Odd_color := 'b'
+,
118
-:,--;:,,:---~
.......,
-2
,:.",
-3
End;
-
....,........
..
.~ ',,~,~
.
...
~':,7-'-;
.
,;f· ......:..-:.
, -.......-.
."J'~.'
-_.
Else Odd_color ;= 'Wi;
Odd_color := 'w';
Od~_color := fbi;
I f Odd color =
The~ Begin
~f'~~
~
:
'w'
Insert(CurrentZ);
Insert(Current);
End
Else Begin
Insert{Currerit);
Insert(CurrentZ);
End;
CurrentA.Odd __ an_status := CurrentA.Odd Man status + 1;
CurrentZA.Odd __ an_status := CurrentZA.Odd_.a~_status - 1;
End;
-'--"
,.-;-'
,---- ,Begin
locate_an_eliglble_player;
If No_eligible_players
Then Number_in_group ;= Number_In_group - 1
Else Begin
Remove_players_from_lists:
Insert_players_in_pair~d_list;
~u.ber_in_9rouo
End;
Nil:
End;
-
-=
Number_in_group - 2;
119
, (********.************* ••••• ****.***.** ••••••••••••••• * •••• _•••••••••••• )
(*
*)
,...
(*
-t*
:. :-',*
PAOGA_M
R!.ov!_odd_~an_frOM_grOUp
PURPOSE
TlI1~
---<*
t
"'-<' , . ; '
DATE: May 3
.,
.)
.,..0--(*
;'-
(48)
Module reilloves the odd man froll a score
group.
.)
.)
.)
~t*** •••••• ******** Itlt.,,_ •• *.* •••• It It • • • "'* •• * ••••• It '* •• * ••• * •••• * * ••• It • • • • • ,,)
-;·PROC EDUR E
.'.
':"~'~-~'.
,
Current
Previous
,',
, .
_. ,·""'-1Iegin
Find
l~st
card of
scor~.grouD
-- Current points to it
. -::- Current· := Score_group;
:= Score_group;
-Previous
.~.!
Current .... Ne.t_card <> Ni l Do
Begin
Previous := Current;
Current
End;
~While
--(**
Reillove this card from the score Qroup list
- If Current = Previous
Then Score_group
El~e
.*)
:- Nil
tI i l;
PreviousA.Ne~t_carct
: -
-Current .... Next_card :- Nili
t**
Place card in odd
~Jn
list
•• )
Then Odd_IIIan := Current
Else Begin
(**
Find last card in odd man list - Previous points to it
Previous :- Odd_"an;
While PreviousA.~ext_card <> Nil Do
Previous := Prev10us A .Next card;
(** Place odd-man card
-
,
..
)
120
--,
-.--~--";"-:-....----
_.-
pointed to by Current ,
in the odd-~~n list
,
after the card
pointed to by Previous •• )
,,,.
End;
'~~--Nu.ber_in_group:= Nu.ber_in_group - 1;
-:'.~
'----'-''';-
,
.'
-,'?End;
-~:~:~.
,',
-
>
.
1 21
•
'--'-IE.'~
,'
t.*·**·***·******·*·*~******·**·**·**·*··*··*·***·*·*·.~*.* •••••• *** •• **)
. v';":;~ .(*
r
.)
1
,J;:
.
::
(*'
'r t ~,\~.
(*.
,.~' (*
PROGRAII
P~RPOSE
Match_top_lIith_bottoli (49)
DATE: ADril 9
Thi S lIodule rlat thes the top ha l f of the score
group \lith the bottoll half.
.)
.)
.)
..)
.~:** *""***"""*".*" "••• "•• *':**. *." *" "" .. *** .,,*. ".**""""" * "",. *."." "." " ....... : ~
,i;· '-.~:~.'
,.
'"" PROCEDURE
~: .,--~~~'.
~.~:~::J~:'~
~"
'~~c;,VAR
t....
,-:~,;.
';}.~:-!
\'~'.~;
t
Varying Clj of Char;
Current
I
Indexl , Index2
Integer;
",~::'"
Current := Score_group;
I,,·
,
I
For IndexZ :=
to 2
00
to "ullber_;n_group DIV 2 00
For Index1 :-=
Segin
PairingClndexl,Index?] := Current;
Current := CurrentA.Next_card;
End;
End;
.. '
-
'.
122
'-""'''''',,~,'''',,''--~~--~--
-'
-
- ..
"
'
~~~'. (************ fl • • • • • • • fI* It • • • • _ • • • • fl • • • • • _
'--.
t:",:, i'"
',";'
~
,
••••••
**.* .. * ***. It *Ir.* It • • • • • _ • • Jr_)
*)
(*'
·t·
:(*
ti.....
PROGRAM
Eli~inate_illegal_pairings
(4a)
DATE: May 12
(*
,'c --. },i. ,.'
PU RP0 S E T his .. 0 d u lee l i .. ; nat e s i l l ega l p a ; r s •
(....
(*
*)
*)
")
*)
(*********************** •• **************** ••• ********** ••• * •••• _- ••••••• )
;>
. ,-.~;S.<lt~ ..
r"
p..AO~
EDUR.E
• ~ t < ••'
, '-,
.
...... ~
'"'"
~
~'t
'.''''·'·VAR
Varying [1 ] of Char;
Du •• y_character
.T~·: ~
,.:·~,h;
..
..
-,.f·
,.'
Pairing_Is_invalid
Switch_Is_bad
More_to_check
No_.ore_above
No_.ore_below
Highest_palri,ng
Index
'
Round
Offset
,
,
,
,
Boolean;
,
,
,
Integer;
Card_pointer;
Hold_card
Procedure Oetermine_if_pairing_is_valid;
Begin
Pairin9_is_invalid := False;
For Round := 1 to Pound_nu!I'h('r - 1 D'J
If Pairing(ln1ex,1]~.Pairinq_number
Then Pairin,_ls_invali1 ;= True;
End;
Begin
More_to_check
Switch_Is_bad
No_more_below
No_mare_above
Offset
:= True;
:= True;
:= False;
:= False;
:= 1;
While Svitch_is_bad and More_to_check 00
Begin
--
123
--·~-~f-~(;~;~~:!:.~"''''
,l.,
,~
,,;.' '"
';-',-'
,~"';- >"
...;.
"";', ,_. ~v-
•. ,or..,';
..
".
~'
•
:-', .
,.r
If Not NO_IIore_below
Then If Indell + Offset <= Highest_pairing
Then Begin
Switch_is_valid := True;
For Round := 1 to Round_nuNber - 1 00
Regin
If PairinqCIndex,1JA.Pairin9_nuNber = Pairing[Indell+Offset,2JA.Opponent[RoundJ
Then Switc~_ts_valid := False;
If PairingCIndex+Offset,1JA.Pairin9_nUliber = Pairing[Indell,2]A.Opponent[RoundJ
Then Switch_is_valid := False;
End;
,:.:~~~:,
• L
'.
If Switch_is_valid
T,hen Begin
Hold_card
:=
Pafring[Index,2J
:=
Pairing[Index+Offset,21 :=
Switch_is_bad
.:=
End;
End
Else NO_IIore_below := True;
:':~ni!~;,
• J"
" ,
.o;;~:
_.
Pairing[Index,?];
Pafrfng[Indell+Offset,Z];
Hold_card;
False;
. ,If Not HO_IIore_above
Then If ( Index - Offset> 0 )' and Switch.is_bad
Then Begin
Switch_is_vaLid := True;
For Round : = 1 to Ilound_nullber - 1 00
:leg; n
If P~;rinq(Index,1)A.Pa;ring_number
PairingClndex-Offset,Z]A.Opponent[RoundJ
Then Switch_i5_valid := Fal~e'
If PairinQCIndex-Offset,1]A.Pdiring_nu~ber
Pafring[lndex,Z]A~Opponent[RoundJ
Then Switch_is_valid := False.
'n c!'
If Switch_is_valid
Then 3eg;n
Hold_card
:= PairingCIndex,2);
:= Pairing(Index-Offset,2];
Pairing[Inoex-Offset,2J := Hold_card;
Switch_is_bad
:= False;
Pairing(Index,~]
~nd;
End
Else
No_more_~bove
I
:= True.
If HO_lIore_above and ~o_lIor~_below
.Then More_to_check : = Fa l se
else Offset
:= Offset + 1;
End;
, End;
Var
Boolean;
-
124
,
: Integer;
'~.
.segin
Special_Mark
While ( S~itch_is_bad ) and (
Begin
y": .
.~':.~:"' ..': .~
,t·:;"
:= Index + 1:
S~ecial_~ark
<= Hiqhest_pairing ) Do
Svitch_is_valid := True;
Round := 1 to Round_nuMber - 1 Do
;: , Begin ..
~;~or
"1'0\
. ,:!~f>'
~}.
:".
" ....
If Pairing[Index,lJA.pairing_number
Then S~itch_is_valid := false;
End:
•
"
Svitch_h_vaUd'
Then Begi n '
Hold_card
:= Pairing[Index,2J;
Pairing[Index,2J
:= Pairing[Special_mark,2];
Pairing[Special_mark,?J := Hold card:
:= False;
S~itch_is_bad
End
Else Special_mark := Special __ ark + 1:
I.'
..
..,.',.
End;
End: '
Procedure Sort_remaining_pointers;
Var
I
,
J
Integer;
Begin
For I := Index + 1 to Highest_pairing Do
For J := Index + 1 to Highest_pairing - I Do
If Pairing[I,l]A.PairinQ_number >
Then Begin
Hold_card
:= Pair;nq(I,l):
Pairing[I,1)
:= Pairing[I+l,lJ:
Pairing(Itl,lJ := Hold_card:
End;
End;
125
----_--:----"--,>7',·
'
, ,
L ;
~,proc.du~e
~ ;';~f
'.';',
Resolve_on_left_side;
.'" ' ,', :
V.a,.
SWHch_ i ,_valid
-'- -, Speci al_aark
Aoolean;
Integer;
_~egin
1A-1... '.
Special_aark
:~
Highest_pairing;
While ( Switch_Is_bad ) and ( Special_mark> Index) Do
,Beg1n
:~,-,; _:,(',:;'Slilitch h valid:= True;
:·..,~;~-~,';.'C, for Ro-;;nd-:= 1 to Round_nuaber - 1 Do
'. pi~/~, _,'
-"
:;;0;\~;ttF 1·
.-t..'"
"'":;~
"
',,., ...
Y'
8e91 n
" I f Pair1ng[Index,t) .... Pairing_nulllber
Then Slili tCh_ is_valid := false;
=
<.
,~!,>~'.
',_.
,
,
y.
<
I f Switch_is_valid
.Then Begin'
Hold_card
Pairing[IndeM,2]
Pairing[Special_,ark,1)
Switch_Is_bad
,:~"
:=
Pairing[IndeM,21;
:= Pairing[Special_IIIark,1J;
:= Hold_card;
:= false;
Sort_reaaining_pointers;
End
Else Special_.ark ':= SpeciaL_lIIdrk - 1;
End;
End;
Begin
For Index := 1 to Highest_od!ring Do
Begin
Deter.ine_if_pairing_is_valid;
,
If Pairing_is_invalid Then Resolve_pairing_problem;
If SwitCh_iS_bad
.Then qesolve_on_ri,ht_side;
If SwitCh_iS_bad
Then Resolve_on_left_sidei
If Switch_iS_bad
Then Legal_pairings_exist := F~tse;
End;
End;
.-
126
(**.*** •••• **********.*** •• **.** ••••• *** •••••••••••• ** •••••••••••••••••• )
-
(*
(*
(*
.)
~ (*
,.;~ (*
PROGRAI'I
At locate_colors (4b)
PURPOSE
This .odule allocates colors to the pairings.
~~r(***********.~**
OA E
:
May 7
Okay, Should, Must );
Priority
VAR
Varying [1] of Char;
S .. i tch_ i s_.ade
.. ore_to_check
No_.ore_above
No.,..ore_below
Highest_pairing
Index
Round
Off set
,
,
,
Boolean;
,
,
Integer;
Color_change
Pri od tyi
Color_lIatril(
Array [ -3 •• +3 , -3 •• +3 ] of Integeri
Seed
Real;
Function For$Secnds(Value:Re3l):Reat; El(ternal;
Function I'IthSRandom(Seed :Real):Real; External;
Function Color_priority ( Left, Rite: Integer
Begin
Priority;
If ( Abs(Pairin~[L~ft,lJA.Color_due_status) >~,
and
( Abs(Pairing[Rite,2JA.Colo,_due_status) >= 2
Then Color_~riority := ~ust
Else If ( Abs(Pdirfnq[left,lJA.Color_jue_~t3tus) > 0
( ~bs(Pairing(Rfte,2J·.Color_due_st3tuS) ) 0
Then Color_priority := ShouLd
Else Color_priority := Okay;
End;
-
*)
*)
.)
••• **** ••••• ** •• ***.*.*.** ••• * •• *** ••••••••••• ***** ••••• )
, TYPE
','
.)
an1
127
Procedure Init_color_watriK:
~,<;",;,l ~
F
~,
,
•
'---;,'
Begin
.',.",,
•
-i~'"
!."'"
</:~.
'.
~.: ;~~~f:~ .
t,,: .
"~;~'~h
:.
~-
.
{J ... ,'"
';,~.",
~ .~
..
,
~
..
<'
"",
, .'1'.,r,·
Color_latriK[+3,+3J
Color_.atriK[+3,+2]
Color_.atriK[+3,+lJ
Color_.atriK[+3, OJ
Color_.atriK[+3,-lJ
Color_lIIatrix[+3,-2J
Color_ •• triK[+3,-31
Color_ •• triK[+2,+3J
Color_.atriK[+2,+21
Color •• atrix[+2,+11
Color_.atrfK[+2, 0]
Color_.atriK[+2,-1J
Color_.atriK[+2,-2J
Color_.atrix[+?,-J]
Color_latrix[+1,+3J
Color_latriK[+1,+2]
Color_.atrix[+1,+1)
Color_latri~[+1, 0]
Color_latrix[+1,-11
Color_latrix[+1,-2J
Color_latrix[+1,-3J
Color _.atri K[ 0,+3 ]
Color_.atriJ([ 0,+2]
Color_latrix[ 0,+1 ]
Col'or_latrh[ 0, 0]
CoLor_lIIatriK[ 0,-1 ]
Color_.atrix[ (\ ,-2]
CoLor_latriJ([ 0,-3]
:= 2:
:= 1:
:'" 2:
:= 2:
:= 2;
:= 2:
:'" 2;
:= 2:
:= 2;
:= 2;
:= ?;
:= 2;
:= 2;
:= 2 ;
:= 1 ;
:= 1 :
:= 2:
:= 2;
:= 2;
:=
,.
~,
:= 2;
: = 1;
:= 1 ;
Color_lIIatriK[-l,+~]
:= 1 :
Color_lIIatriK[-1,+2J
Color_MatriK[-1,+1J
Color_lIIatriK[-l, OJ
Color_lIIatrix[-1,-11
Color_lII.triK[-1,-2J
Color_Matrix[-1,-3J
Color_lIIatrixC-2,+3]
Color_lIIatriK[-2,+21
Color_lIIatrix[-2,+11
Color _Iat r i xC-2, OJ
Color_l.triK[-2,-1J
Color_lIIatrfx[-2,-2J
:= 1 :
Color_lIIatrix[-3,+2]
Color_lII.trix[-3,+1J
Color_",atrh[-J, OJ
Color_lIIatrix[-3,-l]
Color_matrix[-3,-21
Color_IIIatrix(-3,-3J
:= 1 :
:= 1 ;
::: 1 :
:= 1 :
:=
:= 1 ;
: = 1;
:= 1;
:= 1;
:= 1 ;
Color~1II8trix[-?,-3] := t;
Color_lIIatrix[-3,+3] := 1 ;
:= 1 :
:= 1 :
..,.
:= , ,
:= 1 ;
:= 1 ;
: = 1:
,.
:= ",
.
: = ,' ,
:=
z;
End;
Begin
l1ore_ to_check
swftch_ i s_lIIadl!
NO_lIIore_below
NO_lore_above.
OffHt
While ( Not
Begin
:=
Tru~;
:= False:
:= f.1ls(";
: = false;
:= 1 ;
S~itch_is_~~de
) and (
~ore_to_cH~ck
If Not NO_lore_below
Then If ( Index + Offset <= Highest_pairing
-
1;
:= 2;
:= 2:
:= 1 :
) 00
128
Tnen f<e,i'1
Switc~_is_valid
:=
Tru~'
For Pound :~ 1 to Pound_nu.b.r - 1 Do
Dtgin
If Pairin.(Ind.x,1JA.Pairing_nu_ber
Palrlng(Index+Oftset,2JA.Opoonent[Roundl
T~en Switch_Is_valid := false;
It Palrlng[Index+Offset,11A.Palring_nu.b~r = Pairin9[In~ex,2]A.Opoonent[RoundJ
Then Switch_Is_valid := False;
=
end;
If Switch_Is_valid
Then It ( Color_orlority(Index,Index+Jffsetl < Color_cnan;e
and
( Color_pri4rity(Ind.x+Otfset,Index) < Color_change
Then Begin
Hold_card
:= Pairln~[Index,21;
Pairing [Indu,2J
:= Pairin1[Index+Offset,2J;
'Plirlng[Index+Offset,Zl := Hole card;
Swltch_is_.a~.
:= True:
End;
,lse
If Not
En"
~o_~ore_~elow
:= True;
~o_.ore_above
Then If ( Incex - Offset> 0 , and ( Not Swltch_is __ ade
Then ~e.in
Swltc~_ls_valid := True.
For Round := 1 to ~ound_nu.Der - 1 Do
:<egln
If P~irlng(Index,1]A.Palring_nu.ber = Pa;rln~[Inde.-Offset,2JA.Oooonent[RoundJ
Tnen Switch_is_valid := False;
If Pairin9(I~dex-Offset,11A.Pairlng_nu.ber
Then Switch_is_valid :=False;
~'1d;
If Switch_is_valid
Then If C Color_prlorityCIndex,Index-Offsetl < Color_change
and
C Color_prlorityCIndex-Offset,Indexl < Color_cnanqe
Then Be:;ln
kol:!_card
:= Pairln1[!nd~x,2];
Pairlng[Index,21
:= Pairino[Index-Offset,Z];
Palring(Index-Offset,?] := Hold card;
Switch_is __ ade
:= True:
End;
End
Else No __ ore_aoove :~ True;
-:',.
.J
If No __ ore_above and ~o_~ore_bplow
Then ~ore_to_check := False
Else Offset
:= Offset + 1;
~~t.dure
Switch_the_cards;
;: Bellin
, Hold,.clrd
:,= Pairing[Index,1J;
airing[Index,1l :- PairingCInde.,2li
.r: ,.
,I...
~:.~
--
.,-_._----- .
...~; ..•
.
" '" r'
.~.>~~~~~;!'
129
_ _...
·~·rr
___· _ ·
•
.... _, .• - - - - - - ._.. _ . _ - - - _ . _ - - - - - - - .-
pairin9(Injr.,:J :=
End:
Procrdure
Beo;in
...
Hol~_Cdrd;
~ak,_color_assi;n.ents;
=
If Round_number
1
Then
If ( ( Offset = 1 ) and ( (Index RE~ 2)
( ( Offset = Z ) and ( (Index RE" 2)
Then Switch the ca~ds
Else tle.in
z
0
1
or
~nd
Else
flegin
If Color_matrix [ Pairing[Inde.,1JA.Color_due_status , Pdirin"(lnde.,2JA.Color_due_status J
Then 3witch_the_cards;
(0 ELSE cards are already arranged correctly.)
End;
End;
Begin
Highest_pairing := Nu.ber_in_9roup DIY 2;
Init~color_matrix;
For Index':= 1 to Hi~hest_pairin~ Do
Bellin
. • _c
If Color_change> Okay
Then Iaproye_color _sche.e;
End; :
Round_nuMber z 1
Then Begin
Seed := ForSSecnds(Yalue: 2 0.O);
If "thSRandoa(Seed) >= 0.5
Then Offset := 1
Else Offset := 2;
End;
:a 1 'to Highest_pairing. Do
}'f+(A~{~~~i;':it·.
.,
y
('
:~~~r; '.~ "
2
•
130
End;
-
1 31
I
(.** •• * ••• *.*.**~*** •••• *A.****.*.***.* •• ****.**** •• ** •••••••••••••••••• )
(*
o.)
(*
PROGRA~
Eli.inate_tied_scores (4c)
DATE: April 27
.)
~M-(*
PURPOSE
This .odule perfor.s tiebreak procedures on the
the list of scored pairing cards.
.)
.)
-,*
.' :'"'-::-(*
,,;:;..:-.(*
~t1:~**1r .********.******* *Ir ",*.A._ •••••••••••• • _Irlr Ir. ft • • "
~;':·:';t~·
'
:..:'~.
. . . . . . . . . . . . ft . . .
.)
.)
*****.*)
Ii> ;··',...~ROCEDURE
~~,~[~'~.: ' .
Elhinah_tied_scores;
Varying [1] of Chay;
,,-,-" (*
;'--- (*
•. ...;..'(* -
.)
DECLARE EXTERNAL REFERENCES
o.)
.)
-a,egin
(*o.**l
-. (****)
~-
~(****)
;
.~
.
-;- LibSErase_paqe(Rol/:=1 ,Col:=1);
-- Lib SSe t _ cu r s or ( Ro w : =1 , Col : ~ 1 ) ;
Writeln("
This option has not been codified yet.
Your crosstable l/ill be");
--Wr'lteln('
"tiebrokt'n" on the basis of pairing CHd nUlllber (rating) only.');
Write (0
Hit <R£TURN> to continue:
.-. Read In( Du •• y _chara ct e r);
-- Wri t eln;
End;
-
I);
132
~--~r~
.. '"
,-~~
. - .~-:~~~. (.*****.****** •••• ***.**.***** ••• ** ••••••••••••••••••• * ••••••••••••••••• )
:~." .~~:~~~;: ~~ /
.
(*
.. )
~'~,~ 1t±.(~***
.
"
..:.,>
PROGRA..
PURPOSE.
(*
f;.;.l~'(*'·
(*11***** A".*** •• *** * ••••• *ft*. * •• 1111 * *•••• **.**.* ** ••••••••••• * •• II
":; ··~··.r;3;·
""l
.
~:l')~~
;., ~;.
:~
Wri te:-header _ i t ellis (4d)
DHE : Apri l 27
,This ~odule writes the header for the crosstable
to the crosstab le fi leo
*.
.
*)
*)
*)
*.- * ••• )
'PIIOC EDUR E
~:~(.:~~1~.~:. ~
"'"
':'f'1~"
.
. Writt_header_ite.s;
~<'i";<
'~' ._}fj/ ~ A~
Index
Char_rounds
Date_string
Header_string
Integer;
Char:
Varying [100J of Char:
Varying (100] of Char:
;.--
,.
Begin
Writing header ite.s to the Crosstable file
Writelne I
a
•
0");
ResetCTournalllent_statistics);
Readln
Readln
,Readln
Readln
Readln
Readln
Readln
(lournalllent_statistics,Tournament_na",e);
(TournaMent_stati~tics,Sponsor);
(Tourna.ent_statistics,Director);
(Tournalllent_statistic~,Site);
(Tourna.ent_statlstics,St3rtinQ_date);
(Tourna",ent_stati~tics,~ndln~_date);
(Tournaaent_statistics,Nurnber_of_rounds);
Writeln(Crosst3ble);
Writeln(Crosstable,'TOURNA~ENT
Writeln(Crosstable);
Writeln(Crosstable,'SPONSO~
, + Tournament_name):
, + Soonsor ,
If Starting_date ~ Ending_date
Then Date_string := 'OAT~
Else Date_string := 'ST~~TS
,
+
.-
4
Char_rounds:= '4';
5
Char_rounds:= -'51;
,
Startin~_d3te
, + Startin,_dlte +
Writeln(Crosstable,Oate_strinq);
Writeln(Crosstable,'SITE
' + Site);
-- Writ etn( Crosstabl e);
Writeln(Crosstabte);
Header_string := ~';
For Index := 1 to Nu~ber_of_rounds 00
Begin
Case Index of
,
Char_rounds:= '1';
2
Char_rounds:= '2';
3
Char_rounds:= '3';
'DIRECTOR
'E~OS
+ Directod;
133
6
7
'..~,.:,."
.'J.' f
,8
;~-~,
'0::;~~~~~~'
.
~ ~:.
:,eo,
9
End;
Header_string :: Header_string + • 1- • + Char_rounds + • -I ":
End;
Writeln( Crosstabtl!,' No.
Wrtteln(Crosstable);
"
'
.......
.-
'6';
Char_rounds
Char_rounds := '7';
Char_rounds := • 8' ;
Char_rounds := '9";
Player
Rati ng
,
+
Header_string + •
Total');
134
~m~f.r ~- -~r-~
~
.
.'~
'-
~
*._ •.• ********.*.**** •••• fr.****** •••• ** ••• )
Wrhe_detail_lines (4e)
May
:~
( •• ***************** ••• **A ••••
~::,:~~f.:_ .::
f';;. ;.'*,'(*
{!;}fr-(*
PROGRAJiI
PURPOSE
-/-:-(* .
OATE
:
13
This .odule wri tes the player-entry detail lines
to the crosstable file.
.)
.)
.)
',__ " ,. ;'~(**. ****:1: ******* •• *****. ***** *** ........... * **** ••• frill • • '** ** ". ft_** ........ ** ... _* *.)
i·
t·
~;-'~
"
~­
'~:-'"TYPE
'_.
--
-.
Three
char = Packed array [1 ••
.
J]
of Char;
Varyinq [1] of Chari
Du •• y_character
: Ca'rd_Doint er;
Current
Player_record;
Player
Integer;
lnde.
Char;
Result_char
Varying [80] of Chari
Result_list
Function Printable(Score : q ea l ) : Three_char;
Begin
If Score
0.0 Thpn Printable := '0.0'
0.5 Then Printable := , 0.5 '
Else If Score
Else I f Score = 1.0 Then Printable := • 1. U •
1 .5 Then Printable := , 1 .5 '
Else I f Scor e
2.3 Then Printable := ' 2.0'
Else If Score
2.5 Thpn Printable := , 2.5 '
Else If Sc or e
3.0 TIlen printable := , LO'
Else If Score
3.5 Then Printable : = , 3.5 '
,Else I f Scar I'
Else If Score
4.0 Then Printable ': = , 4.0'
4.5 Then Print-'lble := , 4.5 •
Else If Score
5. :~ T~en Printable := , 5 •.) •
Else 1 f Scor e
5.5 Then Printable : = , 5.5 •
Else I f Score
Else If Scor e
6.0 Then Printable := ' 6.0'
El se If Score = 6.5 Then pri ntab le := ' 6 • 5 '
7 •.J Then Orint'lble : = • 7. J t
Else If Score
Else If Score
7.5 Then Printablp : = , 7.5 '
11.0 Then Printable := • 'I. Cl '
El se If Score
R.S Then Printat>le : = • d. S'
Else If Score
9.0 Then Pr intable := , 9. a';
Else If Score
End;
-'.
·A··
..1. __
n-;--
-
F unc t i on Result_ hn ( Cpp
Begin
Three char
Res
'lea l )
Chari
135
If Opp = '
Then Result_fxn := ' ,
Else If Res = 1.0
Then Result_fln := oW'
Else If Res = ~.5
Then Result_fxn := 'D'
Else If Res = 0.0
Then Result_fln := 'L';
)II , -:~,":' ~._
Z ."~)':+-.
~'-:~{t.~t
-.
;'~'proc edure wri te_B_ Un ei
,........,..;..
"
'.'
Begin
,;>,.~-;
_4:t'f.~.\·~<
,';;:
. '
>
;;.'·~'··:-'·.'··If
,~
...
,
",~~,
>~
i·
Order_select ion = '1'
Then With Player Do
Begin
Result_list := " ;
For Index := 1 to Nu~ber_of_rounds ~o
8eq'6t_ch~r := Result_fxn(Opponent[lndexl,Result(Index);
Result_list := Result list
+ , • +
Result:char
+ • , +
Opponent[lndex]
+"
+
Color[Index]
+ • ';
End;
write
(Crosstable,PalrlnQ_nu~ber
Name
Ratin,!
Result_list
+ •
+ "
+ •
+,
+
+
, +
,
)i
WritelnCCrosstable , Printable<Score) );
End
,Else Begin
Result_list := " i
For Index:=
to Number of rounds do
Begin
Result_char := Result fen
( Tournament_ro;terA.Oooonent[Index] ,
Tournament_rosterA.Result[Index]
);
Pe~ult_list
End;
-
.
+ • , +
Ilesult char
+ ' • +
Tournament_rosterA.ODronent(lndex] + • • +
Tournament_rosterA.Color[lndex]
+ ' ';
:= Result_list
136
Write
(Crosstable,
Writeln(crosstable ,
TournaMent_rosterA.patrinq_nu~ber
+
Tournament_rosterA.Name
TournaMent_rosterA.~ating
+
+
Result_list
+
Printable(Tourn~ment_rosterA.Score)
+
+
+
I
II
I
I
I
I
);
End;
_~
-Segin
..... -
::~
---
Writing detail lines to the Crosstable file • • • 1);
c_
:,'-"'1 Order _selectio~
=
'1
I
Then Begin
Reset(Tournament_roster);
While not Eof(Tournament_roster) do
Begin
Read(Tourndment_roster,Player);
Write_a_line;
EndEndi
Else Begin
Open (Tournament_roster
,
History :=- Old
~
Organization := Indexed,
Access_method := Keyed
);
Current := scored_pointer;
While Current <> Nil do
Begin
F'ndk(Tournament_roster,O,CurrentA.PairinQ_number);
Write_a_line;
Current := CurrentA.Next_card;
End;
End;
--Close(Tournament_roster);
Write ('
-Readln (Dummy_character);
-
End;
Hit <RETURN>
,) ;
);
137
.. :....
'
1"
~'.i':'
$!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
~,
$!
:, :';:" """$!
",'
PROGRAM NAME : Prt.Cqm
....... ;.--s!
. "-$!
,~,:t:~:i
DATE: April 1, 1936
AUTHORS
Rhonda Graft and Eugene Wallingford
PURPOSE
This .odules prints a file to the local printer.
:'" ....... $!
": }"'__.
,~'$!
>'~:~S
~",
! ! !! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !
,.......-s
~,
,<.~
~~ "~.,."'>':~!
'E .. :,~"S
OPEN/READ/ERROR=BELLS FNA"E 'P1'
CLOSE FNAME
ON CONTROL_Y THEN GeTO CT~LY
'->--S WRITE SYUOUTPUT "[st"
-~TYPE
'P1"
,,'~_~s WRITE SYSSOUTPUT "[41"
r,
~
WRITE SYS$OUTPUT ...
,. -:-; EXIT·
, ',;""-S
RL Y:
"-'/2=-:
-s·
_·S
.....:. ~ .
cr
~:gE SYSSOUTPUT "4(;"
BELLS:
WRITE SYSSOUTP,UT
EXIT
-
TESTING AND ANALYSIS OF THE SOFTWARE
If the world like it not, so much the worse for them.
Joseph Cowper
-
139
TESTING OF THE SYSTEM
rhough considerably more testing was done on the system,
I include here a sample run so that the reader can observe
The test data was taken from the
the system in action.
Eastern Indiana Open (played on May 10-11, 1986) and simulates the final three rounds of play.
The pairing list and
a standard wallchart-crosstable is given for each round.
First-round pairings and results are uneventful.
White
apparently won the coin-toss to determine the initial color
allocation.
Powell's upset of Adams presents the first
"color clash," since three players in the top score group
are now due for white.
Since VanMeter and Mills are the
higher-ranked players, they should receive their due colors,
and so they do!
All other pairings are made in the optimal
way as well.
Round three shows the functioning of the other precepts
of the Swiss System and also reveals a small "bug" that has
since been removed.
The middle pack of players-- Bousum,
Adams, Dowling, and Powell-- calls for an Adams-Powell
match-up, but they already played each other in round one.
A switch is appropriately made on the right side of the
-
score group to produce legal pairings.
Bousum has had black
twice in a row and thus, under Swiss principle, must have
white; Roush,
in the zero score group, must likewise have
140
black.
The TD recognizes this and makes all the switches
necessary to produce an equitable color allocation.
The small bug manifests itself in the VanMeter-Mills
pairing.
VanMeter has had B-W in the first two rounds,
while Mills has had W-B.
Any self-respecting tournament
director would therefore pair the final
round as Mills-
VanMeter, preserving the alternation of colors (Rule 21) in
light of already equal colors (Rule 20).
The program, as
coded at the time of this test, only saw equal colors and
gave the higher-ranked player-- VanMeter-- the preferred
color-- white.
Upon discovering this error,
I quickly made
the necessary change in the color allocation algorithm
(which employs the color-due matrix given in section III).
Now, alternation of colors is favored over the assignment of
white to the higher-ranked player.
As a final note to this section I must discuss the
color allocation algorithm that I designed for this system.
As any avid tournament player (such as Dr. Owens) or TD
(such as me) knows, color allocation is the most difficult
element of the Swiss System to optimize.
are easily followed.
Other principles
But, to distribute colors equitably
(and in a way that satisfies all the players!) is often near
to impossible.
My algorithm represents one creative way to
automate this process, and I think that the concept
employed is very good.
of a single quarter,
However, given the time constraints
I was not able to make it as sharp or
as all-encompassing as I had hoped.
My special request to
1 41
-
any reader of this document inclined to modify this system
is this:
study the color allocation principles of the Swiss
System, and then polish up my algorithm.
I know that I am
on the correct path, but I also know that some improvements
could probably be made.
)
TOURNA'1ENT
T~st
ROU~D
1
lASL:
.-
~ourna~ent
.1
BLACK
WH!T:::
1
Lester Van:-leto!r
2
3
4
TOil
Jonn Dowling
Jh Mills
H~rris
John qoush
Nick Adalls
Josh 'OUSU1l
Ron POlolell
TOURNA"E~T
Test Tournallent .1
SPON SOR
DATE
Honors Colle~e
IIay 14, 1986
Munci e, Indiana
SITE
110.
f>layer
010
020
030
040
050
060
070
:l80
Lester VanMeter
J ; ' Mills
Joshua 60usum
~ick Adallls
John Oowling
TOM Harri s
John Roush
Ron Powell
Eugene Wallingford
DIRECTOR
Rat i ng
2331
2223
2197
2123
2111
2~43
1997
1911
1-
1
-I
W 050 9
W 060 W
W 070 B
L 080 W
L 010 w
L 020 B
L 030 w
W 040 B
1-
2
-I
1- 3 -I
Total
1.0
1.0
1.0
0.0
0.0
0.0
0.0
1.0
-l>
rv
)
)
'.
TOURNAMENT
Test
ROUND
2
TABLE
1
2
3
4
Tourna~ent
BLACK
Leste r Vanl'le t er
Ron POl/ell
Tall Hard s
John Roush
Jostlua Bousull
Jh Mills
Nick Adalls
John DOl/ling
-SPONSOR
DATE
SITE
Test
Tourna~ent
Player
)10
020
030
040
050
060
L~ster VanMeter
Jiill ~ills
Josnua 30usum
Ni c k Adalls
John DOl/ling
Tall Harris
John Roush
Ron Pal/ell
080
..
#1
Honors College
/lay 14, 1986
JIIuncie, Indiana
No.
"
"'
WHITE
TOURNAMENT
070
#1
"'l!'"
DIRECTOR
Rat; ng
1- 1 -I
2331
2223
2197
21n
Z111
2043
1997
1911
Ii
B
Ii 060 III
eso
\I
L
L
L
L
Ii
070
080
010
020
030
040
B
'II
Ii
B
Ii
B
Eugene Wallingford
1- 2'-1
W 030
II 080
L 010
Ii 060
'II 070
L 040
L 050
L 020
II
B
B
B
8
Ii
Ii
Ii
1- 3 -I
Total
2.0
2.0
1.0
1.0
1.0
0.0
0.0
1.0
.J:-
W
)
.~~-
TOURNAMENT
Test Tournament '1
ROUND
J
TAaLE
1
2
3
4
WHITE
aLACK
Lester VanMeter
Josnua 90usull
Nick Adaills
Tall Hard s
Jill Mills
TOURNAME NT
-SPONSOR
DATE
SITE
Test Tournament #1
Honors College
Ma y 14, 1986
~unci e,
Indiana
No.
Player
01 I)
Lester I/an"'eter
no
Q30
040
050
060
070
080
Ron POI/ell
Jonn DOl/ling
Jonn Rousn
Jh /IIills
Josnua 90usum
Nick Adams
John Dowling
Tall Harris
John Roush
Ron Powe II
DIRECTOR
Rating
2331
22?,
2197
2123
2111
2043
1997
1911
Eugene Wallingford
1- 1 -I
1- 2 -I
a
1/
II GSO
WI 060
W 070
L 080
L 010
L 020
L 030
iI 040
1/ 030
W W 080
a L 010
W Ii 060
iI
Ii 070
B L D40
W 'L 050
a L 020
a
a
a
a
1- 3 -I
Ii 020
W
L 010 B
L 080 W
Ii 050 W
l 040 B
Ii D 070 Ii
W D 060 a
W Ii 030 B
Total
3.0
2.0
1.0
2.0
1.0
0.5
0.5
2.0
~
~
')
)
TOURNAMENT
-SPONSOR
DATE
SITe
~o.
010
020
040
. 080
030
050
060
070
Test
Tourna~ent
.1
Honors College
'" a y 1 4, 1936
Muncie, Indiana
Player
Lester VanMeter
Jim Mills
Nick Adalls
Ron Powell
Joshua 30USUII
John Dowling
Tall Harris
John Roush
01 RECTOR
Rating
2331
2223
2123
1911
2197
2111
2043
1997
Eugene Wallingford
1- 1 -I
1- 2 -I
1- 3 -I
~ 050 B
'" 060 W
L 080 II
1/ 040 B
II 070 B
L 010 '"
l 020 B
l 030 II
II
'"
'"
L
L
'"
W 020
L 010
W 050
II 030
l 080
l 040
D 070
D 060
l
l
030
080'
060
020
010
070
040
050
II
B
8
'"
B
B
II
II
II
B
II
B
II
B
II
B
Total
3.0
2.0
2.0
2.0
1.0
1.0
0.5
0.5
..,...
Vl
-
CONCLUSION
Failure isn't fatal,
and
success isn't final.
Attributed to
Don Shula
-
147
RETROSPECT
As I look back over this quarter.
ground that
I
covered.
not do everything
I
I am pleased with the
Though the resulting software does
had ambitiously hoped it would.
see now that my goals were a bit lofty when
I
I
can
began this
The Swiss System has proven difficult for me to
project.
master as a human TD; coding algorithms to model the system.
as well as all the auxiliary duties performed by a tournament director, really stretched my commitment to this project to its limit.
My hindsight in this respect only
reaffirms my notion that the nature of this idea made it a
highly appropriate topic for my thesis.
This quarter's research has provided me with a great
understanding of the mechanics of the Swiss System.
result,
(As a
I am now a better TD than I was before beginning the
project!)
The knowledge I gained allowed me to develop a
strong theoretical framework for an automated model of the
system.
The data flow diagrams and data dictionary that
were presented earlier in this document effectively describe
the concepts of the method and are the stepping stones to an
exhaustive system model.
One added benefit of the project
has been my exposure to structured analysis and design techniques in an environment in which I could steer the application of these tools in the direction most suitable to the
148
-
modeling process.
My resultant experience with the DeMarco
and Yourdon methods will be of great value to me in future
software projects.
The most important benefit of developing this creative
project lies in the realm of "research."
The scope of my
project was not sufficiently narrow for completion in one
quarter, but I was able to abstract a fitting subset of the
system for my study.
Very often I found myself pressed by a
self-imposed deadline; and, though I did fall behind,
I was
able to make up ground in the next phases of the project.
I
began the quarter with an idealistic view of individualized
research, and now I have the more realistic view of a
"hardened veteran."
As nice as all these ramblings sound,
I have not been
magically transformed into an expert researcher over the
course of the last eleven weeks.
But I am a better
researcher than I was before, and the experience of this
project will be invaluable as I pursue further academic
studies.
Though the results of my work are not what I had
dreamed they might be, all
package.
in all the TD is a good software
The day is not too distant when a later generation
of this "creative project"-- perhaps "TD
III
Plus"-
stands
alone as a practical tool for use in sanctioned tournaments.
-
Download