PROGRAM classical_composition (Input,Output); { This program composes note sequences in a manner designed to conform as far as possible to a set of example sequences. } { Copyright 1989 by Wesley R. Elsberry. All rights reserved. Commercial use of this software is prohibited without written consent of the author. For information, bug reports, and updates contact Wesley R. Elsberry 528 Chambers Creek Drive South Everman, Texas 76140 Telephone: (817) 551-7018 } USES DOS, misc1, ANSI_Z, globals, clasinst; {General} VAR ii, jj, kk : INTEGER; notes : notes_; sinch : CHAR; scon, outfname : STRING; outf : TEXT; cnt,success : INTEGER; ana : ARRAY[1..8] OF INTEGER; ana_cnt : INTEGER; PROCEDURE fill_ana (notes : notes_); VAR ii, tr : INTEGER; BEGIN ana_cnt := 0; FOR ii := 1 TO 8 DO BEGIN notes[5] := ii; ana[ii] := classical_instructor(notes); END; FOR ii := 1 TO 8 DO BEGIN IF ana[ii] = 1 THEN BEGIN INC(ana_cnt); ana[ana_cnt] := ii; END; END; END; BEGIN Randomize; FOR ii := 1 TO 5 DO BEGIN notes[ii] := 0; END; {Get filename to test} Write('Name of file to process: '); Readln(outfname); {Open for input} Assign(outf,outfname); Rewrite(outf); FOR ii := 1 TO 10000 DO BEGIN fill_ana(notes); IF ana_cnt <> 0 THEN BEGIN notes[5] := ana[(Random(ana_cnt) + 1)]; END ELSE BEGIN notes[5] := Random(8) + 1; END; FOR jj := 1 TO 4 DO BEGIN notes[jj] := notes[jj+1]; END; Writeln(outf,notes[5]); END; Close(outf); END.