home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / o / ops5.zip / DEC.OPS < prev    next >
Text File  |  1992-05-31  |  11KB  |  300 lines

  1.  
  2. (literalize player
  3.   number
  4.   nights-scheduled)
  5.  
  6. (literalize foursome
  7.   night
  8.   group
  9.   north
  10.   south
  11.   east
  12.   west)
  13.  
  14. (literalize context
  15.   name)
  16.  
  17. (literalize scheduling
  18.   night)
  19.  
  20. (literalize already-played
  21.   player1
  22.   player2)
  23.  
  24. (literalize candidate
  25.   group
  26.   chosen
  27.   south
  28.   east
  29.   west)
  30.  
  31.  
  32. (p startup 
  33.   (start)
  34. -->
  35.   (make player ^number 1 ^nights-scheduled 0)
  36.   (make player ^number 2 ^nights-scheduled 0)
  37.   (make player ^number 3 ^nights-scheduled 0)
  38.   (make player ^number 4 ^nights-scheduled 0)
  39.   (make player ^number 5 ^nights-scheduled 0)
  40.   (make player ^number 6 ^nights-scheduled 0)
  41.   (make player ^number 7 ^nights-scheduled 0)
  42.   (make player ^number 8 ^nights-scheduled 0)
  43.   (make player ^number 9 ^nights-scheduled 0)
  44.   (make player ^number 10 ^nights-scheduled 0)
  45.   (make player ^number 11 ^nights-scheduled 0)
  46.   (make player ^number 12 ^nights-scheduled 0)
  47.   (make player ^number 13 ^nights-scheduled 0)
  48.   (make player ^number 14 ^nights-scheduled 0)
  49.   (make player ^number 15 ^nights-scheduled 0)
  50.   (make player ^number 16 ^nights-scheduled 0)
  51.   (make foursome ^night 1 ^group a ^north nil ^south nil ^east nil ^west nil)
  52.   (make foursome ^night 1 ^group b ^north nil ^south nil ^east nil ^west nil)
  53.   (make foursome ^night 1 ^group c ^north nil ^south nil ^east nil ^west nil)
  54.   (make foursome ^night 1 ^group d ^north nil ^south nil ^east nil ^west nil)
  55.   (make foursome ^night 2 ^group a ^north nil ^south nil ^east nil ^west nil)
  56.   (make foursome ^night 2 ^group b ^north nil ^south nil ^east nil ^west nil)
  57.   (make foursome ^night 2 ^group c ^north nil ^south nil ^east nil ^west nil)
  58.   (make foursome ^night 2 ^group d ^north nil ^south nil ^east nil ^west nil)
  59.   (make foursome ^night 3 ^group a ^north nil ^south nil ^east nil ^west nil)
  60.   (make foursome ^night 3 ^group b ^north nil ^south nil ^east nil ^west nil)
  61.   (make foursome ^night 3 ^group c ^north nil ^south nil ^east nil ^west nil)
  62.   (make foursome ^night 3 ^group d ^north nil ^south nil ^east nil ^west nil)
  63.   (make foursome ^night 4 ^group a ^north nil ^south nil ^east nil ^west nil)
  64.   (make foursome ^night 4 ^group b ^north nil ^south nil ^east nil ^west nil)
  65.   (make foursome ^night 4 ^group c ^north nil ^south nil ^east nil ^west nil)
  66.   (make foursome ^night 4 ^group d ^north nil ^south nil ^east nil ^west nil)
  67.   (make foursome ^night 5 ^group a ^north nil ^south nil ^east nil ^west nil)
  68.   (make foursome ^night 5 ^group b ^north nil ^south nil ^east nil ^west nil)
  69.   (make foursome ^night 5 ^group c ^north nil ^south nil ^east nil ^west nil)
  70.   (make foursome ^night 5 ^group d ^north nil ^south nil ^east nil ^west nil)
  71.   (make context ^name north)
  72.   (make scheduling ^night 1)
  73.   (write (tabto 32) |Tournament Schedule| (crlf) (crlf)
  74.      (tabto 15) |N  S  E  W|
  75.      (tabto 42) |N  S  E  W|
  76.      (tabto 68) |N  S  E  W| (crlf)
  77.      (tabto 15) |=  =  =  =|
  78.      (tabto 42) |=  =  =  =|
  79.      (tabto 68) |=  =  =  =| (crlf)))
  80.  
  81. (p north:pick-one-1
  82.   (context ^name north)
  83.   (scheduling ^night <n>)
  84.   { <THE-FOURSOME> (foursome ^night <n> ^north nil) }
  85.   { <THE-PLAYER> (player ^number <p> ^nights-scheduled < <n>) }
  86.   (foursome ^night <n> ^north { <p1> <> nil })
  87.   (foursome ^night <n> ^north { <p2> <> <p1> <> nil })
  88.   (foursome ^night <n> ^north { <p3> <> <p2> <> <p1> <> nil })
  89.   (already-played ^player1 <p> ^player2 <p1>)
  90.   (already-played ^player1 <p> ^player2 <p2>)
  91.   (already-played ^player1 <p> ^player2 <p3>)
  92. -->
  93.   (modify <THE-PLAYER> ^nights-scheduled <n>)
  94.   (modify <THE-FOURSOME> ^north <p>) )
  95.  
  96. (p north:pick-one-2
  97.   (context ^name north)
  98.   (scheduling ^night <n>)
  99.   { <THE-FOURSOME> (foursome ^night <n> ^north nil) }
  100.   { <THE-PLAYER> (player ^number <p> ^nights-scheduled < <n>) }
  101.   (foursome ^night <n> ^north { <p1> <> nil })
  102.   (foursome ^night <n> ^north { <p2> <> <p1> <> nil })
  103.   (already-played ^player1 <p> ^player2 <p1>)
  104.   (already-played ^player1 <p> ^player2 <p2>)
  105. -->
  106.   (modify <THE-PLAYER> ^nights-scheduled <n>)
  107.   (modify <THE-FOURSOME> ^north <p>) )
  108.  
  109. (p north:pick-one-3
  110.   (context ^name north)
  111.   (scheduling ^night <n>)
  112.   { <THE-FOURSOME> (foursome ^night <n> ^north nil) }
  113.   { <THE-PLAYER> (player ^number <p> ^nights-scheduled < <n>) }
  114.   (foursome ^night <n> ^north { <p1> <> nil })
  115.   (already-played ^player1 <p> ^player2 <p1>)
  116. -->
  117.   (modify <THE-PLAYER> ^nights-scheduled <n>)
  118.   (modify <THE-FOURSOME> ^north <p>) )
  119.  
  120. (p north:pick-one-4
  121.   (context ^name north)
  122.   (scheduling ^night <n>)
  123.   { <THE-FOURSOME> (foursome ^night <n> ^north nil) }
  124.   { <THE-PLAYER> (player ^number <p> ^nights-scheduled < <n>) }
  125. -->
  126.   (modify <THE-PLAYER> ^nights-scheduled <n>)
  127.   (modify <THE-FOURSOME> ^north <p>) )
  128.  
  129. (p north:done
  130.   { <THE-CONTEXT> (context ^name north) }
  131. -->
  132.   (modify <THE-CONTEXT> ^name make-candidates))
  133.  
  134. (p make-candidates:make-candidate
  135.   (context ^name make-candidates)
  136.   (scheduling ^night { <n> < 3 })
  137.   (foursome ^night <n> ^group <g> ^north <yankee>)
  138.   (player ^number <redneck> ^nights-scheduled < <n>)
  139.   (player ^number { <oriental> < <redneck> } ^nights-scheduled < <n>)
  140.   (player ^number { <cowboy> < <oriental> } ^nights-scheduled < <n>)
  141.   - (already-played ^player1 <yankee> ^player2 <redneck>)
  142.   - (already-played ^player1 <yankee> ^player2 <oriental>)
  143.   - (already-played ^player1 <yankee> ^player2 <cowboy>)
  144.   - (already-played ^player1 <redneck> ^player2 <oriental>)
  145.   - (already-played ^player1 <redneck> ^player2 <cowboy>)
  146.   - (already-played ^player1 <oriental> ^player2 <cowboy>)
  147.   - (candidate ^group <g> ^chosen no ^south <redneck> ^east <oriental>)
  148.   - (candidate ^group <g> ^chosen no ^south <redneck> ^west <cowboy>)
  149.   - (candidate ^group <g> ^chosen no ^east <oriental> ^west <cowboy>)
  150. -->
  151.   (make candidate ^group <g> ^chosen no
  152.      ^south <redneck> ^east <oriental> ^west <cowboy>))
  153.  
  154. (p make-candidates:make-candidate-late
  155.   (context ^name make-candidates)
  156.   (scheduling ^night { <n> > 2 })
  157.   (foursome ^night <n> ^group <g> ^north <yankee>)
  158.   (player ^number <redneck> ^nights-scheduled < <n>)
  159.   (player ^number { <oriental> < <redneck> } ^nights-scheduled < <n>)
  160.   (player ^number { <cowboy> < <oriental> } ^nights-scheduled < <n>)
  161.   - (already-played ^player1 <yankee> ^player2 <redneck>)
  162.   - (already-played ^player1 <yankee> ^player2 <oriental>)
  163.   - (already-played ^player1 <yankee> ^player2 <cowboy>)
  164.   - (already-played ^player1 <redneck> ^player2 <oriental>)
  165.   - (already-played ^player1 <redneck> ^player2 <cowboy>)
  166.   - (already-played ^player1 <oriental> ^player2 <cowboy>)
  167. -->
  168.   (make candidate ^group <g> ^chosen no
  169.     ^south <redneck> ^east <oriental> ^west <cowboy>))
  170.  
  171. (p make-candidates:done
  172.   { <THE-CONTEXT> (context ^name make-candidates) }
  173. -->
  174.   (modify <THE-CONTEXT> ^name make-choice)) 
  175.  
  176. (p make-choice:doit
  177.   { <THE-CONTEXT> (context ^name make-choice) }
  178.   { <WINNER-A> (candidate ^group a ^chosen no
  179.     ^south <sa>
  180.     ^east  <ea>
  181.     ^west  <wa>) }
  182.   { <WINNER-B> (candidate ^group b ^chosen no
  183.     ^south { <sb> <> <sa> <> <ea> <> <wa> }
  184.     ^east  { <eb> <> <sa> <> <ea> <> <wa> }
  185.     ^west  { <wb> <> <sa> <> <ea> <> <wa> }) }
  186.   { <WINNER-C> (candidate ^group c ^chosen no
  187.     ^south { <sc> <> <sa> <> <ea> <> <wa> <> <sb> <> <eb> <> <wb> }
  188.     ^east  { <ec> <> <sa> <> <ea> <> <wa> <> <sb> <> <eb> <> <wb> }
  189.     ^west  { <wc> <> <sa> <> <ea> <> <wa> <> <sb> <> <eb> <> <wb> }) }
  190.   { <WINNER-D> (candidate ^group d ^chosen no
  191.     ^south { <sd>
  192.             <> <sa> <> <ea> <> <wa>
  193.             <> <sb> <> <eb> <> <wb>
  194.             <> <sc> <> <ec> <> <wc> }
  195.     ^east  { <ed>
  196.             <> <sa> <> <ea> <> <wa>
  197.             <> <sb> <> <eb> <> <wb>
  198.             <> <sc> <> <ec> <> <wc> }
  199.     ^west  { <wd>
  200.             <> <sa> <> <ea> <> <wa>
  201.             <> <sb> <> <eb> <> <wb>
  202.             <> <sc> <> <ec> <> <wc> }) }
  203. --> 
  204.   (modify <WINNER-A> ^chosen yes)
  205.   (modify <WINNER-B> ^chosen yes)
  206.   (modify <WINNER-C> ^chosen yes)
  207.   (modify <WINNER-D> ^chosen yes)
  208.   (modify <THE-CONTEXT> ^name remove-candidates))
  209.  
  210. (p remove-candidates:bye
  211.   (context ^name remove-candidates)
  212.   { <THE-CANDIDATE> (candidate ^chosen no) }
  213. -->
  214.   (remove <THE-CANDIDATE>))
  215.  
  216. (p remove-candidates:done
  217.   { <THE-CONTEXT> (context ^name remove-candidates) }
  218. -->
  219.   (modify <THE-CONTEXT> ^name apply-choice))
  220.  
  221. (p apply-choice:doit
  222.   (context ^name apply-choice)
  223.   (scheduling ^night <n>)
  224.   { <THE-FOURSOME> (foursome ^night <n> ^group <g> ^north <yankee>) }
  225.   { <THE-CHOICE> (candidate ^group <g> ^chosen yes
  226.             ^south <redneck> ^east <oriental> ^west <cowboy>) }
  227. -->
  228.   (modify <THE-FOURSOME> ^south <redneck> ^east <oriental> ^west <cowboy>)
  229.   (remove <THE-CHOICE>)
  230.   (make already-played ^player1 <yankee> ^player2 <redneck>)
  231.   (make already-played ^player2 <yankee> ^player1 <redneck>)
  232.   (make already-played ^player1 <yankee> ^player2 <oriental>)
  233.   (make already-played ^player2 <yankee> ^player1 <oriental>)
  234.   (make already-played ^player1 <yankee> ^player2 <cowboy>)
  235.   (make already-played ^player2 <yankee> ^player1 <cowboy>)
  236.   (make already-played ^player1 <redneck> ^player2 <oriental>)
  237.   (make already-played ^player2 <redneck> ^player1 <oriental>)
  238.   (make already-played ^player1 <redneck> ^player2 <cowboy>)
  239.   (make already-played ^player2 <redneck> ^player1 <cowboy>)
  240.   (make already-played ^player1 <oriental> ^player2 <cowboy>)
  241.   (make already-played ^player2 <oriental> ^player1 <cowboy>))
  242.  
  243. (p apply-choice:done
  244.   { <THE-CONTEXT> (context ^name apply-choice) }
  245. -->
  246.   (modify <THE-CONTEXT> ^name report))
  247.  
  248. (p report:night-schedule
  249.   { <THE-CONTEXT> (context ^name report) }
  250.   (scheduling ^night <n>)
  251.   (foursome ^night <n> ^group a ^north <an> ^south <as> ^east <ae> ^west <aw>)
  252.   (foursome ^night <n> ^group b ^north <bn> ^south <bs> ^east <be> ^west <bw>)
  253.   (foursome ^night <n> ^group c ^north <cn> ^south <cs> ^east <ce> ^west <cw>)
  254.   (foursome ^night <n> ^group d ^north <dn> ^south <ds> ^east <de> ^west <dw>)
  255. -->
  256.   (modify <THE-CONTEXT> ^name next-night)
  257.   (bind <n2> (compute <n> + 5))
  258.   (bind <n3> (compute <n> + 10))
  259.   (write (crlf) (rjust 1) |#| (rjust 1) <n> (rjust 1) : (tabto 5)
  260.     |Group A:| (rjust 3) <an> (rjust 3) <as> (rjust 3) <ae> (rjust 3) <aw>
  261.     (tabto 27) (rjust 1) |#| (rjust 2) <n2> (rjust 1) : (tabto 32)
  262.     |Group A:| (rjust 3) <an> (rjust 3) <ae> (rjust 3) <as> (rjust 3) <aw>
  263.     (tabto 53) (rjust 1) |#| (rjust 2) <n3> (rjust 1) : (tabto 58)
  264.     |Group A:| (rjust 3) <an> (rjust 3) <aw> (rjust 3) <ae> (rjust 3) <as>)
  265.    (write (crlf)
  266.     (tabto 5)
  267.     |Group B:| (rjust 3) <bn> (rjust 3) <bs> (rjust 3) <be> (rjust 3) <bw>
  268.     (tabto 32)
  269.     |Group B:| (rjust 3) <bn> (rjust 3) <be> (rjust 3) <bs> (rjust 3) <bw>
  270.     (tabto 58)
  271.     |Group B:| (rjust 3) <bn> (rjust 3) <bw> (rjust 3) <be> (rjust 3) <bs>)
  272.    (write  (crlf)
  273.     (tabto 5)
  274.     |Group C:| (rjust 3) <cn> (rjust 3) <cs> (rjust 3) <ce> (rjust 3) <cw>
  275.     (tabto 32)
  276.     |Group C:| (rjust 3) <cn> (rjust 3) <ce> (rjust 3) <cs> (rjust 3) <cw>
  277.     (tabto 58)
  278.     |Group C:| (rjust 3) <cn> (rjust 3) <cw> (rjust 3) <ce> (rjust 3) <cs>)
  279.    (write (crlf)
  280.     (tabto 5)
  281.     |Group D:| (rjust 3) <dn> (rjust 3) <ds> (rjust 3) <de> (rjust 3) <dw>
  282.     (tabto 32)
  283.     |Group D:| (rjust 3) <dn> (rjust 3) <de> (rjust 3) <ds> (rjust 3) <dw>
  284.     (tabto 58)
  285.     |Group D:| (rjust 3) <dn> (rjust 3) <dw> (rjust 3) <de> (rjust 3) <ds>
  286.     (crlf)))
  287.  
  288. (p next-night:more
  289.   { <THE-CONTEXT> (context ^name next-night) }
  290.   { <THE-NIGHT> (scheduling ^night { <n> < 5 }) }
  291. -->
  292.   (modify <THE-CONTEXT> ^name north)
  293.   (modify <THE-NIGHT> ^night (compute <n> + 1)))
  294.  
  295. (p next-night:done
  296.   (context ^name next-night)
  297. -->
  298.   (write (tabto 32) |End of Scheduling| (crlf) (crlf)))
  299.  
  300.