- 48 *****"1r********** .. DATA FILES * ***** ... "''''******** Tourna~ent-roster , I'. CCMPOSITION ••• {Player-record} CCMPOSITION ••• Tournament-identification 49 -- , .- ~ o ~, (.) G - I D- 0 D!. v v ~ ...r e I I I ('1 N I - \ G' ~ I : j I 1 I c::J. I L: G:. '-'.J y - <--' ~ I 0 -- <: -1 I v -I cD I- v', "t1 ..J r:2 ':/ ) ..lJ <:.....- , C. "'- :; -i (', ~ I I 1 0 ~ I ...... N ~ ) - 0. I <;"I.UJ V' I..J :S w..""" 'JJ Cl. ,~ DLI 3 "i v' - 0 N I \ - I t.2: \j) I ~ \"IJ-<t cJ. ~ c./.. ~ v" ~ ~ I..l.I t:- I vt=-~ -J 50 \ \ 2 0- 2 \ I ~ ..J \l) ~ ~ ~ a.l <1' <I: a. c.... ~ \ 'J..> ill ~ 2 C- ~~ -:J C ::) 0 \./\ - ~ V'l :1 .J 0 lJ\ (III'" I I '2 p r- ~ , \ c. 0 ,...J :J :r C""' -<. \ 2 I \ 'J \ ~ C>L ;:r< 2 I o - C:-.i N I ,~ 'J,J uJ ~ 4 2 \..l.l '...Ii DL -' '..) !,J) r:Y. I- <! :::,.!. r- .::,. ..J) ~ ~ci .- <:<l I ~ Dl U) 'y .,j) l- ~ I ~ j c,.. 0 ('('I ~ V' 3 1= .-J) U I ~ 1== cl<1\fl ~ "2 ::s ~ UJ~\fl W :3r-J. U 0 r 0- ~ \- - =E 1\ l- V' .:J ..J 0 f;;; , ~ - I- ~ - -.l ,- i ~r, J 52 - <;or> ( \ Ij) r- VI \ 0.; ~ 2 ;; DL- 'J' Q., -< C:d -<v c. -' ..;;, D- --< c1 '--' r--- D 0 3 .J 0 ...J U <t tt: r -< :r I I ) i) 2 c:d. .... - '-- --- "2. \-- - C::'- - -< ~ .- '..J.; \ ...- J' -q' I' -, ...::: -<: :f ...!J [):. .-J -.l - ~ <t V1 ,'J - ..-l ~ ~ ~ ~ - ~ "- - - -< G- .' «" ~ i -+- I ....;.., cl -< 1/) ~2 J' :J cl ..1J ':.i - -<.J cl 1 I r::1 .Q r...... "I .....:.. T" i ~ ~ 1 G- D- <>... v ::r' (:j. -J ! - -::;-- ',J) -~ .~ ,:"" \ c.- 2 -.J <' ./ <\ ~ D ~ cl It I D1 - rt \ 0D 0 '2 Ul D 0 0 \ .J) 0 u ) 0.. :j \ j '2 ~ -< .:< \ LlJ ::, flY ~ \ <.r:I:: :S. 0 Q ~ \l.. \ \..l) :;:;> :;r' ::::r II" I 0. ) Ll.l -.:L '2 VI [) '2 WJ cl f- - if' \I Vl '2 < ,. :5 6 ~ 6 ~ \ UJ .j) I - N'> Dl c.. ':- \ ../\ ::r ci <t '2 p 0 ~ <t -.9 (5:) --> r::::. W' ;J ('0 ~ ~. :r cJ. <l: V' J) '\.l- a r::!. -:2. to - « ~ ~ :<:. I ~ CO!- .;:; ~. \ <. ::::r \ :1 [;) .-0:" c:.... ::f .- i .5J "-- ~ ,- i ~ " -' J ::.r .-' ..!l I :::; r- L-.... \ -- -' .J -.J 0 I DL -< 'i= , I I \ "2 cl Q {tn:cl ~ ...9 u 0 Ul Dl. ~ u0 \:!: 2 D IJ) <t rJl 53 - -.l; --i ) \- - ::$ ~ ~ I-- N' N cO -<: l- I ~ J" f-- - '"...,~ :; ~ 0 '-..) I -.J - ,/" '~ -, ~ :.J. , I 3, c.. ...:., 4- - ~ ...LJ -.J cD '.lJ ...J ~ :i. (; U -« I- V> V' 0 ~ <;.) I 0 0 ::r ~:...L "I I -.l \ cO \ Q,l UJ ,- iJJ 0 ~ ~ L- U <:. \.;1 V' I- LV -t cJ d) 0 ~ '...) "3 0 :r -+ ;/1 -< ~ - , ,. \ '~ j VI ...t: :( ~ -.J U) I 1.Y 0 \.l.l v l=- c::! 0 if'! 54 FUTURE IMPROVEMENTS AND ADDITIONS (classified by type) PROGRAMMING STYLE IMPROVEMENTS 1. Trap end-of-file character on keyboard input. 2. Allow user to exit from any entry menu without completing the data entry. 3. Default input values to most recently entered values. 4. Standardize the GET_AFFIRMATION module and copy into the main module; eliminate the individual versions. 5. Clean up the format of the crosstable report -header style, detail line style, and paging format. "SMALL" SYSTEM DETAILS 1. Verify that all game scores have been recorded, whether by adjudication or by completion, before proceeding with pairings for the round. 2. Inform the user when all game scores have been recorded for the preceding round. 3. Implement the following status flags Odd_man_stat us Unfinished_game_status Pairing_odd_men Alternating_colors Scoring_unfinished_games Ranking_unrated_players 55 SYSTEM MODIFICATIONS 1. Improve Record_round_result. (a) require user to enter round number of result (b) verify that the players were paired and that the result has not yet been recorded 2. Provide for late entry of a player. (a) assign a pairing number and update Highest pairing_number if necessary. (b) create a new pairing limitation list and update the lists thereby affected 3. Provide for the early withdrawal of a player. 4. Allow adjourned games, with either automatic or manual assignment of adjudicated scores. 5. Incorporate requested pairing limitations. (a) create new pairing lists after assigning pairing numbers (b) set a point total/round number threshold to limit application to non-critical pairings 6. Code modules to break tied scores for crosstable generation. 7. Provide for system restoration (linked lists, tournament variables, etc.) to allow for multipleday tournaments and to safeguard against system failure. 8. Allow choice of current tournament files for editing and adding tournament information, so that concurrent tournaments can be maintained. 9. Incorporate the accelerated pairing variation of the Swiss Sytem into the TD. 56 - FILE LAYOUT FOR Tournament statistics ~ 1 Tournament name Packed Char 30 2 Sponsor Packed Char 30 3 Director Packed Char 30 4 Site Packed Char 40 5 starting_date Packed Char 30 6 Ending_date Packed Char 30 7 Number of rounds Ranking_unrated_players Integer 8 Char 1 Char 1 10 Scoring byes scoring_ unfinished_games Char 1 11 pairing_ odd - men Char 1 12 Alternating colors Char 1 8 9 - Length Name Record # 57 - FILE LAYOUT FOR Tounament roster 1 REPETITIONS OF Player record Field name Length ~ Location 3 Packed Char 1- 30 Packed Char 4- 33 Rating 4 Packed Char 34- 37 USCF ID 8 Pairing_ number Name 3 Packed Char 38- 45 2 Packed Char 46- 72 ColorO 9*1 2 Char 73- 81 Result() 9*82 Real 82-153 8 Real 154-161 Opponent() Score 9*3 1 See Tournament_roster.Fdl for parameters used to index this file. 2 Repetitions occur Max_rounds times, a constant currently defined as 9 in TD's main module. - TITLE "Tournament_roster.FDL" IDENT "20-APR-1986 15:39:51 58 VAX-11 FDL Editor" -. SYST EM SOURCE FILE NAME ORGANIZATION "Tournament_rester.DAT" indexed --- R ECO R0 CAR RI II G!:_ COtH R0 L carria~e_retur" FORMAT SIZE 1 21 fixed ...~RE4 0 ALLOCATION BEST_TRY_CONTIGUOUS BUCKET_SIZE EXTENSION 42 yes 3 9 -. AREA 1 ALLOCATION ?UCK~T_SIZE ~XTENS!ON 9 yes 3 3 CHANG::.S no 3EST_TRY_CO~TIGUCUS DATA_A~EA DATA_FILL DAT4_KEY_COM?RESSION 100 yes DATA_RECORD_CCMPRESSION yes DU?LICATES INDEX_AREA no INDEX_CO~PRESSICN yes INDEX_FILL 1 CO LEVEL1_INDEX_ARE~ 1 NAME ·PROLOG SEGO_lENGTH -) ...... i ~. 1 "Pairing_numoer" 3 3 SEGO_POSITION o TYPE string .. .. "\~ "V. <i-', o,l,' > l~ .. ": ,... .. TOURNAMENT : Test TournaMent #2 ROUND : 4 'f. . TABLE ~--- ...... -- 1 2 3 4 5. WHITE .BLAt K -----------~---------~-------- Nick Adallls Ron Powell Lou Kontos John Dow li ng 'U ke Sheaf Lester VanMeter Jim Mills Joshua Bous.u. John Roush Tom Harris I I·I ~ Vl '-.0 ) ) TOURNAMENT -SPONSOR DATE SITE Test Tournament #2 Honors College !'\ ay OI ECTOR fugene wallingford '4, 1986 !'Iuncie, Indiana No. Player 010 020 090 040 100 030 050 070 080 060 Lester Vanl'leter J " "i lls Ron Powell Nie k Adatls Lou Kontos Joshua 90usu. John Dowling John Roush Mike Sheaf To. Harris Rating 2331 2223 1911 2173 1644 2197 2111 1997 1970 2043 • .1.,... 1- 1 -I 1_ -I 1- 3 -I 1- 4 -I Total w 060 w II 020 B .. 090 II w C70 B L 010 II '" 050 II • :40 6 o 098 ;; 2.5 II 240 II L Q9C 8 o eso a o 080 101 o II 030 II 10C L 3:'0 L 090 8 8 II II o OsO a w o J60 B o 100 II L 020 J 030 B L C10 B o o 0;0 II 070 III L 010 W 080 .. 060 o 070 L 02G o 030 L 040 L 100 f D Gl0 II .. B L )10 o 030 o 100 o 070 o ') 50 o 060 o 080 II a R w B II W B .. e "- e 4.0 2.5 2.0 2.0 1.5 1.5 1.5 1.5 1.0 v;"~,·, Q\ o 61 COLOR-DUE MATRIX (Used in color allocation algorithm, Module 4b) H/L +3 +2 +1 0 -1 -2 -3 +3 L H L L L L L +2 L L L L L L L +1 H H L L L L L 0 H H H H L L L -1 H H H H H L L -2 H H H H H H H -3 H H H H H L H Y-axis X-axis Higher-ranked player's Color due__ status Lower-ranked player's Color due_status Matrix values "H" means higher-ranked player gets white, and "L" means lowerranked player gets white. 62 MODULE INDEX Module 4e Tournament director Control trap Create tournament roster Record_game_results Pair_players_for_round Compile_crosstable Enter_tournament_statistics Enter_a_player Prepare_late_entry Prepare_for_round_one Place cards_in scored_list Enter round_result Record_round_results Locate_pairing_cards Prepare_for_pairing Pair odd_men Pair_score_group Print_pairing_list Update_pairing_cards Create_crosstable Output crosstable Create_limitation list Update_limitation_lists Clear_unfinished_game_flag Enter adjudicated_score Assign_unfinished_score Assign_bye_to_odd_man Create_a_score_group Pair odd_man from_above Remove_odd_man_from_group Match_top_with_bottom Eliminate_illegal_pairings Allocate_colors Eliminate tied_scores Write_header_items write detail lines ** Prt.Com 10 11 20 21 22 23 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d .- Name Page 63 64 69 71 73 77 79 84 y y y y y y y y N 87 90 Y Y 92 Y 95 97 99 100 101 102 106 109 111 Y 113 115 116 119 121 122 126 131 132 Y Y Y Y Y Y Y Y N N N N N Y Y Y Y Y Y Y N Y 134 Y 137 y 63 · . tpJ~" .""'. ,-' f'; 7"" ., '~ -------.~-~---.--- ... . ---.- ~-- ( ••••• * •• **********.*.*** ••••• *** •••• * •• * ••••••••• ** •••••• * •• _•••••••••• ) ;;;:>""::~,.;....:~: PROGRA" Tournuent_director (10) (~;~t2:~: PURPOSE i~~~n!:e~~\~~~;~~~e~y~~~!:Ol. module DATE: April 9, 1986 for the :~ :: ~:< '-..,:.~:,""'" (******* ****** ••••• * •••• * •••• o.. * * o..** ••••• *** * o.. * * o.o. * •• * *.**. * .***.* •• **) .. If '_,./~<" ~.~"t. ~. • ~">\;lf;.~: PROGAA" E~ ~~'i"" ~~~~:~i~P}·· '··..:rGurnuent~dtrector .. ,~:.,,~ I (Input , Output , Crosstable , Pairing_list, Temporary_roster, .' Tourna.ent_roster , Tourna.ent_stattsttcs ); 9: 'TYPE Opponent_pointer Opponent_record , Card_pointer Pairing_card AOpponent_record; Record Opponent Nellt_record En':!; "Pairing_card; R!>cord Np~t card P3irin'l_nulllber S c or eo Cilrd_oointer; Packed array [1 •• 5J of Char; Oea t; Odj_~~n_st3tus Inte?~"'; Color_du~_status Intl'ger; °3cked array (1 •• 7] of Char; Chelr: Array [1 •• M ax_rounds] of Packed arr3Y [1 •• 3] of Char; Unfinished_qame_status ;lye_"iven_statu, Opponent End; Lt.it_pointer Pairing_limitation Packed array [1 •• 3] of Cha"; Opponent_pointer AP~iring_ltlllit3tion; Record Next_reocord Play",r Limitation Li'ltit pointer; p~ck.~ arr~y [1 •• 3] of Char;; Opponent_pointer ~nd; Pecord Pairing_number Naille Rating USCF_I!) Opponent [Key] Packed array (1 •• 3) of C~ar; Packed array [1 •• 30] of Char; Packed array [1 •• 4] of Char; Packed array [1 •• R] of C~ar; Array [1 •• Max_rounds] of 64 I·'· I: . {,' {--",qr..,+ .. •.~ ~: ~ I ) ;' Packed arraY (1 •• J] of Char; Array (1 •• Ma~_rounds] of Chari Array [1 •• Max_rounds] of Reali Rea l . Color Rl'sult Score End; ",-:;' ~ "enu_options .Co •• and_line Sl't of Char; = Varying [255] of Char; Scored_pointer, Pai red_pointer, End_ot_scored, End_ot_paired Pairing_liMitations Card pointer;' L hi t_pointer; Not_yet_prepared_for_round_one Boolean := Truei ,"';" i ' , , Tournallent_nalle Sponsor Director Sit e Starting_date Ending_date Ranking_unrated_players Scoring_byes . Scoring_unfinished_games Pairing_odd_lIen Alternating_colors , , , , Packed "rray r 1 •• 30 J of Chari Packed array [1 •• 401 of Cha r; Packed array [1 •• 30] of Char; Char: Round_number NUMber_of_rounds Integer; Integer; Loop Selection Valid_selections ::>aoleani C h H; Menu_opt ions; , Crosstable Pairing_list Tournament_statistics , TeIllPorary_rost~r TournaMent_roster Number_of_players Highest_pairing_number Integer; array [1 •• ,) of Char; Pac~ed *) DECLARE EXTERNAL REFE~ENcrS *) *1 Procedure libSErase_page Procedure LibSSet_cursor Procedure libSSpawn .Procedure Trap_C; (Row,Col ; Integer); (Row,Col : Intl'ger); (XDescr Comlland COlllmand line); Fortran; -------------------------_ _._ .. .._---- External; !?xtern.]l; External; 65 Procedure Ctrl_C_off; Procedure Ctrl_C_on; :):,J '-'\:,' .;;.. '-, ". Fortran; fortran; %Include '2 O· ~,:: \~,~, \..';' ; %Include '21' ;""i .~ .' ,•. 'I,';., IInclude r," :1frt ": .. ~~..' '22" .~' ,~r~:,lInclude "2 J" .' ",:~:·.~t:·~-, ;., , 'I ",.; .. (* C* ~ f *) SET-UP INITIAL STATE Of SYSTEM ", (* *) *) ;.·,/~",f ~~ , , /~; ::~~ 8egi n Trap3; Ctrl_C_off; 0; Round_nu.ber := Scored_pointer Paired_pointer :-= Nfl ; := Nfl; End_of_scorl'd := , Nil; ;". Pairing_li.itations := Nil ; := True; Loop .) MAIN CONTROL LOOP OF MODULE . ) .o) While Loop 00 Begin Valid_selections := (·1· •• ·5·); LibSerase_oilqe(Qow;=1,Col:=1); LibSSet_cursor(Qow;=l,Col:=l); Writeln(' .**** •• *** ••• ** •• ******* ••••• **~ •• ****.* •••• * ••• **.** • •••••••• **.** ••• ); Writeln(, • .o'); Writeln(·. SWISS - SYSTEM TOURNAM~NT DIRECTOR .o'); Writeln(' * .'); Writetn(' *.* ••••••••• _•••••••••••••••••• - •••••• - ••••••••••••••• ****.******* ••• '); LibSSet_cursor(Row:=10,Col:=1); Writeln(' Writeln(' Writeln(' Writeln(' Writeln(' (1) (2) <') (4) (5) Enter tournament information'); ~ecord a a3~e result'); Pair players for the round'); Prepare a current cro5stable'); Terminate the tourna~ent dirl'ctor'); 'LibSSet_cursor(Row:=16,Col:=1); Write (~ Enter YJur selection - '); 66 . .:;' '"! , \..--i'~ ~;,. Aeadln(Selection); While Not (Selection in Valid_selections) 00 Begin LibSErase_page(Row:=16,Col:=1); LibSSet_cursor(Row:=17,Col:=1)i Wri tel n( I INVALID SELECTION!!'); Wri tel": Wrfte (' Enter your selection: '); Readln(Selection); End: : .~~ .. Case Selection of "2' i " , 5' Leop := False: End; End; RESTORE SYSTE~ STATE L1bSErase_page(Row:=t,Col:=1); Ctrl_C_oni End. 67 .*****.*****.*.**** ••• * ••• *.**.**.* ••••• * •••••••••••••••• **.*** ••••••••••• *** * .'- . ** ,~':"'" ,.'" '. - ** .,.... * ,:~ '* * ,'\'r~'l';:' * • .c '-"1.'\ :}~-, . ~ .', ., .~,- ~ . •.. '. }., ~, PURPOSE: This Fortran proqram provides an asynchronous trap for Con~rol-C and Control-Y characters. This is the control subroutine to trap Control-Y and Control-C characters. This s.all routine calls the subroutine CAST. suaROUTINE TRAP_C I"PLICIT INTEGER*4 (A-Z) INTEGER*2 TTCHA~,IOSa(4) CHARACTER TER~INAL*11 I'SYSSCOM"AND'I,~UfFER*80 EXTERNAL CAST . INCLUOE '(SIOOEF)' INCLUDE '(SSSDEF)' STATUS SYSIASSIGN(TERMINAL,TTCHAN,,) IF (.NOT. STATUS) CALL LlelSTOP(XVAL(STATUS» FUNC = IOS_SETMODE .OR. IOSM_CTRLCAST STATUS = SYS1QIOW(,XVAL(TTCHAN),XVAL(FU~C)""CAST,TTCHAN",,) IF (.HOT. STATUS) CALL lIBSSTOP(%VAL(STATUS» RETURN END 1 ~',' DATE: April 1, 1986 ". '" * * * This routine ~rovirl~s the asynchronous trap for CTRL-C and CTRl-Y. CTRlCEXIT is called as a routin~ from this module. CAST(TTCHAN) INTEGER-4 (A-Z) SUBROUTIN~ I~PLICIT STATUS = SYS!CA~C~L(XVAL(TTCHAN» IF (.~OT. STATUS) CALL LIESSTOP(XVALCSTATUS» CALL CTRLC EXI T RETURN END * * This is the * SUBROUTIN~ INTEGER ~odule that actually d;,ables the interrupt characters. CTRL_C_~FF MASK ~ASK='02000QOO'X CALL LIBSDISA3LE_CTRL(MASK,MASK) RETURN END . ** This module restores the activity of CTRL-C and of CTRL-Y • ' SUBROUTINE CTRL_C_ON INTEGER ""SK "~SK=34603008 - " " " " " * ********************************* ••• ***.* •• *******.*** •••••••• ****.**** •••••• .~~- ~. PROGRA" NAME: Trap_c (11) 68 CALL LIBSENABlE_CTRL(MASK,MASK) RETUR~ END ~ ** This .odule invokes T~AP_C from CAST, which is itself called by . TRAP_C •. Thus the asynchronous trap loop is completed. SUBROUTINE CTRLCEXIT .CALL TRAP_C CALL CTRL_C_OFF TYPE*,CHAR (7) RETURN END 69 ~~" "j~ " \ .../ , :r~" (********.******.******* •• **.*A~.********* ••••• *.**.** * ••••• ** ••• *** •• **) (* ., (* ._(* f Cre~te_tourna~ent_roster (20) DATE: April 9 PURPOSE This aodule serves as the control menu for entry of tourna.ent and player infor.ation. *J *) *, , (* , ., .) ,i· ;'.. (*. "--":. ;. ~~~ ( * ( ~~ PR06RA" ' "_ ,:..1"'" (*** ••• * ••••• * ••••••• * •• ** •••••••••••• **. * *** *.* * * ** ** .... * *** .. * *** * .. * .. **. J ·A~,~·"T~" "i'~i I'ROCEDURE ";1· ''':'< YAH 'Selection .loop 1. Ch ar; Boolean; Char; *) DECLARE EXTERNAL REFERENCES *) *) XlnFlude '30' <. Xlnclude' 31' XInclude '32' XInclude '33' Begin Valid_selections := ['1' •• '4']; I loop := True; "AIN CONTROL LOOP OF MODULE While Loop Do Begin ,Col:='); LibSSet_cursorCRow:=1,Col:=1); Writeln(' *.*.*** ••• * •• *** •• ** •• ***.*.* •• ** ••• *.*.~ **.* ••• *** ********.*****.')i Writeln(' * *'); Write!n(' .. ENTEIl TOURN~~ENT INFORMATION "'); Wr1teln(' * "'); Wr.t t el n(' * .. *** .... ******* ** .... **** ** .*.* •• * ** ** ** * * ****** ** **********************' ); Lib$Erase_oage(~ow:=1 ... Lib$Set_cursor(Row:=10,Col:=1); - 70 Writeln(' Wri teln(' Writeln(' Writeln(' (1) (2) (3) (4) Enter specific tournament data'); Enter a new player'); Prepare for round one'); Return to the main _enu'); LibSSet_cursor(Rov:=16,Col:=1); Wr 1 t e ( 0 En t e r you r s e lee t ion Readln(Selection); ' ); While Not (Selection in Valid_selections> 00 Begin LibSErase_page(Rov:=16,Col:=1); libSSet_cursor(Rov:=17,Col:=1); Writeln(' INVALID. SELECTIO~ !!'); Writeln; Wri te (0 Enter your selection: '); Readln(Selection); End; Case Selection of '2' Begin Enter _l_playe f; (*If Round_nu.ber > 0 Then Prepare_late_entry;.> End; '3 ' If Not_yet_prepared_for_round_one Then Regin Prepare_for_round_one; Not_yet_prepared_fof_round_one := False; End Else 8eQin Lib~Set_cursor(Row:=22,Col:=1); Write(' You"ve 3lready done this Readln(Dummy_character); End; '4' End; End; End; - Loop:= False; Hit <RF.TURN> to continue ••• ' 71 -~---:'"-'- "'. ," (.**** •• *.*****.*.*** •• ** ••• ** •• *.**.****.*.*~**.*.*** •• * ••••••••••• y. )~l (* (* PROGRA" Record_ga.e_results (21) -*.-) DATE: April 22, 1986 ,,',--.(* .) .) .) .: ,;...,;.. (* PURPOSE Thi S .odule provides for entry of game scores. .J , ..'"" (* •.J ::::.~~~.**.***.*.~****.*****.*** •• *****.***.*.******. * ••••••• _ •• _•••• _••••••• _) .:',:,> -;- ,,' ·7'·;,.;-!,: ~" PROC eDUR E ~-~ "~ . '." ..,;~~j;~~' _ ~ ~ I i ::!' ·~.,·t . Record_gau_ res u l ts; . . TYPE .. <, = Packed . Round_result = Record Player Result End; ,,-~:~. array [1 •• 3J of Char; Array [1 •• 2] of Three_char; Char; 0 •• 4; '., VAR Round_result; Inteqer; Galle_result Array_index Previous_card Desired_card Error_code Message ' Du •• y_variable , Array [1 •• 2] of Card_pointer: Valid_error_codes; Varying [80] of Char; Varying [1] of Char; XInclude '35' XInc lude '37' %Include '36' XInclude '34' Begin l1bSErase_page(Row:=7,Col:=1); Writeln(1 If Error_code = 0 Processing round result .' ) ; 72 -~-~:~:!'''!''~~ii''"'rr:'.---.1> J' ----- :' Then 8egin Reco~d_round_results; '. Place_cards_i"_scored_listi End Els~ ~ .~.-'. "i-, End; . Begin Cese £rror_iode of .1 "essage:= 2 "'essage:= I 3 . .. es sag e : = I 4 "essage:= I End; Write ("essage); Readln U.u ••y _ va ri ab l e); End; Card was not Card was not Card was not Players were found for player 1. Hit <RETURN> to continue • • • "; found for player 2. Hit <RETURN> to continue • • • "; found for either player. Hit <RETURN> to continue • • • 1; not paired to .eet this round. Hit <RETURN> to continue. 73 (**.*** •••• *******.*.*******************.*.********* •• ******************) .':~:';~'; :;, ~: PROGRAI'I Pai r _players_ for_round (22) DATE: May 2 PURPOSE This 1II0dule actually perforMS the Swiss-syste!l of tournallent pairings. ; - . (*, ,-~~"~" :< ':, ','r .;;:,7 .) (* (* (* ~ "';~~ **.*** •• *.**.***.*****.*** ••••••• ;:'..!::~ PROCEDURE f :J."'.; :,~:~;'".', ;", il~· ~-"". l :~ ,'~" Pat r _players_ for _round; ,.~:~<~': '~<'~. , ' r::::t ;,; "-c f WAR *~'.~C·, Varyi~g ,. (:':;~,~ . [1l of Chari , , End_of_paired Score_group Odd_un ••.1 .•• • 'f.;- ., .) .) ~ ~ '.~~- (****.*****~.*****.**-*** ••• t . -,';. :; Pairtng Array [1 •• 50,1 •• 2] , of Card_pointer; Legal_pairings_exist , Odd_"an_pending l'Iore_cards_to_pair Boolean; , Index Highest_pal ri nq NUllber_in_group Curr , Prev Index1 r IndeK2 Integer; Card_pointer; Integer; Begin For Index1 := 1 to Hiqhest_pairin~ 00 For Index2 := 1 to 2 00 Begin (* Find next card to be !loved to the paired list Prey := Score_group; Curr := Score_group; While Curr <> Pairing(Index1,IndeK2l Do Begin Prey := Curr: Curr := CurrA.Next_card; .) _.*-**_ •.•• ) 74 -- --::--"?"",.....:~"~ - ---"- , :;:. ~~, '--t. '. (* Re.ove object card from score group list .) If Curr = Prey Then Score_group := CurrA.Next_card Else PrevA.Next_card := CurrA.Next_card;· .(* Place object card into the paired list .) Prey :z Paired_pointer; C:urr :"' ,Paired_pointer; While Curr <> End_of_paired Do Begin Prey := Curri Curr := CurrA.Next_tard; End; ; E,.·· If Paired_pointer =·End_of_paired Then Paired_pointer := Pairing[Index1,Index2J Else PrevA.Next_card := Pairing[Index1,Index2]i End; (* (* . .o) DECLAiH EXTERNIIL PEFE<>ENCES (. ) *) XInclude "38" %Include '46" , %Include "39" %Include '3a' Unclude ' 3b' %Include "3c' Begin LibSErase_paqe(Ro~:=1,Col:=1)i "~ LibSSet_cursor(Row:=1,Col:=1); Writeln(' •• ** •••••••••• ****** •• ** •• ***** ••• *** •••• **.*** •••••••• **************'); Writeln(1 .. *"); Writeln(1 .. PAIR PLAYERS FOR THE ROUND .1); Writeln(1 • .1); Wrtteln(' •• ****.***********.********.*.********.******** ••• _*** •••••••••• _ •••• '); 75 -.~ . Then Begin Writeln(' Pairings have already been made for the final round.'); Write (' Hit <RETURN> to continue the tournament: ')' Readln (DUM.y_character); End ; Else Begin, Round_nu_ber := R~und_nu.ber + 1; End_of_paired := Ni t; Write (' Writeln(Round_number); P~iring players for round'); .. ". . "' ...... Odd_Man_pending := false; More_cards_to_pair := True; Legal_pairings_eKist := True; Odd_un Score_group := Nil; := Nil; While ~ore_cards_to_pair Do Begin LibSErase_page(Pow:=13,Col:=1); LibSSet_cursor(Row:=13,Col:=1); Create a score_oroup; Pa i r _odd_lften; If Score_group <> Nil Then "egin If leqal_oa;rinos_exist Then P~Qin Highest_oairin1 := Nulftber_i"_~rouo DIV 2; Place_pairinqs_in_paired; End F.lse More_cards_to_pair := False; End; If Scored_pointer = Nil Then More_cards_to_oalr := False; End; If Legal_pairings_exist Then 8egin Print_p~jring_list; , Update_pairing_cards; - 76 - -, F"" -- . -',,;- ~ .' ,j ]1 -, j>;. • J,.".' - ...... ;. .... End; - j.,'. ' ... - ~- Write (I WritelnCRound_number); Writeln; Write (I Readln (Ou~.y_character); End; -End; Pairings completed for round"); Hit <RETURN> to continue • • • "); 77 ( ••• ******* •••• ********** ••• ****.*.**** ••• *.***.****.*_ •• * •••••• * ••••••• ) (* '" *,*, *,*, ••• **** •• ** •• **.***** •• ****. *.-........ _ .... -.) (. PROGRAII:: Co.pi le_crosstable (23) ' - (* ,•.: (* ... ' (* PURPOSE: This lIIodule serves as the control menu for the preparation and printing of a crosstable. ~~~~(* ~. ,':f i (********* •• ******.*~.**** Selection Order_selection Print_selection i> :'; ,: <!I Loop DATE: Apri l 27 *) *) , Char; Boolean; DECLARE EXTERNAL REFERENCfS %Include 13d" %Include 13e" Begin Loop : = True; While Loop do Be?in libSErase_page(Row:=1 ,Col:=1); libSSet_cursor(Pow:=1,Col:=1); Writeln(' ___ ._ •• A • • • • _ • • • • ************.*.')i Writeln(1 * *"); writeln( I * PREPA'RE A CURRE~T CROSSTA9L E .1); Writeln(1 * .")i Writeln(1 * •••• - ••••••••••••••••• _ •••••••• , ••••••••••••••••••••• ~**** •• ********.); *_ •••••••••••••••••• _•••••••••••••••• LibSSet_cursor(Row:=10,Col:=1); Writeln(1 Writeln( I , writelr1(1 (1) ( 2) (3) Create a new crosstable'); Output the ~ost recent crosstable"); Return to t~e main menu'); LibSSet_cursor(Row:=16,Col:=1); Write (I Enter your selection Readln(Selection); I) ; 78 - . ---;---:::-.;:-.~'-~-' '~ , ' \....-- ;, " While Not ( Selection in ( '1' , '2' , '3' ] ) Do Begin libSErase_pageCRow:=16,Col:=1); LibSSet_cursorCRow:=17,Col:=1); writelnCo INVALID SELECTION !!'); Writeln; - Write (0 Enter your selection: O)i Readln(Selection); End; Case Selection of '1 ' create_crosstable; 'Z' "3' End; ," End; ," End; Loop := false; 79 (* •• *****.~*****.****.** ••• (* ' , PROGRAM: (* '-(* *.* •• **.*.*******.*****.*** ********* •• ** ••• *., *) Enter_tou~naMent_statistics (30) DATE: April 18 *) *) .', ,,.. .. (*. ,'" ' ' ' -•• 1; This .odule serves as the entry menu for v i t a l . ) tournaMent infor.ation, such as naMe, dates, etc. .) (* (**.****.****~*****'****.***.**.***.*****.***.******** .****** , .•• :-'l I ~' ,- PURPOSE (* (* '," ':::~f;' PROC EOUR E ~;.-. . ~" ;~. ;~,~i' ," f." /."" VAR Char; .~, *) . Valid_alternating_colors Valtd_pairing_odd_Men Valid_scaring_byes Val t d_scori ng_un ffnisheds Valid_ranklng_unrateds Valid_nu.bers .. ," , , , .: Set of Char; Set of Char; Set of Char; Oesire_to_enter_options Screen_is_okay Char; Boolean; DECLARE INTERNAL REFERENCES Procedure Get_data_fields; Begin LibSefase_paqe(Row:=7 , Col:=1); LibSSet_cursor(Row:=7 , Col:=1); ~rite ( • Tournament nJllle Readln( TournaMent_naNe ); Write ( • Sponsor Readln( ~ponsor ); Write ( • Tournament Director Readln( Director ,; Write ( , Site Rea~Hn( Site ,; Write ( , Starting date Readln( Starting_date ); Writ e ( • Ending date · · ' · · · · ); ) ; ); ); ); ); *, •• *** •• ****). 80 -,-., ~0~'---'--- :~ ',-- -- ---.-- -: " Readln( Ending_date ); Write ( 1 Nu.ber of rounds Repeat Readln(Char_no_of_rounds) Until Char_no_of_rounds in ,'- , ); Valid_nu~bers; Write ( 1 Select variations? (Y or N) Repeat Readln(Desire_to_enter_options) Until Des1re_to_enter_options I ); If (Desire_to_enter_options 'Y') or (Desire_to_enter_options = " y ') then Begin Write ( • Scoring byes ' ); Repeat ReadLnCScoring_byes) Until Scoring_byes in Valid_scoring_byes; .' Write ( , Ranking unrated players Repea t Readln(Ranking_unrated_players) Until Ranktng_unrated_players in Valid_ranking_unrateds; Write ( , Scoring unfinished ga_es : ' ); Repeat Readln(Sco rin l_unfinished_games) Until Scoring_unfinisned_qames in Valid_scorin~_unfinisheds; Write ( ' ,Pairing odd m('n ' ); Repeat ReadlnCPairing_odd_men) Until Pairinq_odd_men in Valid_pairi"~_odd_men; , ); Write ( , Alter~ation of coLors Repeat 'Readln(Alternatinq_colors) Until Altern~ting_colors in Valid_altern~ting_colors; End: End; Procedure Display~screen; Begin Lib1Erase_DageCRow:=1,Col:=1); LibSSet_cursor(Row:=1,Col:=1); Writetn(' ••••••••••••••••••••••••••• * ••••••••••••••••••••••••••••••••• *••••••• '); Writeln(1 " .1); WritelnC" " ENTER TOURNAMENt DETAILS ."); WritelnC" • ."); --. 81 ••• * •••••• * ••••••••• ** ••••• ** •••• * •••••• **** •••••• ** •• *.**** •••• * •••• '); WrttelnC' '. ;. ,.. ( , ." t:.... I ,~, ~~' LibSSet_cursorCRow:=6, Cot:=l); ) ; Tournament name writelnC ) ; , Soonsor writeln( Sponsor ) ; , Director Writeln( Tournament Dfrector ) ; , Site Wd teln( Site . ); , Starting_date Starting date WritelnC , Ending_date )i Wrfteln( Endin'l date ) ; wrfteln ( , Char_no_of_rounds Number of raunds ) ; Writeln( Options , Scoring_byes); Wrfteln( Scoring byes , Rankfn'l_unrated_players); Wr HelnC Ranking unrated players Writeln( scoring unfinished games Scoring_unfinished_games); , Pairinq_odd_men); Pairing odd men Writeln( , Alternating_colors); writelnC Alternation of colors ~~. F End; f Var S c r een_'r esp ons e Begin Repeat Segin Lio$Erase pa'leCRow:='I,Col:=l); LibSSet_c~rsor(Row:=23,Col:=1); Write ( ' Is all the information on this screen OK? (Y or N) Readln ( Screen_resoonse ); If (Scree., resoo.,s!! = 'Q') or (Screen:resoonse = 'r') Then Oisplay_screen End Case Screen_response of 'yo , IN. End End; - ,~ 'y' 'n' Screen_is_okay := True; Screen_is_okay := False; t ); 82 Begin Char_no_of_rounds Ranking_unrated_players scoring_byes scori n 9_unfinished_9alles Pairing_odd_lIen Alternating_colors Valid_alternating_colors Valid_pai ri nll_odd_len Valid_scoring_byes 'Valid_scoring_unfinisheds val1d_ranking_unrateds V~Lid_nu.bers := := • a I; '0' ; • o· ; lUi; 'a'; := '0'; := ('0',"'); := ['0',"1'); := ('0','1']; := ('0','1'); := ['O',',','Z']1 ~ := ['1','2","3",'4","5","6",'7","8','9~]; libSErase_page(Row:=1,Col:=1); libSSet_cursor(Row:=l,Col:=l); wr1teln(1 *********************************************************************'); Wr1telnC' * *"'i writeln(1 * ENTER TOURNAMENT DETAILS *")i writeln(' * .I)i WritelnC" ****************************************************.****************'); GET GENER~L TOURNAMENT INFORMATION Repeat Begin Get_data_fielas; ,Get_affi rllat ion End WRITE DATA TO STATISTICS FIL: *) *) *) Rewrite(Tournament_statistics}; Writeln(Tournament_statistics,Tournament_name); Writeln(Tournallent_statistics,Soonsor); Writeln(Tournament_statistics,Oirector); ,- Writeln(Tournallent_statistics,Site); ,Writeln(Tournallent_statistics,Starting_date); Writeln(Tournament_statistics,Fndinq_date); Writeln(Tournallent_statistics,Char_no_of_rounds); " 83 , " '-- : , , .~' , Writeln(Tournament_statistics'Rankin~_unrated_players); Wri t eln( Tournsllent _s t at t s tics, S cor i nQ_byes); Vriteln(Tournallent_statistics,Scorinq_unfinished_Qalles); > "'J4'J"""Writeln(Tournallent stati9tics,Pairinq odd lien); ':''-' ::. ,,,,,; Writeln(Tournallent:stat 1st t cs, Alt ernat ing:colors); ,-,'{' ~: ' ;;,~!:t: F :':<;. :"'" C los e(Tournallent_stat is,t t c s); '?; '- ,~;, .J,. - t ~ ' ~::;:;~ ~~I' ;I;~~;J:' "'W' . to,,,,, (* NUMO" Of ROUNDS TO INTEGER :,~":;':j-~case Char _no_of_rounds of NUllber _of _rounds HUMber __of _rounds : ~~ \~~\;~:~.. Number_of _rounds ,',"if""" '4' NUlllIer_of_rounds '5' NUMber_of_rounds .', '," ,• 6' Number _of _rounds ~,-"""',':",..... "'7' NUMber_of_rounds ,,",,,,,'8' NUMbe r _0 f _r ounds '9' NUllber_of_rounds End; ~,' " c *' ,;.:~":.:,~ '1' .2 1 • 31 3"~ != 6; TOURNAM~NT ! = 8; := 9; POSTrq Revrite(Tournallent_roster); 'Close (tournament_roster); End; , , 4; 5; := ?; )' RESET 1; 2; := := := := := 84 ( •• * •• ***~********.****.********.********.*******.**** **A******* ••• *****) , ('* t .) (* PROGRAP'I Enter_a_pLayer (31) (* (* PURPOSE This k,_<* ,> L ; '; ~odule, DATE: Ar;.rtl 10 allows entry of a new player record. 1 ;j.,.. :.. ji·$. ;;;!~.< ~:~I~v". 'j' Enter_a,:,player; Pl.", Player_record; Screen_is_okay Boolean. ...... Integer; DECLARE INTERNAL REFERENCES Procedure Get data_fields; Begin With Player Do Be·)in LibSErase_P3Qe(Pow:=7 , Col:=l); LibSSet_cur~or(qow:=7 , Col:=l); Write ( I ~a~e Readln( Name ); Write ( ~3tinQ Readln( Rdting ); write ,( USCF ID number Readln( USCF_ID ); End: Procedure Display_screen; Begin .- , *) *) ~.~.~~ (******************** •••• ********************** •• *** •• *** ••• ************) }'''''j'};,~, PROCEDURE ,~~:.*,.;:~!.::..~. ; *) *) libSErase_page(Row:=l,Col:=l); libSSet_cursor(Row:=l,Col:=l); ) ; 85 -.~. .,' . Wr1teln(1 •••• ****** ••• ****** •• ***** •• **.* ••••••••••••••• * •••••••••••• ***** •• **'); WritelnCo ,. ,.0); Wdteln(' " ENTER TOURNAMENT OETilILS *0); Wr.itelnC" ,. ,.,); .,.*,.*******,.,.*******************************,.**********************,.,.*0); WritelnC O LibSSet_cursorCRow:=6,Col:=1); With Player Do Begin Wrtteln( 0 Wrtteln( , WrttelnC ' End; ',-,':' , Naill' , Rating , USCF_IO Halle Ratinq USCF IO nUlllber End: Var Char Begin Repeat Begin LibSErase_page(~ow:=23,Col:=1); \ LibSSet_cursor(Row:=23,Col:=1); Write ( ' I~ all the information on this screen OK? (Y or N) Readln ( Screen_response ); If (Screen_response = 'R') or (Screen_response = 'r') Then Display_screen End Until Screen_response in Case Screen_response of 'Y' , 'y' 'N' , End End; Begin -- In' ~ 'y' , 'N' , I y' , tn' J; Screen_is_okay := True; Screen_is_okay := False; I ); 86 LibSErase_page(Row:=1,Col:=1); LibSSet_cursor(Row:=1,Col:=1); Writeln(' ******** •••••• **.******* ••••••••••• ****.**** •••••• *** ••••• ***** ••• **.'); Writeln(" • *'); Writeln(' * ENTER A PLAYER RECORD .')i Writeln(' " *'); Wr1teln(1 ** ••••• * ••••• *** •• ** •••••• ** •• *****.******.*****.**.*** •••••• _A._* ..• '); ~- GET GENERAL TOURNAMENT INFORMATION Repeat Begin \ ;'<-,'" ;'.~ Get_data~fields; .. Get_afH rlut ion ,",t•. End WRITE DATA TO TOURNAMENT ROSTER *} *) *) With Player Do Be\jin ,; Pairing_number := for Loop_counter := to ~ax rounds do Begin , ,. Opponent [Loop_counter] : = [Loco_counter] := Co lor [Looo_counter] := 0.0 Result End; := :J.O; Score End; Extend ( Tournament_roster ); End; 87 l .... ~ ,l'~'·.·.' \..." (A******.****~.**.***.**.****.* (* (* '';''-:- (* (* .) PROGRAK Pr~pare_for_round_one (33) DATE: April 20, 1986 .) PURPOSE Thi s module ser yes as the entry IIIenu for vi t a l . ) tourna.ent infor.ation, such as naill" dates, etc. :~ *) '- i"',""·~~".:J' ~: ~. •• **.*** ••• **.****.**.* •••••••••• _ ••••••• ) ..~,,-.:::~:t.;-,.i,.. (*.* ... ** ********** •• *** •••••••• * ••••••••••••••• * * ••• ". ft. * ••••• *' ••••••••• ) " 1~. y ~: , .,,~. '-"f~~~~~'~ PROC EDUR,E TYPE Packed array [1 •• 3] of Char; VAR Index Player I Current_nu.ber Int~ger; Player_record; Three_chari Card_pointer; Ne~_pairing_card FUNCTION Digit1 , Diqit2 , Digit3 : Chari Var ge(,lin Readv ( Current_nu!ber , Digit1 , Digit2 , Digit3 ); If Digit2 < '9' Then Next := Digit1 Else If Digit1 < + Succ(OiqitZ) + '9' Then Ne~t := Succ(Di]it1) + Else NeKt ':= '1~l'; 'a' 'a' + '0' End; PROCEDURE 8~(,Iin New(N~v_pairing_card); New_pairing_cardA.Next_card New_pairing_cardA.Pairing_nu",ber N~w_pairing_cardA.Score New_pairing_cardA.Odd_~an_status := := := := ::: NH; Player.Pa;ring_number; L.Q; 0; ,,- Nev_pairing_cardA.Color_due_status Ne._pairing_cardA.Unfinished_game_status:= '; New_pairing_cardA.Bye_given_status := 'N': - - I 88 For Index := End; ."" := . ,. PROC EOUR E Begtn f~-;~1i;/ r '~" If End_of_scored = Ntl Then Scored_pointer := New_pairinq_card Else End_of_scored-.Next_card := New_pairing_card; End; !." *) " Begin MAIN BODV OF MODULE *) .) ~ L1b'Set_cursor(Row:=20,Col:=1); ". IIriteln(1 fireparing fUn and pairing cards for round one.'); 'Ltb,spawn(CoMMand:='Sort/Key=<position:34,Size:4,Descending) Tournament roster.Dat TeMporary_roster. Reset (TeMporary_roster); Rewr1te(Tournament_roster); Current_nusber := '010'; While not (eof(Temporary_roster» Begin and not (Current_number = 'ono') 00 Read (Temporary_roster, Player); Player.Pairin1_number := Current_number; Htghest_pairing_numoer := Current_number; Create_pairing_car1: Add_to_end_of_scored; End; Close (Temporary_roster); Close (Tournament_roster); LtbSSpawn(Cosmand:='Delete/~oconfirm Temporary_roster.Oat;.'): 89 -<'", ~; , ," ~.:~;'""'~r "'" Then Begin '. ~• irbt 't Seeltn-(~U rso r( Row: =2 2, Co Ll :1. =.1i t); 0 f '.....""'. i."f./'::---/ 'J:;" ~. tZ '.?,.~ is . Lt ~"»"'.'>iI'.:' ~ b' Spalln( Co •• and: =' Conve r t I Fd l=R os t e r ;~{;.'t~·End· . ,t'..! 1;~;~,Z:i?; - 99 players reached ••• Rest ignored'); End: ~..;:,..". I " Tou rnallent _ro, t er. Dat T ournH,e nt_ros t er. Dat'); 90 "',OJ F.~ ~ .... --"~- -.~ - - -',- (*********** ••• ******** •• **.* •••••• ******.*****.*******.* •••••••••• ** ••• ) (A *) (* '. PROGRA" Place_cards_in_scored_list (34) DATE: April 25 PURPOSE This module lIoves a newly-scored pairing card fro. ~he paired card list to the scored list. .) *) --(A ,.,,-,,,,,"'. (* ~,\,,?t..'''''': (* ~f/;r. (A *) *) *) (*******************************.**********-********** ••••• *_.* •• * •••••• ) Advance_one_cell; 8egi n ::, Previou,s := Current; Current := CurrentA.Next_cardi End; '~Procedure '! , 8egi n For Array_index := 1 to 2 do c** (** C** ... ) REMOVE CA~D FROM PAIRED LIST •• ) *.) If Desired_card[Array_index] Previous_card[Array_index) Then Paired_pointer := D~sir~d_card(Array_index]A.Ne~t_card 'Else previou~_card[ArraY_index]A.Next_card := Desired_card(Array_index]A.Next_card; If ( Array_index = , ) ~nd ( Desired_card(l] = Previous_c~rd(2J ) Then If C previous_cdrd[2] = previous_cardell Then Prev;ous_card(Zl := Paired_pointer Else previous_card[2J := Previous_cardell; (** •• ) C.*, PLACE CARD IN SCORED LIST AT THE P~OPfR (** •• ) •• ) If Scored_pointer = Nil Then Begin (* (* - LOC~TI~N *) PLACE CARD IN SCORED LIST *> 91 Desired_cardCArray_indeK]A.NeKt_card := Nil; Scored~pointer := Desfred_card[Array_indeK]; End Else Begin (o. (* LOCATE PROPER POSITION IN SCORED LIST ,o. o.) o.) o.) Previous := Scored_pointer; Current := Scored_pointer; .. hi le Current <> Ni l ) and CurrentA.Score > Oesired_card[Array_indeK]A.S core ) do Advance_one_cell; "'hi le ( Current <> Ni l ) and ( CurrentA.Score = Oesired_card(Array_indeK]A.S core ) and ( CurrentA.Pairing_nu.ber < Oesired_card(Array_index]A.Pairing_nu.ber ) do Advance_one_cell; (* (* C* *) PLACE CARD IN SCORED LIST *) *) ".-J" If Current = Previous Then Scored_pointer := Desired_card[Array_indeK) Else PreviousA.NeKt card := Oesired_cardCArray_indeK)i End; End; End; 92 , (.********* •• ****** •• A**.***** •• * •••• ******* ••• ** •••••• _•••• _•••• _•••••• ) (* PROGR_" EntH_round_result ,(* (* PURPOSE This _odule allows entry of a game result. -(* j,~ , t~ ~, , . '\:, . ,.:;.. .) .(*. (*******111: .... _ ••• * ••• .,. "*Ir • •• If • • AIr* • • *_,..*.,.. ;t,,;,;;. OATE : Apri l 21 (5) _.*_ .) .) .) *) It • • • * *. *Ir _......... * ••••• *" .. ) ;"~;:~,ii'" PROCEDURE :, . ';;":?:,".; . ' VAR Boolean; ........... ' ., ... .'"., DECLARE INTERNAL REfERENCES Val' ,'_ I Messagel,Message2 Pairing_nu_ber Packed array [1 •• 38] of Char; Varying [10] of Char; Begin , Col::1); LibSSet_cursor(Row:=7 , Col::1); LibSEr~se_Daqe(Row::7 Write ( , Result (II or D) , ); Repeat Readln( Game_result.~esult ) Until Ga~e_result.Re,ult in ['W','D','w','d'Ji If ( Ga.e_~esult.Result Then Begin Message1 := Message2 := End Else Begin Messagel := , "'e~sage2 := = "II' ) or ( PairinQ Pairing /I of winner of loser ... P!!iring Pairinq /I /I of player 1 : of plllyer 2: '; Game_re,ult.Result Ii End; Write ( Message1 ); Repeat Readln( Pairing_number) Until ( Length(Pairing_nu_ber) 3 ( Pairing_number >= '001" ( Pairing_number : ' w' , ; '; ) and ) and 93 - .' Write ( Message2 ); Repeat Readln( Pairing_nu~ber ) Until ( length(Pairing_nu~ber) ( Pairin~_nuillber ( Pairing_nu_ber C Pairing_nu.ber = 3 and >= 'Oat' and <= Highest_pairing_nuillber and <> Ga.e_ r esult.Player[11 ) i 'aae_result.Player[21 :=,Patring_nuaberi End; Procedure Display_screen: Begin ~r- J ","1-'. .. ,,>. LibSErase_page(Row:=1,Col:=1); libSSet_cursor(Row:=1,Col:=1); WrftelnC' •••• *_.******-* ••••••• _•• *••• _•• _ ••• * •• *** •• *** •••• *•• *.*** ••• *** •• **'); WritelnC I * ."); WritelnC" * ENTER A ROUND RESULT .1); WritelnC" * .. I ) ; Writ.lnt' •••••••••••• ** •••••••••••••••••••••••••••••••••• * ••••••••••••••• ** •••• ); LibSSet_cursor(Row:=6,Col:=1); ' Writeln( • Result : I , Ga.e_result.Result ): If ( Gallle_result.Result = 'w' ) or C Gallle_result.Result ='w' ) Then Begin , Ga~e_result.Player[1] ); Pairing II of winner Writeln( • , Gallle_result.Player[2l ) ; Pairing /I of loser Writeln( • End Else l'Iegin Pairing /I of p l ~y e r 1 : • , Gallle_result.player[1J ) ; Writeln( • of pLayer 2 : I , Game_result.PLayer[2l ) ; Pairing Writeln( • End; " End; Procedure Get_affirillation; Var Screen~response Char Begin Repeat Begin LibSErase page(Row:=J',col:=1); LibSSet_cursor(Row:=23,Col:=t); ,- 94 \,..... write ( ' Is all the infor.ation on this screen OK? (Y or N) Readln ( screen_response ); '-.. If (Screen_response = '$I') . (Screen_response = Or') Then Display_screen or Until Scree"_re'sponse in [ 'y' , Case Screen_response of 'Y' , 'y' .• . • .. .< . ~ ); End ... 't ~ , "N' , 'y' , "n' ]: Screen_is_okay := True; Screen_is_okay := False; 'N' , 'n' End f. ".',~~, -" t ~7:~:. ';- Begin. "~ . .L LibSErase_page(Row:=1,Col:=1)i LtbSSet_tu~sor(Row:=1,Col:=1); WritelnC" WritelnC" writelnC" Writeln<" WritelnC" •••••••••••••••••••• * •••••••••••••••••••••••••••••••••••••••••• ~ •••••• ); • .'); • ENTER A ROUND RESULT ."); • ."); ••••••••••••••••••••••••••• * •••••••••••••••••••••••••••••••••••••••••• ); (. (. GET GENERAL TCURNA~ENT (. t Repeat Get_dat a_ fie lds; Get_affirlut ion INFOR~ArION 95 '~',~ ,-. (******* ... ****.*:It .... It . . . . . . . . . It .' . . . . . . . . . . . . *It" .. " (* (* ,-,'. - . (* (* .J' (* .;-. (* .* ....... It . . . * ... It • • • *.* .... ".. * ••• ** .. ) .) PROGRAM Record.round.results (36) DATE: April 22 .) .) PURPOSE. This module records a lame r~sult on a pairing card and in the appropriate roster record. *) .) *) (************ •• **************************************** •• ***._ ........ * •• ) ...... PROCEDURE Record~round.rl!Sults; . " :'0 <,,;.,'Ii; i: ····J~~:.8e9in (* ~".. "ri..; .. .. '<.. '~'-' ",.,' (* (* UPDATE THE PAIRING CARDS IIriteln(l .. ._lty I f ( Ga.e.result.Result " ~ ~ i.-.'.... J ,". Updating the pairing.cards·); = ·w· ) = or ( Ga.e.result.Result 'w' ) Then Desire;d card(1J"'.Score := Desired.cardC1]"'.Score + 1.0 Else Begin I • Desired.card(1)"'.Score := Desired.card(l]"'.Score + 0.5; Desired.card(2)A~Score := Desired.card(2]"'.Scor~ + 0.5; End; UPDATE THE ROSTER Writeln(' Updating the tournament.roster·); Open <Tournament.roster History : = Old , Organization := Inde~ed , := Keyed ); Access.method Resetk( Tournament.roster , ~ • ill' )i ) 0 r Game result.Result • w' Then Begin Findk(Tournament.roster,a,G~me.result.Player[1]); Tournall~nt.rosterA.Result(Round.number] Tournament.roster~.Score := := 1.0; Tournallent.rost~r"'.Score Update(Tourna"ent.roster); Findk(TournamEnt.rosttr,2,Game.result.Pl~yer(2]); Tourna~ent.rosterA.~esult(Round.numberJ := ~.o; Update(Tourna~ent.roster); End Else Begin - + 1.0; 96 Tourna.ent_rosterA.Result[Round_numberl := 0.5; Tourna.ent_rosterA.Score := Tourna.ent rosterA.Score + 0.5; Update(TournaNent_roster); - Findk(Tournament_roster,0,Ga~~_result.Player(2]); TournaMent_rosterA.Result(Round_numberl := 0.5; Tourna.ent_rosterA.Score := Tourna~ent_rosterA.Score. + 0.5; Update(Tourna.ent_roster); End; 97 (.**.******** ••• *** ••••• ** ••• ** ••••••• *** ••••••••••••• ****.* •••• *.*.****, (* (* - - (* (* (* ,", , (* !, ,,' .J:'" '~ . • !~ . 1 •• ~. ,. .) PROGRAM locate_pairing_cards (37) DATE: April 22 PURPOSE Thi S lIIodule loc ates a pai ri n9 card based on the pai ring nUlllber in question. .) .) ,VAR Previous Current_card Found_one Found_two Card_pointer; Card_poi nt e-r; Boolean; Boolean; .i'...... , *) locate the pairing cards .. ) .) locating the pairing cards'); Writeln(' Found_one ,Found_two := False; := False; := Paired_pointer; Previous Current_card := Paired_pointer; While ( Current card <> Nil) And Not ( found_one and found_two) 00 Beg;n' = Gallle_result.Player(1l Then Begin Previous_card(1l := Previous; Desired_card[1l := Current_card; Found_one := True; End Else If Current_cardA.Pairing_nulllber = Game_result.Player(Zl Then fJegin Previous_tard(~] := Previous; Desl red_card(Zl := Current_card; : = Tru e; End; If Current_C3rd A .Pairinq_nUlllber Previous := Current_card; Current_cara := Current_cardA. Next_card; End; Test for appropriate conditions .) .) *) - .) .) (*********** •••• ***** •• ***************** ••• *.**********.* ••••• _ •••••••• _) "':·'.PROCEOURE " *, 98 ' I f not found_one then if not' found_two then Error_code else Error_code else if not found_two then rrror_code else Error_code := 3 := 1 := 2 := 0; (ft.ft (. (ft (* ... (ft (* ( <--- This is where the test for the players having been paired is to be made -- in the fin ale l s e bloc k. For now, assu.ed Ok. ... ) ft) .) *) .. ) .) * •• ) End; "-- '- "l' ;' ,. ( . 99 (**.***.****.******.*~*****.**.******.******.**.*** Cft Cft .:--... ••• ******.**** •• ** •• *) .) PROGRA~ Prepare_for_pairing (38) DATE: April 30 PURPOSE Thi s lIodule elindnates unti nhhed galllE'S and assigns a bye to the odd .an ( i f there is one). ~ft " t. -'(* *) .) -Cft .~-(* ~:: ~.>;'.:~. 7(******.'*"*.**** ••• * ......... *.* •• - .,........ . *. *.*** . . to) *) *) * * * •• * ** •• ft • • • * ........... ** •• *. **) . / ~-'I"ROCEDURE' .. ~.;;~~~~ - ";:. ... .. ~ ~ . - ~. -.'~~-- DECLARE EXTERNAL REFERENCES XInel'ude '43' Xlnelude '44" IIne.lude '45" ft) to) ft) '--'lIriteln( 1 - (ft _·(ft Preparing for the pairings • • • '); The following code will be used to handle all unfinished qa~es .. hen t.his feature of the syste", is ready to be introduced. --.- (ft ·~'(ft -eft _.(* -(ft --'(ft -If ( -- End; If Paired_pointer <> Nil Then Case Scoring_unfinished_qa",es of '1' Enter_adjudicated_scores; '~, Assign_score_to_unfinished_qallles; End; . *) to) ) *) -0) .) *) *)