home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / lifeos2.zip / LIFE-1.02 / PITCH / WL.SAV < prev   
Text File  |  1996-07-13  |  52KB  |  2,779 lines

  1. dynamic(is_out)?
  2. bind_deck(0,[5,
  3. 11,
  4. 12,
  5. 40,
  6. 16,
  7. 2,
  8. 15,
  9. 21,
  10. 30,
  11. 36,
  12. 45,
  13. 22,
  14. 6,
  15. 8,
  16. 19,
  17. 23,
  18. 20,
  19. 9,
  20. 24,
  21. 26,
  22. 27,
  23. 29,
  24. 10,
  25. 32,
  26. 0,
  27. 46,
  28. 38,
  29. 48,
  30. 51,
  31. 52,
  32. 17,
  33. 18,
  34. 25,
  35. 35,
  36. 43,
  37. 13,
  38. 4,
  39. 1,
  40. 7,
  41. 33,
  42. 39,
  43. 28,
  44. 44,
  45. 47,
  46. 3,
  47. 53,
  48. 42,
  49. 50,
  50. 34,
  51. 49,
  52. 14,
  53. 31,
  54. 37,
  55. 41]).
  56. bind_deck(1,[53,
  57. 52,
  58. 49,
  59. 30,
  60. 15,
  61. 29,
  62. 44,
  63. 51,
  64. 50,
  65. 7,
  66. 19,
  67. 48,
  68. 8,
  69. 13,
  70. 16,
  71. 14,
  72. 0,
  73. 24,
  74. 40,
  75. 43,
  76. 6,
  77. 28,
  78. 45,
  79. 5,
  80. 22,
  81. 37,
  82. 47,
  83. 46,
  84. 42,
  85. 41,
  86. 3,
  87. 11,
  88. 20,
  89. 21,
  90. 25,
  91. 26,
  92. 10,
  93. 23,
  94. 18,
  95. 27,
  96. 32,
  97. 34,
  98. 12,
  99. 36,
  100. 17,
  101. 9,
  102. 38,
  103. 33,
  104. 1,
  105. 35,
  106. 39,
  107. 4,
  108. 31,
  109. 2]).
  110. bind_deck(2,[34,
  111. 33,
  112. 31,
  113. 53,
  114. 32,
  115. 38,
  116. 43,
  117. 12,
  118. 26,
  119. 36,
  120. 21,
  121. 5,
  122. 17,
  123. 29,
  124. 35,
  125. 37,
  126. 44,
  127. 45,
  128. 41,
  129. 15,
  130. 46,
  131. 52,
  132. 51,
  133. 9,
  134. 50,
  135. 49,
  136. 48,
  137. 47,
  138. 27,
  139. 4,
  140. 16,
  141. 11,
  142. 10,
  143. 25,
  144. 42,
  145. 40,
  146. 0,
  147. 18,
  148. 2,
  149. 3,
  150. 7,
  151. 8,
  152. 19,
  153. 1,
  154. 6,
  155. 14,
  156. 22,
  157. 23,
  158. 30,
  159. 24,
  160. 20,
  161. 28,
  162. 39,
  163. 13]).
  164. bind_deck(3,[6,
  165. 34,
  166. 21,
  167. 17,
  168. 38,
  169. 15,
  170. 1,
  171. 7,
  172. 13,
  173. 10,
  174. 24,
  175. 2,
  176. 9,
  177. 26,
  178. 28,
  179. 35,
  180. 14,
  181. 39,
  182. 43,
  183. 23,
  184. 44,
  185. 45,
  186. 30,
  187. 37,
  188. 4,
  189. 50,
  190. 51,
  191. 0,
  192. 46,
  193. 41,
  194. 20,
  195. 32,
  196. 25,
  197. 19,
  198. 11,
  199. 12,
  200. 22,
  201. 29,
  202. 40,
  203. 42,
  204. 47,
  205. 16,
  206. 5,
  207. 31,
  208. 36,
  209. 3,
  210. 52,
  211. 18,
  212. 8,
  213. 27,
  214. 53,
  215. 49,
  216. 33,
  217. 48]).
  218. bind_deck(4,[53,
  219. 0,
  220. 14,
  221. 15,
  222. 17,
  223. 37,
  224. 51,
  225. 16,
  226. 18,
  227. 32,
  228. 52,
  229. 5,
  230. 23,
  231. 44,
  232. 10,
  233. 24,
  234. 50,
  235. 11,
  236. 28,
  237. 2,
  238. 34,
  239. 38,
  240. 41,
  241. 30,
  242. 9,
  243. 49,
  244. 48,
  245. 6,
  246. 33,
  247. 25,
  248. 47,
  249. 26,
  250. 46,
  251. 45,
  252. 43,
  253. 42,
  254. 3,
  255. 31,
  256. 7,
  257. 29,
  258. 35,
  259. 1,
  260. 20,
  261. 39,
  262. 27,
  263. 4,
  264. 8,
  265. 12,
  266. 13,
  267. 21,
  268. 22,
  269. 19,
  270. 36,
  271. 40]).
  272. bind_deck(5,[38,
  273. 41,
  274. 52,
  275. 0,
  276. 36,
  277. 11,
  278. 19,
  279. 26,
  280. 37,
  281. 12,
  282. 44,
  283. 45,
  284. 5,
  285. 17,
  286. 31,
  287. 49,
  288. 2,
  289. 7,
  290. 21,
  291. 46,
  292. 50,
  293. 10,
  294. 13,
  295. 16,
  296. 6,
  297. 20,
  298. 3,
  299. 27,
  300. 9,
  301. 29,
  302. 1,
  303. 30,
  304. 4,
  305. 22,
  306. 24,
  307. 32,
  308. 14,
  309. 18,
  310. 23,
  311. 25,
  312. 33,
  313. 35,
  314. 39,
  315. 8,
  316. 34,
  317. 43,
  318. 28,
  319. 48,
  320. 47,
  321. 42,
  322. 15,
  323. 51,
  324. 53,
  325. 40]).
  326. bind_deck(6,[3,
  327. 9,
  328. 29,
  329. 32,
  330. 36,
  331. 39,
  332. 40,
  333. 25,
  334. 2,
  335. 17,
  336. 27,
  337. 31,
  338. 7,
  339. 4,
  340. 24,
  341. 23,
  342. 14,
  343. 10,
  344. 13,
  345. 35,
  346. 38,
  347. 11,
  348. 21,
  349. 0,
  350. 15,
  351. 22,
  352. 26,
  353. 12,
  354. 19,
  355. 28,
  356. 41,
  357. 43,
  358. 1,
  359. 30,
  360. 18,
  361. 20,
  362. 33,
  363. 44,
  364. 46,
  365. 48,
  366. 34,
  367. 50,
  368. 47,
  369. 6,
  370. 16,
  371. 37,
  372. 49,
  373. 51,
  374. 52,
  375. 42,
  376. 53,
  377. 5,
  378. 45,
  379. 8]).
  380. bind_deck(7,[9,
  381. 7,
  382. 53,
  383. 52,
  384. 46,
  385. 5,
  386. 4,
  387. 6,
  388. 18,
  389. 16,
  390. 14,
  391. 25,
  392. 35,
  393. 36,
  394. 42,
  395. 43,
  396. 47,
  397. 40,
  398. 31,
  399. 2,
  400. 51,
  401. 38,
  402. 44,
  403. 32,
  404. 23,
  405. 24,
  406. 26,
  407. 13,
  408. 17,
  409. 50,
  410. 49,
  411. 29,
  412. 37,
  413. 48,
  414. 45,
  415. 15,
  416. 27,
  417. 1,
  418. 28,
  419. 8,
  420. 20,
  421. 22,
  422. 12,
  423. 33,
  424. 11,
  425. 10,
  426. 34,
  427. 3,
  428. 39,
  429. 21,
  430. 30,
  431. 19,
  432. 0,
  433. 41]).
  434. bind_deck(8,[31,
  435. 43,
  436. 53,
  437. 52,
  438. 1,
  439. 51,
  440. 50,
  441. 49,
  442. 48,
  443. 25,
  444. 39,
  445. 36,
  446. 47,
  447. 24,
  448. 46,
  449. 45,
  450. 2,
  451. 29,
  452. 20,
  453. 28,
  454. 22,
  455. 12,
  456. 26,
  457. 27,
  458. 40,
  459. 42,
  460. 5,
  461. 8,
  462. 17,
  463. 21,
  464. 38,
  465. 34,
  466. 4,
  467. 10,
  468. 33,
  469. 6,
  470. 18,
  471. 37,
  472. 3,
  473. 44,
  474. 23,
  475. 41,
  476. 13,
  477. 11,
  478. 16,
  479. 19,
  480. 15,
  481. 7,
  482. 30,
  483. 32,
  484. 35,
  485. 0,
  486. 14,
  487. 9]).
  488. bind_deck(9,[53,
  489. 52,
  490. 15,
  491. 26,
  492. 19,
  493. 38,
  494. 2,
  495. 11,
  496. 6,
  497. 0,
  498. 8,
  499. 16,
  500. 18,
  501. 22,
  502. 28,
  503. 5,
  504. 29,
  505. 32,
  506. 1,
  507. 30,
  508. 34,
  509. 35,
  510. 37,
  511. 39,
  512. 36,
  513. 44,
  514. 9,
  515. 21,
  516. 17,
  517. 27,
  518. 42,
  519. 45,
  520. 7,
  521. 10,
  522. 46,
  523. 23,
  524. 43,
  525. 47,
  526. 12,
  527. 4,
  528. 13,
  529. 20,
  530. 25,
  531. 31,
  532. 41,
  533. 24,
  534. 48,
  535. 3,
  536. 49,
  537. 14,
  538. 33,
  539. 40,
  540. 50,
  541. 51]).
  542. bind_deck(10,[9,
  543. 11,
  544. 26,
  545. 53,
  546. 52,
  547. 13,
  548. 28,
  549. 2,
  550. 10,
  551. 30,
  552. 0,
  553. 17,
  554. 22,
  555. 41,
  556. 6,
  557. 4,
  558. 18,
  559. 33,
  560. 34,
  561. 3,
  562. 5,
  563. 37,
  564. 46,
  565. 12,
  566. 15,
  567. 16,
  568. 24,
  569. 25,
  570. 32,
  571. 19,
  572. 39,
  573. 35,
  574. 47,
  575. 1,
  576. 48,
  577. 51,
  578. 36,
  579. 43,
  580. 8,
  581. 50,
  582. 40,
  583. 29,
  584. 44,
  585. 20,
  586. 49,
  587. 27,
  588. 14,
  589. 31,
  590. 7,
  591. 21,
  592. 38,
  593. 42,
  594. 45,
  595. 23]).
  596. bind_deck(11,[9,
  597. 22,
  598. 24,
  599. 32,
  600. 39,
  601. 23,
  602. 21,
  603. 17,
  604. 40,
  605. 47,
  606. 2,
  607. 8,
  608. 53,
  609. 10,
  610. 33,
  611. 28,
  612. 4,
  613. 16,
  614. 13,
  615. 29,
  616. 44,
  617. 51,
  618. 52,
  619. 15,
  620. 26,
  621. 30,
  622. 14,
  623. 50,
  624. 48,
  625. 49,
  626. 3,
  627. 31,
  628. 37,
  629. 46,
  630. 27,
  631. 5,
  632. 1,
  633. 35,
  634. 20,
  635. 0,
  636. 6,
  637. 11,
  638. 12,
  639. 34,
  640. 36,
  641. 7,
  642. 38,
  643. 41,
  644. 45,
  645. 43,
  646. 18,
  647. 25,
  648. 19,
  649. 42]).
  650. bind_deck(12,[53,
  651. 11,
  652. 30,
  653. 26,
  654. 32,
  655. 1,
  656. 8,
  657. 45,
  658. 52,
  659. 29,
  660. 16,
  661. 28,
  662. 15,
  663. 33,
  664. 19,
  665. 34,
  666. 35,
  667. 39,
  668. 42,
  669. 43,
  670. 48,
  671. 21,
  672. 22,
  673. 49,
  674. 12,
  675. 50,
  676. 46,
  677. 6,
  678. 24,
  679. 4,
  680. 51,
  681. 9,
  682. 18,
  683. 13,
  684. 7,
  685. 10,
  686. 31,
  687. 5,
  688. 27,
  689. 20,
  690. 25,
  691. 36,
  692. 40,
  693. 38,
  694. 23,
  695. 0,
  696. 3,
  697. 37,
  698. 41,
  699. 14,
  700. 44,
  701. 17,
  702. 47,
  703. 2]).
  704. bind_deck(13,[53,
  705. 19,
  706. 0,
  707. 9,
  708. 25,
  709. 52,
  710. 2,
  711. 11,
  712. 17,
  713. 13,
  714. 20,
  715. 21,
  716. 37,
  717. 23,
  718. 51,
  719. 50,
  720. 10,
  721. 33,
  722. 45,
  723. 18,
  724. 35,
  725. 46,
  726. 4,
  727. 14,
  728. 27,
  729. 34,
  730. 15,
  731. 12,
  732. 26,
  733. 38,
  734. 42,
  735. 36,
  736. 32,
  737. 47,
  738. 40,
  739. 3,
  740. 6,
  741. 7,
  742. 30,
  743. 44,
  744. 43,
  745. 16,
  746. 22,
  747. 28,
  748. 29,
  749. 8,
  750. 31,
  751. 1,
  752. 5,
  753. 24,
  754. 41,
  755. 39,
  756. 48,
  757. 49]).
  758. bind_deck(14,[53,
  759. 32,
  760. 8,
  761. 24,
  762. 26,
  763. 52,
  764. 51,
  765. 50,
  766. 2,
  767. 49,
  768. 17,
  769. 36,
  770. 39,
  771. 41,
  772. 27,
  773. 16,
  774. 48,
  775. 10,
  776. 12,
  777. 18,
  778. 19,
  779. 23,
  780. 5,
  781. 7,
  782. 14,
  783. 21,
  784. 28,
  785. 42,
  786. 44,
  787. 45,
  788. 46,
  789. 47,
  790. 9,
  791. 0,
  792. 4,
  793. 3,
  794. 6,
  795. 13,
  796. 1,
  797. 15,
  798. 11,
  799. 37,
  800. 38,
  801. 40,
  802. 20,
  803. 43,
  804. 34,
  805. 30,
  806. 29,
  807. 31,
  808. 33,
  809. 22,
  810. 25,
  811. 35]).
  812. bind_deck(15,[4,
  813. 1,
  814. 43,
  815. 53,
  816. 18,
  817. 39,
  818. 9,
  819. 38,
  820. 13,
  821. 32,
  822. 48,
  823. 50,
  824. 19,
  825. 52,
  826. 33,
  827. 46,
  828. 40,
  829. 51,
  830. 49,
  831. 47,
  832. 11,
  833. 21,
  834. 25,
  835. 45,
  836. 44,
  837. 3,
  838. 16,
  839. 0,
  840. 17,
  841. 20,
  842. 27,
  843. 30,
  844. 42,
  845. 2,
  846. 41,
  847. 15,
  848. 6,
  849. 29,
  850. 37,
  851. 35,
  852. 5,
  853. 7,
  854. 28,
  855. 31,
  856. 24,
  857. 36,
  858. 10,
  859. 22,
  860. 26,
  861. 34,
  862. 23,
  863. 14,
  864. 8,
  865. 12]).
  866. bind_deck(16,[53,
  867. 52,
  868. 51,
  869. 50,
  870. 5,
  871. 12,
  872. 49,
  873. 29,
  874. 13,
  875. 43,
  876. 23,
  877. 48,
  878. 6,
  879. 14,
  880. 4,
  881. 10,
  882. 32,
  883. 42,
  884. 0,
  885. 9,
  886. 22,
  887. 31,
  888. 34,
  889. 39,
  890. 27,
  891. 7,
  892. 33,
  893. 16,
  894. 36,
  895. 26,
  896. 41,
  897. 45,
  898. 3,
  899. 2,
  900. 30,
  901. 44,
  902. 1,
  903. 11,
  904. 18,
  905. 21,
  906. 46,
  907. 25,
  908. 20,
  909. 24,
  910. 35,
  911. 28,
  912. 17,
  913. 19,
  914. 38,
  915. 8,
  916. 47,
  917. 40,
  918. 37,
  919. 15]).
  920. bind_deck(17,[53,
  921. 49,
  922. 37,
  923. 52,
  924. 51,
  925. 19,
  926. 2,
  927. 20,
  928. 32,
  929. 39,
  930. 50,
  931. 4,
  932. 9,
  933. 18,
  934. 17,
  935. 48,
  936. 47,
  937. 46,
  938. 45,
  939. 44,
  940. 30,
  941. 11,
  942. 5,
  943. 38,
  944. 43,
  945. 21,
  946. 13,
  947. 15,
  948. 3,
  949. 35,
  950. 36,
  951. 25,
  952. 41,
  953. 6,
  954. 42,
  955. 40,
  956. 34,
  957. 1,
  958. 8,
  959. 7,
  960. 0,
  961. 10,
  962. 12,
  963. 14,
  964. 16,
  965. 23,
  966. 24,
  967. 22,
  968. 27,
  969. 26,
  970. 28,
  971. 29,
  972. 31,
  973. 33]).
  974. bind_deck(18,[15,
  975. 53,
  976. 52,
  977. 40,
  978. 17,
  979. 9,
  980. 0,
  981. 16,
  982. 43,
  983. 50,
  984. 51,
  985. 49,
  986. 11,
  987. 48,
  988. 47,
  989. 46,
  990. 27,
  991. 30,
  992. 28,
  993. 29,
  994. 38,
  995. 3,
  996. 24,
  997. 34,
  998. 32,
  999. 45,
  1000. 44,
  1001. 42,
  1002. 20,
  1003. 37,
  1004. 5,
  1005. 23,
  1006. 2,
  1007. 7,
  1008. 14,
  1009. 10,
  1010. 8,
  1011. 1,
  1012. 4,
  1013. 12,
  1014. 18,
  1015. 19,
  1016. 13,
  1017. 21,
  1018. 6,
  1019. 22,
  1020. 26,
  1021. 31,
  1022. 25,
  1023. 33,
  1024. 35,
  1025. 36,
  1026. 39,
  1027. 41]).
  1028. bind_deck(19,[28,
  1029. 35,
  1030. 40,
  1031. 0,
  1032. 29,
  1033. 30,
  1034. 52,
  1035. 53,
  1036. 51,
  1037. 50,
  1038. 45,
  1039. 1,
  1040. 8,
  1041. 15,
  1042. 17,
  1043. 24,
  1044. 10,
  1045. 14,
  1046. 33,
  1047. 4,
  1048. 36,
  1049. 23,
  1050. 38,
  1051. 11,
  1052. 22,
  1053. 12,
  1054. 27,
  1055. 43,
  1056. 18,
  1057. 32,
  1058. 37,
  1059. 13,
  1060. 26,
  1061. 34,
  1062. 9,
  1063. 2,
  1064. 5,
  1065. 21,
  1066. 25,
  1067. 7,
  1068. 31,
  1069. 41,
  1070. 42,
  1071. 46,
  1072. 6,
  1073. 16,
  1074. 3,
  1075. 19,
  1076. 20,
  1077. 39,
  1078. 44,
  1079. 47,
  1080. 48,
  1081. 49]).
  1082. bind_deck(20,[53,
  1083. 0,
  1084. 16,
  1085. 28,
  1086. 8,
  1087. 10,
  1088. 3,
  1089. 12,
  1090. 15,
  1091. 20,
  1092. 30,
  1093. 14,
  1094. 31,
  1095. 36,
  1096. 26,
  1097. 11,
  1098. 23,
  1099. 7,
  1100. 13,
  1101. 33,
  1102. 39,
  1103. 40,
  1104. 41,
  1105. 45,
  1106. 9,
  1107. 32,
  1108. 38,
  1109. 47,
  1110. 6,
  1111. 19,
  1112. 4,
  1113. 24,
  1114. 27,
  1115. 2,
  1116. 17,
  1117. 29,
  1118. 46,
  1119. 5,
  1120. 48,
  1121. 49,
  1122. 50,
  1123. 37,
  1124. 51,
  1125. 52,
  1126. 42,
  1127. 44,
  1128. 43,
  1129. 22,
  1130. 35,
  1131. 34,
  1132. 25,
  1133. 1,
  1134. 21,
  1135. 18]).
  1136. bind_deck(21,[11,
  1137. 15,
  1138. 6,
  1139. 0,
  1140. 30,
  1141. 7,
  1142. 32,
  1143. 42,
  1144. 22,
  1145. 25,
  1146. 18,
  1147. 29,
  1148. 26,
  1149. 31,
  1150. 33,
  1151. 35,
  1152. 39,
  1153. 45,
  1154. 16,
  1155. 48,
  1156. 37,
  1157. 43,
  1158. 5,
  1159. 46,
  1160. 50,
  1161. 4,
  1162. 9,
  1163. 36,
  1164. 3,
  1165. 8,
  1166. 19,
  1167. 27,
  1168. 10,
  1169. 14,
  1170. 40,
  1171. 47,
  1172. 24,
  1173. 49,
  1174. 51,
  1175. 1,
  1176. 52,
  1177. 2,
  1178. 20,
  1179. 28,
  1180. 23,
  1181. 41,
  1182. 44,
  1183. 12,
  1184. 21,
  1185. 38,
  1186. 53,
  1187. 13,
  1188. 34,
  1189. 17]).
  1190. bind_deck(22,[1,
  1191. 53,
  1192. 18,
  1193. 30,
  1194. 52,
  1195. 51,
  1196. 50,
  1197. 16,
  1198. 0,
  1199. 6,
  1200. 15,
  1201. 31,
  1202. 7,
  1203. 4,
  1204. 10,
  1205. 11,
  1206. 38,
  1207. 41,
  1208. 39,
  1209. 49,
  1210. 3,
  1211. 48,
  1212. 13,
  1213. 34,
  1214. 47,
  1215. 42,
  1216. 36,
  1217. 14,
  1218. 37,
  1219. 46,
  1220. 40,
  1221. 25,
  1222. 23,
  1223. 8,
  1224. 45,
  1225. 44,
  1226. 43,
  1227. 22,
  1228. 20,
  1229. 19,
  1230. 26,
  1231. 28,
  1232. 29,
  1233. 35,
  1234. 33,
  1235. 27,
  1236. 32,
  1237. 24,
  1238. 2,
  1239. 9,
  1240. 12,
  1241. 5,
  1242. 17,
  1243. 21]).
  1244. bind_deck(23,[23,
  1245. 27,
  1246. 39,
  1247. 53,
  1248. 52,
  1249. 8,
  1250. 51,
  1251. 1,
  1252. 5,
  1253. 26,
  1254. 28,
  1255. 34,
  1256. 35,
  1257. 0,
  1258. 10,
  1259. 14,
  1260. 16,
  1261. 30,
  1262. 19,
  1263. 32,
  1264. 37,
  1265. 40,
  1266. 25,
  1267. 29,
  1268. 2,
  1269. 42,
  1270. 13,
  1271. 20,
  1272. 17,
  1273. 22,
  1274. 3,
  1275. 6,
  1276. 11,
  1277. 36,
  1278. 21,
  1279. 15,
  1280. 7,
  1281. 4,
  1282. 24,
  1283. 38,
  1284. 43,
  1285. 46,
  1286. 41,
  1287. 49,
  1288. 9,
  1289. 12,
  1290. 18,
  1291. 31,
  1292. 44,
  1293. 47,
  1294. 45,
  1295. 33,
  1296. 48,
  1297. 50]).
  1298. bind_deck(24,[44,
  1299. 49,
  1300. 53,
  1301. 11,
  1302. 25,
  1303. 28,
  1304. 52,
  1305. 39,
  1306. 50,
  1307. 51,
  1308. 48,
  1309. 6,
  1310. 27,
  1311. 47,
  1312. 20,
  1313. 23,
  1314. 34,
  1315. 46,
  1316. 29,
  1317. 2,
  1318. 3,
  1319. 12,
  1320. 0,
  1321. 5,
  1322. 7,
  1323. 13,
  1324. 17,
  1325. 9,
  1326. 22,
  1327. 1,
  1328. 30,
  1329. 8,
  1330. 31,
  1331. 35,
  1332. 4,
  1333. 21,
  1334. 36,
  1335. 18,
  1336. 37,
  1337. 24,
  1338. 15,
  1339. 38,
  1340. 40,
  1341. 10,
  1342. 41,
  1343. 19,
  1344. 14,
  1345. 26,
  1346. 42,
  1347. 32,
  1348. 43,
  1349. 45,
  1350. 33,
  1351. 16]).
  1352. bind_deck(25,[3,
  1353. 7,
  1354. 9,
  1355. 23,
  1356. 16,
  1357. 33,
  1358. 42,
  1359. 32,
  1360. 35,
  1361. 28,
  1362. 27,
  1363. 31,
  1364. 34,
  1365. 36,
  1366. 46,
  1367. 4,
  1368. 1,
  1369. 49,
  1370. 50,
  1371. 14,
  1372. 19,
  1373. 29,
  1374. 8,
  1375. 39,
  1376. 43,
  1377. 52,
  1378. 2,
  1379. 44,
  1380. 53,
  1381. 51,
  1382. 5,
  1383. 30,
  1384. 22,
  1385. 47,
  1386. 48,
  1387. 0,
  1388. 45,
  1389. 41,
  1390. 40,
  1391. 38,
  1392. 10,
  1393. 17,
  1394. 18,
  1395. 20,
  1396. 21,
  1397. 25,
  1398. 24,
  1399. 13,
  1400. 26,
  1401. 12,
  1402. 37,
  1403. 11,
  1404. 6,
  1405. 15]).
  1406. bind_deck(26,[2,
  1407. 26,
  1408. 22,
  1409. 3,
  1410. 43,
  1411. 53,
  1412. 8,
  1413. 0,
  1414. 34,
  1415. 38,
  1416. 52,
  1417. 49,
  1418. 11,
  1419. 24,
  1420. 45,
  1421. 10,
  1422. 51,
  1423. 13,
  1424. 30,
  1425. 20,
  1426. 44,
  1427. 7,
  1428. 48,
  1429. 50,
  1430. 47,
  1431. 21,
  1432. 46,
  1433. 9,
  1434. 42,
  1435. 23,
  1436. 41,
  1437. 40,
  1438. 25,
  1439. 28,
  1440. 27,
  1441. 35,
  1442. 14,
  1443. 5,
  1444. 15,
  1445. 17,
  1446. 4,
  1447. 18,
  1448. 19,
  1449. 16,
  1450. 29,
  1451. 12,
  1452. 32,
  1453. 37,
  1454. 1,
  1455. 6,
  1456. 31,
  1457. 33,
  1458. 36,
  1459. 39]).
  1460. bind_deck(27,[53,
  1461. 17,
  1462. 51,
  1463. 50,
  1464. 52,
  1465. 49,
  1466. 33,
  1467. 34,
  1468. 31,
  1469. 12,
  1470. 1,
  1471. 20,
  1472. 28,
  1473. 5,
  1474. 32,
  1475. 35,
  1476. 10,
  1477. 11,
  1478. 2,
  1479. 27,
  1480. 29,
  1481. 9,
  1482. 36,
  1483. 0,
  1484. 25,
  1485. 30,
  1486. 40,
  1487. 18,
  1488. 41,
  1489. 42,
  1490. 43,
  1491. 26,
  1492. 19,
  1493. 48,
  1494. 23,
  1495. 15,
  1496. 13,
  1497. 16,
  1498. 22,
  1499. 39,
  1500. 3,
  1501. 45,
  1502. 46,
  1503. 8,
  1504. 24,
  1505. 4,
  1506. 38,
  1507. 44,
  1508. 47,
  1509. 37,
  1510. 21,
  1511. 14,
  1512. 6,
  1513. 7]).
  1514. bind_deck(28,[15,
  1515. 19,
  1516. 20,
  1517. 30,
  1518. 27,
  1519. 7,
  1520. 31,
  1521. 6,
  1522. 13,
  1523. 34,
  1524. 42,
  1525. 16,
  1526. 5,
  1527. 28,
  1528. 43,
  1529. 40,
  1530. 44,
  1531. 45,
  1532. 46,
  1533. 49,
  1534. 11,
  1535. 33,
  1536. 47,
  1537. 51,
  1538. 26,
  1539. 3,
  1540. 10,
  1541. 32,
  1542. 38,
  1543. 41,
  1544. 52,
  1545. 53,
  1546. 50,
  1547. 48,
  1548. 9,
  1549. 12,
  1550. 17,
  1551. 0,
  1552. 8,
  1553. 21,
  1554. 23,
  1555. 1,
  1556. 29,
  1557. 35,
  1558. 2,
  1559. 36,
  1560. 14,
  1561. 4,
  1562. 39,
  1563. 22,
  1564. 25,
  1565. 24,
  1566. 18,
  1567. 37]).
  1568. bind_deck(29,[16,
  1569. 22,
  1570. 23,
  1571. 30,
  1572. 33,
  1573. 53,
  1574. 24,
  1575. 12,
  1576. 28,
  1577. 19,
  1578. 18,
  1579. 35,
  1580. 44,
  1581. 7,
  1582. 52,
  1583. 51,
  1584. 50,
  1585. 38,
  1586. 39,
  1587. 29,
  1588. 40,
  1589. 3,
  1590. 36,
  1591. 21,
  1592. 15,
  1593. 45,
  1594. 2,
  1595. 4,
  1596. 25,
  1597. 37,
  1598. 42,
  1599. 17,
  1600. 49,
  1601. 5,
  1602. 11,
  1603. 1,
  1604. 8,
  1605. 48,
  1606. 47,
  1607. 0,
  1608. 6,
  1609. 10,
  1610. 20,
  1611. 27,
  1612. 31,
  1613. 41,
  1614. 9,
  1615. 43,
  1616. 14,
  1617. 34,
  1618. 13,
  1619. 26,
  1620. 32,
  1621. 46]).
  1622.  
  1623. %/* not definition required RS6000 prolog */
  1624. %/*not(P) :- call(P), !, fail.
  1625. %not(P). */
  1626. %/* member and append predicates from the Art of Prolog. */ 
  1627. member_djd(X,[X|Xs]).
  1628. member_djd(X,[Y|Ys]) :- [X]=Ys.
  1629. member_djd(X,[X]).
  1630. member_djd(X,[Y|Ys]) :- X :\== Y,!, member_djd(X,Ys).
  1631. append_djd([],Ys,Ys).
  1632. append_djd([X|Xs],Ys,[X|Zs]) :- append_djd(Xs,Ys,Zs).
  1633. length_djd([X|Xs],N1)  :- length_djd(Xs,N), (N = N1 - 1).
  1634. length_djd([],0).
  1635. %/* predicate eq defined for use with not above */
  1636. %eq(A,B) :- A :== B.
  1637. %/**********************************************************************/
  1638. %/* deck representation follows                                        */
  1639. %/* for each suite these is a predicate which is true of cards of that */
  1640. %/* suite represented as a list of data for that card. The data is : */
  1641. %/* [card number(as represented in deck and other lists of cards ,   */
  1642. %/* sequence value in this suite,                                    */
  1643. %/* suite,                            */                                */
  1644. %/* name of card,                           */                            */
  1645. %/* points for taking this card,                                     */
  1646. %/* points for playing this card]                                     */
  1647. %/*******************************************************************/
  1648.  
  1649. heart([0,2,hearts,c_2_of_hearts,0,1]).
  1650. heart([1,3,hearts,c_3_of_hearts,0,0]).
  1651. heart([2,4,hearts,c_4_of_hearts,0,0]).
  1652. heart([3,5,hearts,c_5_of_hearts,0,0]).
  1653. heart([4,6,hearts,c_6_of_hearts,0,0]).
  1654. heart([5,7,hearts,c_7_of_hearts,0,0]).
  1655. heart([6,8,hearts,c_8_of_hearts,0,0]).
  1656. heart([7,9,hearts,c_9_of_hearts,0,0]).
  1657. heart([8,10,hearts,c_10_of_hearts,1,0]).
  1658. heart([52,11,hearts,low_joker,1,0]).
  1659. heart([53,12,hearts,high_joker,1,0]).
  1660. heart([22,13,hearts,j_of_diamonds,1,0]).
  1661. heart([9,14,hearts,j_of_hearts,1,0]).
  1662. heart([10,15,hearts,q_of_hearts,0,0]).
  1663. heart([11,16,hearts,k_of_hearts,0,0]).
  1664. heart([12,17,hearts,a_of_hearts,0,1]).
  1665. heart([12,17,hearts,a_of_hearts,0,1]).
  1666. diamond([13,2,diamonds,c_2_of_diamonds,0,1]).
  1667. diamond([14,3,diamonds,c_3_of_diamonds,0,0]).
  1668. diamond([15,4,diamonds,c_4_of_diamonds,0,0]).
  1669. diamond([16,5,diamonds,c_5_of_diamonds,0,0]).
  1670. diamond([17,6,diamonds,c_6_of_diamonds,0,0]).
  1671. diamond([18,7,diamonds,c_7_of_diamonds,0,0]).
  1672. diamond([19,8,diamonds,c_8_of_diamonds,0,0]).
  1673. diamond([20,9,diamonds,c_9_of_diamonds,0,0]).
  1674. diamond([21,10,diamonds,c_10_of_diamonds,1,0]).
  1675. diamond([52,11,diamonds,low_joker,1,0]).
  1676. diamond([53,12,diamonds,high_joker,1,0]).
  1677. diamond([9,13,diamonds,j_of_hearts,1,0]).
  1678. diamond([22,14,diamonds,j_of_diamonds,1,0]).
  1679. diamond([23,15,diamonds,q_of_diamonds,0,0]).
  1680. diamond([24,16,diamonds,k_of_diamonds,0,0]).
  1681. diamond([25,17,diamonds,a_of_diamonds,0,1]).
  1682. diamond([25,17,diamonds,a_of_diamonds,0,1]).
  1683. spade([26,2,spades,c_2_of_spades,0,1]).
  1684. spade([27,3,spades,c_3_of_spades,0,0]).
  1685. spade([28,4,spades,c_4_of_spades,0,0]).
  1686. spade([29,5,spades,c_5_of_spades,0,0]).
  1687. spade([30,6,spades,c_6_of_spades,0,0]).
  1688. spade([31,7,spades,c_7_of_spades,0,0]).
  1689. spade([32,8,spades,c_8_of_spades,0,0]).
  1690. spade([33,9,spades,c_9_of_spades,0,0]).
  1691. spade([34,10,spades,c_10_of_spades,1,0]).
  1692. spade([52,11,spades,low_joker,1,0]).
  1693. spade([53,12,spades,high_joker,1,0]).
  1694. spade([48,13,spades,j_of_clubs,1,0]).
  1695. spade([35,14,spades,j_of_spades,1,0]).
  1696. spade([36,15,spades,q_of_spades,0,0]).
  1697. spade([37,16,spades,k_of_spades,0,0]).
  1698. spade([38,17,spades,a_of_spades,0,1]).
  1699. spade([38,17,spades,a_of_spades,0,1]).
  1700. club([39,2,clubs,c_2_of_clubs,0,1]).
  1701. club([40,3,clubs,c_3_of_clubs,0,0]).
  1702. club([41,4,clubs,c_4_of_clubs,0,0]).
  1703. club([42,5,clubs,c_5_of_clubs,0,0]).
  1704. club([43,6,clubs,c_6_of_clubs,0,0]).
  1705. club([44,7,clubs,c_7_of_clubs,0,0]).
  1706. club([45,8,clubs,c_8_of_clubs,0,0]).
  1707. club([46,9,clubs,c_9_of_clubs,0,0]).
  1708. club([47,10,clubs,c_10_of_clubs,1,0]).
  1709. club([52,11,clubs,low_joker,1,0]).
  1710. club([53,12,clubs,high_joker,1,0]).
  1711. club([35,13,clubs,j_of_spades,1,0]).
  1712. club([48,14,clubs,j_of_clubs,1,0]).
  1713. club([49,15,clubs,q_of_clubs,0,0]).
  1714. club([50,16,clubs,k_of_clubs,0,0]).
  1715. club([51,17,clubs,a_of_clubs,0,1]).
  1716. club([51,17,clubs,a_of_clubs,0,1]).
  1717. valid_bid(Val) :- 2 =< Val , Val =< 7.
  1718. valid_bid(Val) :- Val = pass.
  1719. valid_suite(hearts).
  1720. valid_suite(diamonds).
  1721. valid_suite(spades).
  1722. valid_suite(clubs).
  1723. %/* the card predicate combines infomation of all suits */
  1724.  
  1725. card([Noy,Valy,Suitey,Namey,Pt_takeny,Pt_playedy]) :- 
  1726.         heart([Noy,Valy,Suitey,Namey,Pt_takeny,Pt_playedy]).
  1727. card([Noy,Valy,Suitey,Namey,Pt_takeny,Pt_playedy]) :- 
  1728.         diamond([Noy,Valy,Suitey,Namey,Pt_takeny,Pt_playedy]).
  1729. card([Noy,Valy,Suitey,Namey,Pt_takeny,Pt_playedy]) :- 
  1730.         spade([Noy,Valy,Suitey,Namey,Pt_takeny,Pt_playedy]).
  1731. card([Noy,Valy,Suitey,Namey,Pt_takeny,Pt_playedy]) :- 
  1732.         club([Noy,Valy,Suitey,Namey,Pt_takeny,Pt_playedy]).
  1733. valid_card(Namex,Suitex,Hx) :-        
  1734. write_nl([Nox,Valx,Suitex,Namex,Pt_takenx,Pt_playedx]),
  1735.        card([Nox,Valx,Suitex,Namex,Pt_takenx,Pt_playedx]),
  1736. write_nl(cd),
  1737. write_nl(Namex),
  1738. write_nl(No),
  1739. write_nl(Hx),
  1740.        member_djd(Nox,Hx).
  1741. %/* some predicates follow which are used for initialization */
  1742.  
  1743. bind_teams([[dennis,dick],[sussy,john]]).
  1744. bind_players([dennis,sussy,dick,john]).
  1745. succ_player(dennis,sussy).
  1746. succ_player(sussy,dick).
  1747. succ_player(dick,john).
  1748. succ_player(john,dennis).
  1749. partner(dennis,dick).
  1750. partner(dick,dennis).
  1751. partner(sussy,john).
  1752. partner(john,sussy).
  1753. bind_dealer(dennis).
  1754. bind_played([[],[],[],[]]).
  1755. bind_taken([[],[],[],[]]).
  1756. bind_score([0,0]).
  1757. %/*******************************************************************/
  1758. %/* The main predicate for invoking a game of pitch follows        */
  1759. %/* to invoke a game the query - play_game(R,S). - may be used.     */
  1760. %/******************************************************************/
  1761.  
  1762. play_game(Teams,Scores) :- bind_teams(Teams),
  1763.         bind_players(Players),
  1764.         asserta(is_out(dummy)),
  1765.         bind_score(Scores),bind_dealer(Dealer),
  1766.         play_hand(Players,Teams,Scores,Dealer,Deck,0).
  1767. play_hand(Players,Teams,Scores,Dealer,Deck,Cnt) :- done(Teams,Scores).
  1768. play_hand(Players,Teams,Scores,Dealer,Deck,Cnt) :-
  1769.  
  1770.         bind_played(Played),
  1771.         bind_taken(Taken),
  1772.         bind_deck(Cnt,Deck),
  1773.         deal(Players,Deck,Newdeckx,Hands,Dealer),
  1774.         bid_lf(Players,Hands,Dealer,Bidder,Bid,Suite),
  1775.         write_bl(bid_is),
  1776.         write_bl(Bidder),
  1777.         write_bl(Bid),
  1778.         write_nl(Suite),
  1779.         discard(Players,Hands,Hands2,Suite),
  1780.         deal2(Players,Newdeckx,Hands2,Hands3,Dealer,Bidder),
  1781.         discard(Players,Hands3,Hands4,Suite),
  1782.                 retract(is_out),
  1783.                 write_nl(before_play_cards), 
  1784.         play_cards(Players,Hands4,Played,Taken,
  1785.                 Bidder,Suite,
  1786.                 Newplayed,Newtaken,Npret,Ntret),
  1787.         score(Players,Teams,Npret,Ntret,Scores,Newscores,Bidder,Bid,Suite), 
  1788.         succ_player(Dealer,Newdealer),
  1789.         (Cnt2 -> Cnt + 1), % was is changed to = for life
  1790.         play_hand(Players,Teams,Newscores,Newdealer,Newdeck,Cnt2).
  1791. %/* game is over when score reaches 21 */
  1792. done(Teams,[S1,S2]) :- S1 >= 21.
  1793. done(Teams,[S1,S2]) :- S2 >= 21. 
  1794. %/* deal cards 1st round.  Each player gets 9 cards */
  1795. deal(Players,Deck,Newdeckx,Hands,Dealer) :- write_nl(p_deal),
  1796.         Deck = [C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14,C15,
  1797.         C16,C17,C18,C19,C20,C21,C22,C23,C24,C25,C26,C27,C28,C29,C30,
  1798.         C31,C32,C33,C34,C35,C36,C37,C38,C39,C40,C41,C42,C43,C44,C45,
  1799.         C46,C47,C48,C49,C50,C51,C52,C53,C54],
  1800.         !,
  1801.         
  1802.         Newdeckx = [C37,C38,C39,C40,C41,C42,C43,C44,
  1803.         C45,C46,C47,C48,C49,C50,C51,C52,C53,C54],!,
  1804.         
  1805.         Hands = [[C1,C2,C3,C13,C14,C15,C25,C26,C27],
  1806.         [C4,C5,C6,C16,C17,C18,C28,C29,C30],
  1807.         [C7,C8,C9,C19,C20,C21,C31,C32,C33],
  1808.         [C10,C11,C12,C22,C23,C24,C34,C35,C36]],!,
  1809.         write_nl(Hands).
  1810. %/* rules foer what a player can bid follow */
  1811. %/*
  1812. %can_bid(4,Hand,Suite1,Bidder) :- 
  1813. %        member_djd(No1,Hand),
  1814. %        member_djd(No2,Hand),
  1815. %        card([No1,2,Suite1,Name1,Pt_taken1,Pt_played1]),
  1816. %        card([No2,17,Suite2,Name2,Pt_taken2,Pt_played2]),
  1817. %        Suite1 = Suite2.
  1818. %can_bid(3,Hand,Suite,Bidder) :- 
  1819. %        member_djd(No1,Hand),
  1820. %        card([No1,17,Suite,Name1,Pt_taken1,Pt_played1]).
  1821. %can_bid(2,Hand,Suite1,Bidder) :- 
  1822. %        member_djd(No1,Hand),
  1823. %        member_djd(No2,Hand),
  1824. %        card([No1,2,Suite1,Name1,Pt_taken1,Pt_played1]),
  1825. %        card([No2,Val2,Suite2,Name2,Pt_taken2,Pt_played2]),
  1826. %        Val2 >= 10,
  1827. %        Suite1 = Suite2.
  1828. %can_bid(0,Hand,pass,Bidder).
  1829. %*/
  1830. %/* the bidding process is described below */
  1831. bid_lf(Players,Hands,Dealer,Bidder,Bid,Suite) :- write_nl(p_bid),
  1832.         succ_player(Dealer,Bidder1),!,
  1833.         get_hand(Players,Hands,Bidder1,Hand1),!,
  1834.         trybid(Bidder1,Hand1,0,pass,pass,Maxbidder1,Maxbid1,Maxsuite1),!,
  1835.         succ_player(Bidder1,Bidder2),!,
  1836.         get_hand(Players,Hands,Bidder2,Hand2),!,
  1837.         trybid(Bidder2,Hand2,Maxbid1,Maxbidder1,Maxsuite1,
  1838.                 Maxbidder2,Maxbid2,Maxsuite2),!,
  1839.         succ_player(Bidder2,Bidder3),!,
  1840.         get_hand(Players,Hands,Bidder3,Hand3),!,
  1841.         trybid(Bidder3,Hand3,Maxbid2,Maxbidder2,Maxsuite2,
  1842.                 Maxbidder3,Maxbid3,Maxsuite3),!,
  1843.         succ_player(Bidder3,Bidder4),!,
  1844.         get_hand(Players,Hands,Bidder4,Hand4),!,
  1845.         trybid(Bidder4,Hand4,Maxbid3,Maxbidder3,Maxsuite3,
  1846.                 Bidder5,Bid5,Suite5),!,
  1847.         no_bid(Dealer,Bidder5,Bid5,Suite5,Bidder,Bid,Suite).
  1848. no_bid(Dealer,Bidder5,Bid5,Suite5,Bidder,Bid,Suite) :-
  1849.      Bid5 = 0,
  1850.      Bidder = Dealer,
  1851.      Bid = 2,
  1852.      Suite = spades.
  1853. no_bid(Dealer,Bidder5,Bid5,Suite5,Bidder,Bid,Suite) :-
  1854.      \+ (Bid5 = 0),
  1855.      Bidder = Bidder5,
  1856.      Bid = Bid5,
  1857.      Suite = Suite5.
  1858.      
  1859. %/* get hand provodes a list of cards associated with a player */
  1860. get_hand(Players,Hands,P1,H1) :-
  1861.         Players = [P1,P2,P3,P4],
  1862.         Hands = [H1,H2,H3,H4].
  1863. get_hand(Players,Hands,P2,H2) :-
  1864.         Players = [P1,P2,P3,P4],
  1865.         Hands = [H1,H2,H3,H4].
  1866. get_hand(Players,Hands,P3,H3) :-
  1867.         Players = [P1,P2,P3,P4],
  1868.         Hands = [H1,H2,H3,H4].
  1869. get_hand(Players,Hands,P4,H4) :-
  1870.         Players = [P1,P2,P3,P4],
  1871.         Hands = [H1,H2,H3,H4].
  1872. %/* put_hand updates a list of cards associated with a player */
  1873. put_hand(Players,Hands,P1,Hand,Newhands) :-
  1874.         Players = [P1,P2,P3,P4],
  1875.         Hands = [H1,H2,H3,H4],
  1876.         Newhands = [Hand,H2,H3,H4].
  1877. put_hand(Players,Hands,P2,Hand,Newhands) :-
  1878.         Players = [P1,P2,P3,P4],
  1879.         Hands = [H1,H2,H3,H4],
  1880.         Newhands = [H1,Hand,H3,H4].
  1881. put_hand(Players,Hands,P3,Hand,Newhands) :-
  1882.         Players = [P1,P2,P3,P4],
  1883.         Hands = [H1,H2,H3,H4],
  1884.         Newhands = [H1,H2,Hand,H4].
  1885. put_hand(Players,Hands,P4,Hand,Newhands) :-
  1886.         Players = [P1,P2,P3,P4],
  1887.         Hands = [H1,H2,H3,H4],
  1888.         Newhands = [H1,H2,H3,Hand].
  1889. %/* current player can bid higher than high bid so far */
  1890. trybid(Bidder2,Hand2,Maxbid1,Maxbidder1,Maxsuite1,
  1891.         Maxbidder2,Maxbid2,Maxsuite2) :-
  1892.         dennis :\==Bidder2,
  1893.         max_bid(Bidval,Hand2,Suite,Bidder2),
  1894.         Bidval > Maxbid1, 
  1895.         write_bl(Bidder2),
  1896.         write_bl(bids),
  1897.         write_nl(Bidval),
  1898.         Maxbidder2 = Bidder2,
  1899.         Maxbid2 = Bidval,
  1900.         Maxsuite2 = Suite.
  1901. %/* current player can not bid higher than high bid so far */
  1902. trybid(Bidder2,Hand2,Maxbid1,Maxbidder1,Maxsuite1,
  1903.         Maxbidder2,Maxbid2,Maxsuite2) :-
  1904.         dennis :\== Bidder2,
  1905.         max_bid(Bidval,Hand2,Suite,Bidder2),
  1906.         Bidval =< Maxbid1,
  1907.         Maxbidder2 = Maxbidder1,
  1908.         Maxbid2 = Maxbid1,
  1909.         Maxsuite2 = Maxsuite1.
  1910. %/* rule repeated 3 times for 3 chances for valid answer */
  1911. trybid(dennis,Hand2,Maxbid1,Maxbidder1,Maxsuite1,
  1912.         Maxbidder2,Maxbid2,Maxsuite2) :-
  1913.         display_hand(Hand2),
  1914.         write_bl(enter),
  1915.         write_bl(bid),
  1916.         write_nl(value),
  1917.         read(Bidval),
  1918.         valid_bid(Bidval),
  1919.         write_bl(enter),
  1920.         write_bl(bid),
  1921.         write_nl(suite),
  1922.         read(Suite),
  1923.         valid_suite(Suite),!,
  1924.         trybid_b(dennis,Hand2,Maxbid1,Maxbidder1,Maxsuite1,
  1925.         Maxbidder2,Maxbid2,Maxsuite2,Bidval,Suite).
  1926. trybid(dennis,Hand2,Maxbid1,Maxbidder1,Maxsuite1,
  1927.         Maxbidder2,Maxbid2,Maxsuite2) :-
  1928.         display_hand(Hand2),
  1929.         write_bl(enter),
  1930.         write_bl(bid),
  1931.         write_nl(value),
  1932.         read(Bidval),
  1933.         valid_bid(Bidval),
  1934.         write_bl(enter),
  1935.         write_bl(bid),
  1936.         write_nl(suite),
  1937.         read(Suite),
  1938.         valid_suite(Suite),!,
  1939.         trybid_b(dennis,Hand2,Maxbid1,Maxbidder1,Maxsuite1,
  1940.         Maxbidder2,Maxbid2,Maxsuite2,Bidval,Suite).
  1941. trybid(dennis,Hand2,Maxbid1,Maxbidder1,Maxsuite1,
  1942.         Maxbidder2,Maxbid2,Maxsuite2) :-
  1943.         display_hand(Hand2),
  1944.         write_bl(enter),
  1945.         write_bl(bid),
  1946.         write_nl(value),
  1947.         read(Bidval),
  1948.         valid_bid(Bidval),
  1949.         write_bl(enter),
  1950.         write_bl(bid),
  1951.         write_nl(suite),
  1952.         read(Suite),
  1953.         valid_suite(Suite),!,
  1954.         trybid_b(dennis,Hand2,Maxbid1,Maxbidder1,Maxsuite1,
  1955.         Maxbidder2,Maxbid2,Maxsuite2,Bidval,Suite).
  1956. trybid_b(dennis,Hand2,Maxbid1,Maxbidder1,Maxsuite1,
  1957.         Maxbidder2,Maxbid2,Maxsuite2,Bidval,Suite) :-
  1958.         Bidval > Maxbid1, 
  1959.         write_bl(Bidder2),
  1960.         write_bl(bids),
  1961.         write_nl(Bidval),
  1962.         Maxbidder2 = dennis,
  1963.         Maxbid2 = Bidval,
  1964.         Maxsuite2 = Suite.
  1965. trybid_b(dennis,Hand2,Maxbid1,Maxbidder1,Maxsuite1,
  1966.         Maxbidder2,Maxbid2,Maxsuite2,Bidval,Suite) :-
  1967.         Bidval = pass,
  1968.         Maxbidder2 = Maxbidder1,
  1969.         Maxbid2 = Maxbid1,
  1970.         Maxsuite2 = Maxsuite1.
  1971.  
  1972. %/* max bid appear in order lowest to highest */
  1973.  
  1974.  
  1975. max_bid(7,Hand,Suite,Bidder) :- can_bid(7,Hand,Suite,Bidder),!.
  1976. max_bid(6,Hand,Suite,Bidder) :- can_bid(6,Hand,Suite,Bidder),!.
  1977. max_bid(5,Hand,Suite,Bidder) :- can_bid(5,Hand,Suite,Bidder),!.
  1978. max_bid(4,Hand,Suite,Bidder) :- can_bid(4,Hand,Suite,Bidder),!.
  1979. max_bid(3,Hand,Suite,Bidder) :- can_bid(3,Hand,Suite,Bidder),!.
  1980. max_bid(2,Hand,Suite,Bidder) :- can_bid(2,Hand,Suite,Bidder),!.
  1981. max_bid(0,Hand,Suite,Bidder) :- can_bid(0,Hand,Suite,Bidder),!.
  1982.  
  1983. %/* delete item (card) from list of items (cards) */
  1984. delete(Item,List,Newlist) :-
  1985.         discard_item(Item,List,Nl,[],Newlist).
  1986.                  
  1987.                  
  1988. discard_item(Item,List,Nl,Partl,Newlist) :-
  1989.         List = [Item | Nl],
  1990.         Partl2 = Partl,
  1991.         discard_item(Item,Nl,Nl2,Partl2,Newlist).
  1992. discard_item(Item,List,Nl,Partl,Newlist) :-
  1993.         List = [Item],
  1994.         Partl2 = Partl,
  1995.         discard_item(Item,[],Nl2,Partl2,Newlist).
  1996.  
  1997. discard_item(Item,List,Nl,Partl,Newlist) :-
  1998.         List = [I | Nl],
  1999.         I :\== Item, 
  2000.         Partl2 = [I | Partl],
  2001.         discard_item(Item,Nl,Nl2,Partl2,Newlist).
  2002. discard_item(Item,List,Nl,Partl,Newlist) :-
  2003.         List = [I],
  2004.         I :\== Item,
  2005.         Partl2 = [I,Part],
  2006.         discard_item(Item,[],Nl2,Partl2,Newlist).
  2007.  
  2008. discard_item(Item,List,Nl,Partl,Newlist) :-
  2009.         List = [],!,
  2010.         Newlist = Partl.
  2011. %/* once suite is determined by high bidder players must discard cards
  2012. %not of that suite (except left jack & jokers) & also not retain more 
  2013. %than 6 cards*/
  2014. discard(Players,Hands,Hands2,Suite) :- write_nl(p_discard),
  2015.         Hands = [H1,H2,H3,H4],!,
  2016.         discard_non_suite(H1,Nh1,[],Hand1,Suite),!,
  2017.         discard_non_suite(H2,Nh2,[],Hand2,Suite),!,
  2018.         discard_non_suite(H3,Nh3,[],Hand3,Suite),!,
  2019.         discard_non_suite(H4,Nh4,[],Hand4,Suite),!,
  2020.         discard_excess(Hand1,Newhand1,Suite),!,
  2021.         discard_excess(Hand2,Newhand2,Suite),!,
  2022.         discard_excess(Hand3,Newhand3,Suite),!,
  2023.         discard_excess(Hand4,Newhand4,Suite),!,
  2024.         Hands2 = [Newhand1,Newhand2,Newhand3,Newhand4],!,
  2025.         write_nl(Hands2).
  2026. discard_non_suite(H,Nh,Parthand,Hand,Suite) :-
  2027.         H = [No | Nh],
  2028.         card([No,Val,Suite2,Name,Pt_taken,Pt_played]),
  2029.         Suite = Suite2,
  2030.         append_djd(Parthand , [No] ,Parthand2),
  2031.         discard_non_suite(Nh,Nh2,Parthand2,Hand,Suite).
  2032. discard_non_suite(H,Nh,Parthand,Hand,Suite) :-
  2033.         H = [No | Nh],
  2034.         \+(card([No,Val,Suite,Name,Pt_taken,Pt_played])),
  2035.         discard_non_suite(Nh,Nh2,Parthand,Hand,Suite).
  2036. discard_non_suite([],Nh,Parthand,Hand,Suite) :-
  2037.         Hand = Parthand.
  2038. discard_non_suite(H,Nh,Parthand,Hand,Suite) :-
  2039.         Hand = [].
  2040. discard_excess(Hand,Newhand,Suite) :-
  2041.         length_djd(Hand,Len),
  2042.         Len =< 6, 
  2043.         Newhand = Hand.
  2044. discard_excess(Hand,Newhand,Suite) :-
  2045.         length_djd(Hand,Len),
  2046.         Len > 6,
  2047.         card([No,Val,Suite,Name,Pt_taken,Pt_played]),
  2048.         member_djd(No,Hand),
  2049.         2 < Val,
  2050.         10 > Val,
  2051.         delete(No,Hand,Newhand2),
  2052.         discard_excess(Newhand2,Newhand,Suite).
  2053. discard_excess(Hand,Newhand,Suite) :-
  2054.         length_djd(Hand,Len),
  2055.         Len > 6,
  2056.         card([No,Val,Suite,Name,Pt_taken,Pt_played]),
  2057.         member_djd(No,Hand),
  2058.         15 = Val,
  2059.         delete(No,Hand,Newhand2),
  2060.         discard_excess(Newhand2,Newhand,Suite).
  2061. discard_excess(Hand,Newhand,Suite) :-
  2062.         length_djd(Hand,Len),
  2063.         Len > 6,
  2064.         card([No,Val,Suite,Name,Pt_taken,Pt_played]),
  2065.         member_djd(No,Hand),
  2066.         16 = Val,
  2067.         delete(No,Hand,Newhand2),
  2068.         discard_excess(Newhand2,Newhand,Suite).
  2069. discard_excess(Hand,Newhand,Suite) :-
  2070.         length_djd(Hand,Len),
  2071.         Len > 6,
  2072.         card([No,Val,Suite,Name,Pt_taken,Pt_played]),
  2073.         member_djd(No,Hand),
  2074.         2 = Val,
  2075.         delete(No,Hand,Newhand2),
  2076.         discard_excess(Newhand2,Newhand,Suite).
  2077.         
  2078. %/* after discarding players (other than the bidder) receive enough
  2079. %cards th raise their total cards to 6.  The bidder gets to look through
  2080. %whatever is then left */
  2081.  
  2082. deal2(Players,Newdeck,Hands2,Hands3,Dealer,Bidder) :- 
  2083.         write_nl(p_deal2),
  2084.         succ_player(Dealer,P1),
  2085.         extras(Players,Newdeck,Newdeck2,Hands2,Hands2a,P1,Bidder),
  2086.         succ_player(P1,P2),
  2087.         extras(Players,Newdeck2,Newdeck3,Hands2a,Hands2b,P2,Bidder),
  2088.         succ_player(P2,P3),
  2089.         extras(Players,Newdeck3,Newdeck4,Hands2b,Hands2c,P3,Bidder),
  2090.         succ_player(P3,P4),
  2091.         extras(Players,Newdeck4,Newdeck5,Hands2c,Hands2d,P4,Bidder),
  2092.         remaining(Players,Newdeck5,Hands2d,Hands3,Bidder),
  2093.         write_nl(final_hands),!,
  2094.         write_nl(Hands3).
  2095.         
  2096. extras(Players,Newdeck,Newdeck2,Hands2,Hands2a,P1,Bidder) :-
  2097.         P1 = Bidder, ! ,
  2098.         Newdeck2 = Newdeck,
  2099.         Hands2a = Hands2.
  2100. extras(Players,Newdeck,Newdeck2,Hands2,Hands2a,P1,Bidder) :-
  2101.         Newdeck = [], ! ,
  2102.         Newdeck2 = Newdeck,
  2103.         Hands2a = Hands2.
  2104. extras(Players,Newdeck,Newdeck2,Hands2,Hands2a,P1,Bidder) :-
  2105.         get_hand(Players,Hands2,P1,H1),
  2106.         length_djd(H1,Len),
  2107.         Len = 6, ! ,
  2108.         Newdeck2 = Newdeck,
  2109.         Hands2a = Hands2.
  2110. extras(Players,Newdeck,Newdeck2,Hands2,Hands2a,P1,Bidder) :-
  2111.         get_hand(Players,Hands2,P1,H1),
  2112.         length_djd(H1,Len),
  2113.         Len < 6,
  2114.         Newdeck = [No | Newdeck3],
  2115.         H1a = [No | H1],
  2116.         put_hand(Players,Hands2,P1,H1a,Hands3),
  2117.         extras(Players,Newdeck3,Newdeck2,Hands3,Hands2a,P1,Bidder).
  2118.         
  2119.         
  2120. remaining(Players,Newdeck5,Hands2d,Hands3,Bidder) :-
  2121.         get_hand(Players,Hands2d,Bidder,H1),
  2122.         append_djd(H1,Newdeck5,H1a),
  2123.         put_hand(Players,Hands2d,Bidder,H1a,Hands3).
  2124.         
  2125. %/* each player plays a card the highest card wins */
  2126. play_cards(Players,Hands,Played,Taken,Leader,
  2127.         Suite,Newplayed,Newtaken,
  2128.         Npret,Ntret) :- 
  2129.         Hands = [H1,H2,H3,H4],
  2130.         arrange_by_val(H1,H1s,Suite),
  2131.         arrange_by_val(H2,H2s,Suite),
  2132.         arrange_by_val(H3,H3s,Suite),
  2133.         arrange_by_val(H4,H4s,Suite),
  2134.         Hands2 = [H1s,H2s,H3s,H4s],
  2135.         write_bl(dennis),
  2136.         write_nl(hand),
  2137.         display_hand(H1s),
  2138.         play_card([Players,Hands2,Played,Taken,Leader,
  2139.         Newhands,Newplayed,Newtaken,Newleader,Suite]),
  2140.         play_cards(Players,Newhands,Newplayed,Newtaken,Newleader,Suite,
  2141.                 Np,Nt,Npret,Ntret).  
  2142. %/* a hand ends when all players are out of cards */
  2143. play_cards(Players,Hands,Played,Taken,Leader,Suite,Newplayed,Newtaken,
  2144.         Npret,Ntret) :- 
  2145.         out(Players,Hands), !,
  2146.         Npret =Played,
  2147.         Ntret = Taken.
  2148.         
  2149. out(Players,Hands) :- 
  2150.         Hands = [[],[],[],[]], !,
  2151.                 write_nl(p_out).
  2152. play_card([Players,Hands,Played,Taken,Leader,Newhands,Newplayed,
  2153.         Newtaken,Newleader,Suite]) :-
  2154.         play_1card([Players,Hands,Played,Leader,Newhands1,Newplayed1,
  2155.         0,none,0,Newwhohigh1,[],Newcards1,Suite]),
  2156.         succ_player(Leader,P2),
  2157.         play_1card([Players,Newhands1,Newplayed1,P2,Newhands2,Newplayed2,
  2158.         Newhigh1,Newwhohigh1,Newhigh2,Newwhohigh2,
  2159.         Newcards1,Newcards2,Suite]),
  2160.         succ_player(P2,P3),
  2161.         play_1card([Players,Newhands2,Newplayed2,P3,Newhands3,Newplayed3,
  2162.         Newhigh2,Newwhohigh2,Newhigh3,Newwhohigh3,
  2163.         Newcards2,Newcards3,Suite]),
  2164.         succ_player(P3,P4),
  2165.         play_1card([Players,Newhands3,Newplayed3,P4,Newhands,Newplayed,
  2166.         Newhigh3,Newwhohigh3,Newhigh4,Newwhohigh4,
  2167.         Newcards3,Newcards4,Suite]),
  2168.         summary_cards_taken([Players,Taken,Newtaken,Newhigh4,Newwhohigh4,
  2169.         Newcards4,Newleader]).
  2170. play_1card([Players,Newhands1,Newplayed1,P2,Newhands2,Newplayed2,
  2171.         Newhigh1,Newwhohigh1,Newhigh2,Newwhohigh2,
  2172.         Newcards1,Newcards2,Suite]) :-
  2173.         P2 :\== dennis,
  2174.         get_hand(Players,Newhands1,P2,H2),
  2175.         best_card(Players,P2,H2,Newplayed1,Newtaken1,Newcards1,Card1,
  2176.         Suite,Newhigh1,Newwhohigh1),
  2177.         card([Card1,Val,Suite,Name,Pt_taken,Pt_played]),
  2178.         Val > Newhigh1, ! ,
  2179.         write_bl(P2),
  2180.         write_bl(plays),
  2181.         write_nl(Name),
  2182.         delete(Card1,H2,Nh2),
  2183.         Newhigh2 = Val,
  2184.         Newwhohigh2 = P2,
  2185.         put_hand(Players,Newhands1,P2,Nh2,Newhands2),
  2186.         get_hand(Players,Newplayed1,P2,Pl1),
  2187.         Pl2 = [Card1 | Pl1],
  2188.         Newcards2 = [Card1 | Newcards1],
  2189.   %/*      write_bl(newcards2),write_nl(Newcards2), */
  2190.         put_hand(Players,Newplayed1,P2,Pl2,Newplayed2). %/* was , */
  2191.     %/*    write_bl(newplayed2),write_nl(Newplayed2). */
  2192. play_1card([Players,Newhands1,Newplayed1,P2,Newhands2,Newplayed2,
  2193.         Newhigh1,Newwhohigh1,Newhigh2,Newwhohigh2,
  2194.         Newcards1,Newcards2,Suite]) :-
  2195.         P2 :\== dennis,
  2196.         get_hand(Players,Newhands1,P2,H2),
  2197.         best_card(Players,P2,H2,Newplayed1,Newtaken1,Newcards1,Card1,
  2198.         Suite,Newhigh1,Newwhohigh1),
  2199.         card([Card1,Val,Suite,Name,Pt_taken,Pt_played]),
  2200.         Val < Newhigh1, ! ,
  2201.         write_bl(P2),
  2202.         write_bl(plays),
  2203.         write_nl(Name),
  2204.         delete(Card1,H2,Nh2),
  2205.         Newhigh2 = Newhigh1,
  2206.         Newwhohigh2 = Newwhohigh1,
  2207.         put_hand(Players,Newhands1,P2,Nh2,Newhands2),
  2208.         get_hand(Players,Newplayed1,P2,Pl1),
  2209.         Pl2 = [Card1 | Pl1],
  2210.         Newcards2 = [Card1 | Newcards1],
  2211.    %/*     write_bl(newcards2),write_nl(Newcards2), */
  2212.         put_hand(Players,Newplayed1,P2,Pl2,Newplayed2). %/* was , */
  2213.    %/*     write_bl(newplayed2),write_nl(Newplayed2). */
  2214. %/* rule repeated 3 times for 3 chances */
  2215. play_1card([Players,Newhands1,Newplayed1,dennis,Newhands2,Newplayed2,
  2216.         Newhigh1,Newwhohigh1,Newhigh2,Newwhohigh2,
  2217.         Newcards1,Newcards2,Suite]) :-
  2218.         get_hand(Players,Newhands1,dennis,H2),
  2219.         write_bl(play),
  2220.         write_bl(what),
  2221.         write_nl(card),
  2222.         read(Name),
  2223.         valid_card(Name,Suite,H2),!,
  2224.         play_1card_b(Players,Newhands1,Newplayed1,dennis,Newhands2,Newplayed2,
  2225.         Newhigh1,Newwhohigh1,Newhigh2,Newwhohigh2,
  2226.         Newcards1,Newcards2,Suite,Name,H2).
  2227. play_1card([Players,Newhands1,Newplayed1,dennis,Newhands2,Newplayed2,
  2228.         Newhigh1,Newwhohigh1,Newhigh2,Newwhohigh2,
  2229.         Newcards1,Newcards2,Suite]) :-
  2230.         get_hand(Players,Newhands1,dennis,H2),
  2231.         write_bl(play),
  2232.         write_bl(what),
  2233.         write_nl(card),
  2234.         read(Name),
  2235.         valid_card(Name,Suite,H2),!,
  2236.         play_1card_b(Players,Newhands1,Newplayed1,dennis,Newhands2,Newplayed2,
  2237.         Newhigh1,Newwhohigh1,Newhigh2,Newwhohigh2,
  2238.         Newcards1,Newcards2,Suite,Name,H2).
  2239. play_1card([Players,Newhands1,Newplayed1,dennis,Newhands2,Newplayed2,
  2240.         Newhigh1,Newwhohigh1,Newhigh2,Newwhohigh2,
  2241.         Newcards1,Newcards2,Suite]) :-
  2242.         get_hand(Players,Newhands1,dennis,H2),
  2243.         write_bl(play),
  2244.         write_bl(what),
  2245.         write_nl(card),
  2246.         read(Name),
  2247.         valid_card(Name,Suite,H2),!,
  2248.         play_1card_b(Players,Newhands1,Newplayed1,dennis,Newhands2,Newplayed2,
  2249.         Newhigh1,Newwhohigh1,Newhigh2,Newwhohigh2,
  2250.         Newcards1,Newcards2,Suite,Name,H2).
  2251.  
  2252. play_1card_b(Players,Newhands1,Newplayed1,dennis,Newhands2,Newplayed2,
  2253.         Newhigh1,Newwhohigh1,Newhigh2,Newwhohigh2,
  2254.         Newcards1,Newcards2,Suite,Name,H2) :-
  2255.         card([Card1,Val,Suite,Name,Pt_taken,Pt_played]),
  2256.         Val > Newhigh1, ! ,
  2257.         write_bl(dennis),
  2258.         write_bl(plays),
  2259.         write_nl(Name),
  2260.         delete(Card1,H2,Nh2),
  2261.         Newhigh2 = Val,
  2262.         Newwhohigh2 = dennis,
  2263.         put_hand(Players,Newhands1,dennis,Nh2,Newhands2),
  2264.         get_hand(Players,Newplayed1,dennis,Pl1),
  2265.         Pl2 = [Card1 | Pl1],
  2266.         Newcards2 = [Card1 | Newcards1],
  2267.   %/*      write_bl(newcards2),write_nl(Newcards2), */
  2268.         put_hand(Players,Newplayed1,dennis,Pl2,Newplayed2). %/* was , */
  2269.     %/*    write_bl(newplayed2),write_nl(Newplayed2). */
  2270.         
  2271.  
  2272. play_1card_b(Players,Newhands1,Newplayed1,dennis,Newhands2,Newplayed2,
  2273.         Newhigh1,Newwhohigh1,Newhigh2,Newwhohigh2,
  2274.         Newcards1,Newcards2,Suite,Name,H2) :-
  2275.         card([Card1,Val,Suite,Name,Pt_taken,Pt_played]),
  2276.         Val =< Newhigh1, ! ,
  2277.         write_bl(dennis),
  2278.         write_bl(plays),
  2279.         write_nl(Name),
  2280.         delete(Card1,H2,Nh2),
  2281.         Newhigh2 = Newhigh1,
  2282.         Newwhohigh2 = Newwhohigh1,
  2283.         put_hand(Players,Newhands1,dennis,Nh2,Newhands2),
  2284.         get_hand(Players,Newplayed1,dennis,Pl1),
  2285.         Pl2 = [Card1 | Pl1],
  2286.         Newcards2 = [Card1 | Newcards1],
  2287.    %/*     write_bl(newcards2),write_nl(Newcards2), */
  2288.         put_hand(Players,Newplayed1,dennis,Pl2,Newplayed2). %/* was , */
  2289.    %/*     write_bl(newplayed2),write_nl(Newplayed2). */
  2290. play_1card([Players,Newhands1,Newplayed1,P2,Newhands2,Newplayed2,
  2291.         Newhigh1,Newwhohigh1,Newhigh2,Newwhohigh2,
  2292.         Newcards1,Newcards2,Suite]) :-
  2293.         get_hand(Players,Newhands1,P2,H2),
  2294.         H2 = [],!,
  2295.         asserta(is_out(P2)), 
  2296.                 write_bl(P2),
  2297.                 write_nl(is_out),
  2298.         Newhigh2 = Newhigh1,
  2299.         Newhands2 = Newhands1,
  2300.         Newplayed2 = Newplayed1,
  2301.         Newcards2 = Newcards1, 
  2302.         Newwhohigh2 = Newwhohigh1.
  2303.  
  2304. summary_cards_taken([Players,Taken,Newtaken,Newhigh4,Newwhohigh4,
  2305.         Newcards4,Newleader]):-
  2306.         get_hand(Players,Taken,Newwhohigh4,H2),
  2307.         append_djd(H2,Newcards4,H3),
  2308.                 write_bl(Newwhohigh4),
  2309.                 write_nl(takes_the_hand),
  2310.         Newleader = Newwhohigh4,
  2311.         put_hand(Players,Taken,Newwhohigh4,H3,Newtaken). %/* was , */
  2312.    %/*     write_bl(newtaken),write_nl(Newtaken). */
  2313. write_nl(X) :- write(X), put(46), put(10), put(13).
  2314. %                write(Log,X), put(Log,46), put(Log,10), put(Log,13).
  2315. write_bl(X) :- write(X), put(32).
  2316. %                 write(Log,X), put(Log,32).
  2317.         
  2318.         
  2319. score(Players,Teams,Played,Taken,Scores,Newscores,Bidder,Bid,Suite) :- 
  2320.         Scores = [S1,S2],
  2321.                 Players = [P1,P2,P3,P4],
  2322.                 get_hand(Players,Taken,P1,Card1s_taken1),
  2323.                 pts_taken(Card1s_taken1,Suite,Score_addt1,0),
  2324.                 get_hand(Players,Played,P1,Card1s_played1),
  2325.                 pts_played(Card1s_played1,Suite,Score_addp1,0),
  2326.                 get_hand(Players,Taken,P2,Card1s_taken2),
  2327.                 pts_taken(Card1s_taken2,Suite,Score_addt2,0),
  2328.                 get_hand(Players,Played,P2,Card1s_played2),
  2329.                 pts_played(Card1s_played2,Suite,Score_addp2,0),
  2330.                 get_hand(Players,Taken,P3,Card1s_taken3),
  2331.                 pts_taken(Card1s_taken3,Suite,Score_addt3,0),
  2332.                 get_hand(Players,Played,P3,Card1s_played3),
  2333.                 pts_played(Card1s_played3,Suite,Score_addp3,0),
  2334.                 get_hand(Players,Taken,P4,Card1s_taken4),
  2335.                 pts_taken(Card1s_taken4,Suite,Score_addt4,0),
  2336.                 get_hand(Players,Played,P4,Card1s_played4),
  2337.                 pts_played(Card1s_played4,Suite,Score_addp4,0),
  2338.                 (Pts1 -> Score_addt1 + Score_addp1 + Score_addt3 + 
  2339.                  Score_addp3),
  2340.                 (Pts2 -> Score_addt2 + Score_addp2 + Score_addt4 + 
  2341.                 Score_addp4),
  2342.                 Teams = [T1,T2],
  2343.                 member_djd(Bidder,T1),
  2344.                 Pts1 >= Bid, 
  2345.         (S1a -> S1 + Pts1),
  2346.         (S2a -> S2 + Pts2), 
  2347.         Newscores = [S1a,S2a],
  2348.         write_nl(p_score),
  2349.         write_nl(Teams),
  2350.         write_nl(Scores),
  2351.         write_nl(Newscores).
  2352.  
  2353. score(Players,Teams,Played,Taken,Scores,Newscores,Bidder,Bid,Suite) :- 
  2354.         Scores = [S1,S2],
  2355.                 Players = [P1,P2,P3,P4],
  2356.                 get_hand(Players,Taken,P1,Card1s_taken1),
  2357.                 pts_taken(Card1s_taken1,Suite,Score_addt1,0),
  2358.                 get_hand(Players,Played,P1,Card1s_played1),
  2359.                 pts_played(Card1s_played1,Suite,Score_addp1,0),
  2360.                 get_hand(Players,Taken,P2,Card1s_taken2),
  2361.                 pts_taken(Card1s_taken2,Suite,Score_addt2,0),
  2362.                 get_hand(Players,Played,P2,Card1s_played2),
  2363.                 pts_played(Card1s_played2,Suite,Score_addp2,0),
  2364.                 get_hand(Players,Taken,P3,Card1s_taken3),
  2365.                 pts_taken(Card1s_taken3,Suite,Score_addt3,0),
  2366.                 get_hand(Players,Played,P3,Card1s_played3),
  2367.                 pts_played(Card1s_played3,Suite,Score_addp3,0),
  2368.                 get_hand(Players,Taken,P4,Card1s_taken4),
  2369.                 pts_taken(Card1s_taken4,Suite,Score_addt4,0),
  2370.                 get_hand(Players,Played,P4,Card1s_played4),
  2371.                 pts_played(Card1s_played4,Suite,Score_addp4,0),
  2372.                 (Pts1 -> Score_addt1 + Score_addp1 + Score_addt3 + 
  2373.                 Score_addp3),
  2374.                 (Pts2 -> Score_addt2 + Score_addp2 + Score_addt4 + 
  2375.                 Score_addp4),
  2376.                 Teams = [T1,T2],
  2377.                 member_djd(Bidder,T2),
  2378.                 Pts2 >= Bid, 
  2379.         (S1a -> S1 + Pts1),
  2380.         (S2a -> S2 + Pts2), 
  2381.         Newscores = [S1a,S2a],
  2382.         write_nl(p_score),
  2383.         write_nl(Teams),
  2384.         write_nl(Scores),
  2385.         write_nl(Newscores).
  2386.  
  2387. score(Players,Teams,Played,Taken,Scores,Newscores,Bidder,Bid,Suite) :- 
  2388.         Scores = [S1,S2],
  2389.                 Players = [P1,P2,P3,P4],
  2390.                 get_hand(Players,Taken,P1,Card1s_taken1),
  2391.                 pts_taken(Card1s_taken1,Suite,Score_addt1,0),
  2392.                 get_hand(Players,Played,P1,Card1s_played1),
  2393.                 pts_played(Card1s_played1,Suite,Score_addp1,0),
  2394.                 get_hand(Players,Taken,P2,Card1s_taken2),
  2395.                 pts_taken(Card1s_taken2,Suite,Score_addt2,0),
  2396.                 get_hand(Players,Played,P2,Card1s_played2),
  2397.                 pts_played(Card1s_played2,Suite,Score_addp2,0),
  2398.                 get_hand(Players,Taken,P3,Card1s_taken3),
  2399.                 pts_taken(Card1s_taken3,Suite,Score_addt3,0),
  2400.                 get_hand(Players,Played,P3,Card1s_played3),
  2401.                 pts_played(Card1s_played3,Suite,Score_addp3,0),
  2402.                 get_hand(Players,Taken,P4,Card1s_taken4),
  2403.                 pts_taken(Card1s_taken4,Suite,Score_addt4,0),
  2404.                 get_hand(Players,Played,P4,Card1s_played4),
  2405.                 pts_played(Card1s_played4,Suite,Score_addp4,0),
  2406.                 (Pts1 -> Score_addt1 + Score_addp1 + Score_addt3 + 
  2407.                 Score_addp3),
  2408.                 (Pts2 -> Score_addt2 + Score_addp2 + Score_addt4 + 
  2409.                 Score_addp4),
  2410.                 Teams = [T1,T2],
  2411.                 member_djd(Bidder,T1),
  2412.                 Pts1 < Bid, 
  2413.         (S1a -> S1 - Bid),
  2414.         (S2a -> S2 + Pts2), 
  2415.         Newscores = [S1a,S2a],
  2416.         write_nl(bidder_went_set),
  2417.         write_nl(p_score),
  2418.         write_nl(Teams),
  2419.         write_nl(Scores),
  2420.         write_nl(Newscores).
  2421.  
  2422. score(Players,Teams,Played,Taken,Scores,Newscores,Bidder,Bid,Suite) :- 
  2423.         Scores = [S1,S2],
  2424.                 Players = [P1,P2,P3,P4],
  2425.                 get_hand(Players,Taken,P1,Card1s_taken1),
  2426.                 pts_taken(Card1s_taken1,Suite,Score_addt1,0),
  2427.                 get_hand(Players,Played,P1,Card1s_played1),
  2428.                 pts_played(Card1s_played1,Suite,Score_addp1,0),
  2429.                 get_hand(Players,Taken,P2,Card1s_taken2),
  2430.                 pts_taken(Card1s_taken2,Suite,Score_addt2,0),
  2431.                 get_hand(Players,Played,P2,Card1s_played2),
  2432.                 pts_played(Card1s_played2,Suite,Score_addp2,0),
  2433.                 get_hand(Players,Taken,P3,Card1s_taken3),
  2434.                 pts_taken(Card1s_taken3,Suite,Score_addt3,0),
  2435.                 get_hand(Players,Played,P3,Card1s_played3),
  2436.                 pts_played(Card1s_played3,Suite,Score_addp3,0),
  2437.                 get_hand(Players,Taken,P4,Card1s_taken4),
  2438.                 pts_taken(Card1s_taken4,Suite,Score_addt4,0),
  2439.                 get_hand(Players,Played,P4,Card1s_played4),
  2440.                 pts_played(Card1s_played4,Suite,Score_addp4,0),
  2441.                 (Pts1 -> Score_addt1 + Score_addp1 + Score_addt3 + 
  2442.                 Score_addp3),
  2443.                 (Pts2 -> Score_addt2 + Score_addp2 + Score_addt4 + 
  2444.                 Score_addp4),
  2445.                 Teams = [T1,T2],
  2446.                 member_djd(Bidder,T2),
  2447.                 Pts2 < Bid, 
  2448.         (S1a -> S1 + Pts1),
  2449.         (S2a -> S2 - Bid), 
  2450.         Newscores = [S1a,S2a],
  2451.         write_nl(bidder_went_set),
  2452.         write_nl(p_score),
  2453.         write_nl(Teams),
  2454.         write_nl(Scores),
  2455.         write_nl(Newscores).
  2456.  
  2457. pts_taken(Card1s_taken1,Suite,Score_add1,Temp) :-
  2458.         Card1s_taken1 = [Card1 | Card1s_left],
  2459.     card([Card1,Val,Suite,Name,Pt_taken,Pt_played]),
  2460.         (Temp2 = Temp + Pt_taken),
  2461.         pts_taken(Card1s_left,Suite,Score_add1,Temp2).
  2462. pts_taken(Card1s_taken1,Suite,Score_add1,Temp) :-
  2463.         Card1s_taken1 = [], ! ,
  2464.         Score_add1 = Temp.
  2465.         
  2466. pts_played(Card1s_played1,Suite,Score_add1,Temp) :-
  2467.         Card1s_played1 = [Card1 | Card1s_left],
  2468.     card([Card1,Val,Suite,Name,Pt_taken,Pt_played]),
  2469.         (Temp2 = Temp + Pt_played),
  2470.         pts_played(Card1s_left,Suite,Score_add1,Temp2).
  2471. pts_played(Card1s_played1,Suite,Score_add1,Temp) :-
  2472.         Card1s_played1 = [], ! ,
  2473.         Score_add1 = Temp.
  2474.  
  2475. %/* lead highest card left */
  2476. best_card(Players,P2,H2,Newplayed1,Newtaken1,Newcards1,Card1,
  2477.     Suite,Newhigh1,Newwhohigh1) :-
  2478.     \+(am_last_to_play(Players,P2,H2,Newplayed1,Newtaken1,Newcards1,
  2479.     Card1,Suite)),
  2480.     have_highest_card_left(Players,P2,H2,Newplayed1,Newtaken1,Newcards1,
  2481.     Cardx,Suite),
  2482.     Card1 = Cardx,
  2483. %/*    write_nl(have_highest_card), */
  2484.     card([Card1,Val,Suite,Name,Pt_taken,Pt_played]).
  2485. %/* take point card - last (with smallest card that woll take because arrangeed*/
  2486. best_card(Players,P2,H2,Newplayed1,Newtaken1,Newcards1,Card1,
  2487.     Suite,Newhigh1,Newwhohigh1) :-
  2488.     am_last_to_play(Players,P2,H2,Newplayed1,Newtaken1,Newcards1,
  2489.     Card1,Suite),
  2490.     pt_card_played(Players,P2,H2,Newplayed1,Newtaken1,Newcards1,
  2491.     Cardp,Suite),
  2492.     have_higher_card_left(Players,P2,H2,Newplayed1,Newtaken1,Newcards1,
  2493.     Cardx,Suite),
  2494.     \+(partner(P2,Newwhohigh1)),
  2495.     Card1 = Cardx,
  2496. %/*    write_nl(take_pt_card_last), */
  2497.     card([Card1,Val,Suite,Name,Pt_taken,Pt_played]).
  2498. %/* save point cards playing last */
  2499. best_card(Players,P2,H2,Newplayed1,Newtaken1,Newcards1,Card1,
  2500.     Suite,Newhigh1,Newwhohigh1) :-
  2501.     am_last_to_play(Players,P2,H2,Newplayed1,Newtaken1,Newcards1,
  2502.     Card1,Suite),
  2503.     can_save_point(Players,P2,H2,Newplayed1,Newtaken1,Newcards1,
  2504.     Cardx,Suite),
  2505.     Card1 = Cardx,
  2506. %/*    write_nl(can_save_point), */
  2507.     card([Card1,Val,Suite,Name,Pt_taken,Pt_played]).
  2508. %/* opponent has played high card - plays small card */
  2509. best_card(Players,P2,H2,Newplayed1,Newtaken1,Newcards1,Card1,
  2510.     Suite,Newhigh1,Newwhohigh1) :-
  2511.     \+(have_highest_card_left(Players,P2,H2,Newplayed1,Newtaken1,Newcards1,
  2512.     Cardw,Suite)),
  2513.     \+(partner(P2,Newwhohigh1)),
  2514.     have_small_card(Players,P2,H2,Newplayed1,Newtaken1,Newcards1,
  2515.     Cardx,Suite),
  2516.     Card1 = Cardx,
  2517.     card([Card1,Val,Suite,Name,Pt_taken,Pt_played]).
  2518. %/*    write_nl(play_small_card). */
  2519.     
  2520. %/* partner has played high card - plays point card */
  2521. best_card(Players,P2,H2,Newplayed1,Newtaken1,Newcards1,Card1,
  2522.     Suite,Newhigh1,Newwhohigh1) :-
  2523.     \+(have_highest_card_left(Players,P2,H2,Newplayed1,Newtaken1,Newcards1,
  2524.     Cardw,Suite)),
  2525.     partner(P2,Newwhohigh1),
  2526.     have_point_card(Players,P2,H2,Newplayed1,Newtaken1,Newcards1,
  2527.     Cardx,Suite),
  2528.     Card1 = Cardx,
  2529.     card([Card1,Val,Suite,Name,Pt_taken,Pt_played]).
  2530. %/*    write_nl(play_point_card). */
  2531.     
  2532. %/* no special rule applied so play any card */
  2533. best_card(Players,P2,H2,Newplayed1,Newtaken1,Newcards1,Card1,
  2534.     Suite,Newhigh1,Newwhohigh1) :-
  2535.         H2 = [Card1 | H3],
  2536.         card([Card1,Val,Suite,Name,Pt_taken,Pt_played]).
  2537.         
  2538. have_highest_card_left(Players,P2,H2,Newplayed1,Newtaken1,Newcards1,
  2539.     Cardx,Suite) :-
  2540.     member_djd(Cardx,H2),
  2541.     card([Cardx,Val,Suite,Name,Pt_taken,Pt_played]),
  2542.     \+(exists_higher_card_not_in_list(Newcards1,Suite,Val,Newplayed1)).
  2543. exists_higher_card_not_in_list(Newcards1,Suite,Val,Newplayed1) :-
  2544.     card([Card2,Val2,Suite,Name,Pt_taken,Pt_played]),
  2545.     Val2 > Val,
  2546.     \+(sub_member(Card2,Newplayed1,Newcards1)).
  2547. sub_member(Card2,Newplayed1,Newcards1) :-
  2548.     member_djd(Pl,Newplayed1),
  2549.     \+(member_djd(Card2,Newcards1)),
  2550.     member_djd(Card2,Pl).
  2551.  
  2552. point_card_played(Players,P2,H2,Newplayed1,Newtaken1,Newcards1,
  2553.     Card1,Suite) :-
  2554.     member_djd(Card,Newcards1),
  2555.     card([Card,Val,Suite,Name,Pt_taken,Pt_played]),
  2556.     Pt_taken > 0.
  2557. am_first_to_play(Players,P2,H2,Newplayed1,Newtaken1,Newcards1,
  2558.     Card1,Suite) :-
  2559.     length_djd(Newcards1,Len),
  2560.     Len = 0.    
  2561. am_last_to_play(Players,P2,H2,Newplayed1,Newtaken1,Newcards1,
  2562.     Card1,Suite) :-
  2563.     length_djd(Newcards1,Len),
  2564.     Len = 3.    
  2565. am_last_to_play(Players,P2,H2,Newplayed1,Newtaken1,Newcards1,
  2566.     Card1,Suite) :-
  2567.     length_djd(Newcards1,Len),
  2568.     succ_player(P2,P3),
  2569.     is_out(P3),
  2570.     Len = 2.    
  2571. am_last_to_play(Players,P2,H2,Newplayed1,Newtaken1,Newcards1,
  2572.     Card1,Suite) :-
  2573.     length_djd(Newcards1,Len),
  2574.     succ_player(P2,P3),
  2575.     is_out(P3),
  2576.     succ_player(P3,P4),
  2577.     is_out(P4),
  2578.     Len = 1.    
  2579. point_card_may_be_played(Players,P2,H2,Newplayed1,Newtaken1,Newcards1,
  2580.     Card1,Suite) :-
  2581.     \+(am_last_to_play(Players,P2,H2,Newplayed1,Newtaken1,Newcards1,
  2582.     Card1,Suite)),
  2583.     card([Card2,Val2,Suite,Name,Pt_taken,Pt_played]),
  2584.     Pt_taken > 0,
  2585.     \+(sub_member(Card2,Newplayed1)).
  2586. can_save_point(Players,P2,H2,Newplayed1,Newtaken1,Newcards1,
  2587.     Cardx,Suite) :-
  2588.     am_last_to_play(Players,P2,H2,Newplayed1,Newtaken1,Newcards1,
  2589.     Cardx,Suite),
  2590.     member_djd(Cardx,H2),
  2591.     card([Cardx,Val,Suite,Name,Pt_taken,Pt_played]),
  2592.     Pt_taken > 0,
  2593.     \+(exists_higher_card_in_list(Val,Newcards1,Suite)).
  2594. exists_higher_card_in_list(Val,Newcards1,Suite) :-
  2595.     member_djd(Card2,Newcards1),
  2596.     card([Card2,Val2,Suite,Name,Pt_taken,Pt_played]),
  2597.     Val2 > Val.
  2598.     
  2599. partner_played_highest_card_so_far(Players,P2,H2,Newplayed1,Newtaken1,
  2600.     Newcards1,Card1,Suite,Newhigh1,Newwhohigh1) :-
  2601.     partner(P2,Newwhohigh1).
  2602.     
  2603. have_small_card(Players,P2,H2,Newplayed1,Newtaken1,Newcards1,
  2604.     Cardx,Suite) :-
  2605.     member_djd(Cardx,H2),
  2606.     card([Cardx,Val,Suite,Name,Pt_taken,Pt_played]),
  2607.     Val < 10.
  2608. have_point_card(Players,P2,H2,Newplayed1,Newtaken1,Newcards1,
  2609.     Cardx,Suite) :-
  2610.     member_djd(Cardx,H2),
  2611.     card([Cardx,Val,Suite,Name,Pt_taken,Pt_played]),
  2612.     Pt_taken > 0.
  2613.     
  2614.     
  2615. display_hand(H) :-
  2616.     H = [C | H2],
  2617.     card([C,Val,Suite,Name,Pt_taken,Pt_played]),!,
  2618.     write_bl(C),
  2619.     write_nl(Name),
  2620.     display_hand(H2).
  2621. display_hand([]).
  2622.  
  2623. pt_card_played(Players,P2,H2,Newplayed1,Newtaken1,Newcards1,
  2624. Cardp,Suite) :-
  2625.     member_djd(Cardp,Newcards1),
  2626.     card([Cardp,Val,Suite,Name,Pt_taken,Pt_played]),
  2627.     Pt_taken > 0.
  2628.     
  2629. have_higher_card_left(Players,P2,H2,Newplayed1,Newtaken1,Newcards1,
  2630. Cardx,Suite) :-
  2631.     member_djd(Cardx,H2),
  2632.     card([Cardx,Val,Suite,Name,Pt_taken,Pt_played]),
  2633.     \+(exists_higher_card_in_list(Newcards1,Suite,Val)).
  2634.     
  2635. exists_higher_card_in_list(Newcards1,Suite,Val) :-
  2636.     card([Card2,Val2,Suite,Name,Pt_taken,Pt_played]),
  2637.     Val2 > Val,
  2638.     member_djd(Card2,Newcards1).
  2639. arrange_by_val(H,Hs,Suite) :-
  2640.     get_vals(H,V,Suite),
  2641.     arrange(V,Vs),
  2642.     get_nos(Vs,Hs,Suite).
  2643. get_vals([],[],Suite).
  2644. get_vals(H,V,Suite) :-
  2645.     H = [No2 | Nos2],
  2646.     card([No2,Val2,Suite,Name2,Pt_taken2,Pt_played2]),
  2647.     get_vals(Nos2,Vals2,Suite),
  2648.     V = [Val2 | Vals2].
  2649. get_nos([],[],Suite).
  2650. get_nos(V,H,Suite) :-
  2651.     V = [Val3 | Vals3],
  2652.     card([No3,Val3,Suite,Name3,Pt_taken3,Pt_played3]),
  2653.     get_nos(Vals3,Nos3,Suite),
  2654.     H = [No3 | Nos3].
  2655. minimimd(N1,N2,N1) :- N1 =< N2.
  2656. minimimd(N1,N2,N2) :- N2 =< N1.
  2657. can_bid(Guess,Hand,Suite1,Bidder) :-
  2658.     member_djd(S,[diamonds,clubs,spades,hearts]),
  2659.     can_bid_suite(Guess2,Hand,S,Bidder),
  2660.     Suite1 = S,
  2661.     minimimd(7,Guess2,Guess).
  2662. can_bid(0,Hand,pass,Bidder).
  2663. bind_cs(0.6,0.04,0.04,1.0,0.2,dennis).
  2664. bind_cs(0.6,0.04,0.04,1.0,0.2,dick).
  2665. bind_cs(0.5,0.05,0.05,1.0,0.2,sussy).
  2666. bind_cs(0.5,0.05,0.05,1.0,0.2,john).
  2667. can_bid_suite(Guess,Hand,Suite1,Bidder) :- 
  2668.     discard_non_suite(Hand,Nh1,[],Handsuite,Suite1),
  2669.     get_vals(Handsuite,Vals,Suite1),
  2670.     no_high_cards(Vals,No_high),
  2671. %/*    write_bl(no_high),write_nl(No_high), */
  2672.     tot_face(Vals,Tot_face),
  2673. %/*    write_bl(no_face),write_nl(Tot_face), */
  2674.     tot_pts(Vals,Tot_pts),
  2675. %/*    write_bl(no_pts),write_nl(Tot_pts), */
  2676.     no_sure(Vals,No_sure),
  2677. %/*    write_bl(no_sure),write_nl(No_sure), */
  2678.     length_djd(Vals,No_cds),
  2679. %/*    write_bl(no_cds),write_nl(No_cds), */
  2680.     bind_cs(C1,C2,C3,C4,C5,Bidder),
  2681.     (Guessf1 = C1 * No_high) ,
  2682.         (Guessf2 = Guessf1 + C2 * Tot_face),
  2683.     (Guessf3 = Guessf2 + C3 * Tot_pts),
  2684.     (Guessf4 = Guessf3 + C4 * No_sure),
  2685.     (Guessf5 = Guessf4 + C5 * No_cds),
  2686.     (Guess = floor(Guessf5)).
  2687.  
  2688. no_high_cards(Vals,6) :-
  2689.     member_djd(17,Vals),
  2690.     member_djd(16,Vals),
  2691.     member_djd(15,Vals),
  2692.     member_djd(14,Vals),
  2693.     member_djd(13,Vals),
  2694.     member_djd(12,Vals),!.
  2695. no_high_cards(Vals,5) :-
  2696.     member_djd(17,Vals),
  2697.     member_djd(16,Vals),
  2698.     member_djd(15,Vals),
  2699.     member_djd(14,Vals),
  2700.     member_djd(13,Vals),!.
  2701. no_high_cards(Vals,4) :-
  2702.     member_djd(17,Vals),
  2703.     member_djd(16,Vals),
  2704.     member_djd(15,Vals),
  2705.     member_djd(14,Vals),!.
  2706. no_high_cards(Vals,3) :-
  2707.     member_djd(17,Vals),
  2708.     member_djd(16,Vals),
  2709.     member_djd(15,Vals),!.
  2710. no_high_cards(Vals,2) :-
  2711.     member_djd(17,Vals),
  2712.     member_djd(16,Vals),!.
  2713. no_high_cards(Vals,1) :-
  2714.     member_djd(17,Vals),!.
  2715. no_high_cards(Vals,0) :-
  2716.     \+(member_djd(17,Vals)),!.
  2717.     
  2718. tot_face([],0). 
  2719. tot_face(Vals,Tot_face) :-
  2720.     Vals = [V1 | Vs],
  2721.     V1 > 10,!,
  2722.     tot_face(Vs,Tot2),
  2723.     (Tot_face = V1 + Tot2). 
  2724. tot_face(Vals,Tot_face) :-
  2725.     Vals = [V1 | Vs],
  2726.     V1 =< 10,!,
  2727.     tot_face(Vs,Tot2),
  2728.     Tot_face = Tot2.
  2729. tot_pts([],0).
  2730. tot_pts(Vals,Tot_pts) :-
  2731.     Vals = [V1 | Vs],
  2732.     V1 > 9,
  2733.     V1 < 14,!,
  2734.     tot_pts(Vs,Tot2),
  2735.     (Tot_pts = V1 + Tot2). 
  2736. tot_pts(Vals,Tot_pts) :-
  2737.     Vals = [V1 | Vs],
  2738.     V1 < 10,!,
  2739.     tot_pts(Vs,Tot2),
  2740.     Tot_pts = Tot2. 
  2741. tot_pts(Vals,Tot_pts) :-
  2742.     Vals = [V1 | Vs],
  2743.     V1 < 10,!,
  2744.     tot_pts(Vs,Tot2),
  2745.     Tot_pts = Tot2. 
  2746. no_sure(Vals,2) :-
  2747.     member_djd(2,Vals),
  2748.     member_djd(17,Vals),!.
  2749. no_sure(Vals,1) :-
  2750.     member_djd(2,Vals),
  2751.     \+(member_djd(17,Vals)),!.
  2752. no_sure(Vals,1) :-
  2753.     \+(member_djd(2,Vals)),
  2754.     member_djd(17,Vals),!.
  2755. no_sure(Vals,0) :-
  2756.     \+(member_djd(2,Vals)),
  2757.     \+(member_djd(17,Vals)),!.
  2758. %trace(true)?
  2759.  
  2760. %play_game(R,S)?
  2761.  
  2762. reset_out(P,H) :-
  2763.     P=[P1,P2,P3,P4],
  2764.     H=[H1,H2,H3,H4],
  2765.     reset(P1,H1),
  2766.     reset(P2,H2),
  2767.     reset(P3,H3),
  2768.     reset(P4,H4).
  2769. arrange([X|Xs],Ys) :-
  2770.    arrange(Xs,Zs), 
  2771.    insert(X,Zs,Ys).
  2772. arrange([],[]).
  2773. insert(X,[],[X]).
  2774. insert(X,[Y|Ys],[Y|Zs]) :- X > Y,
  2775.    insert(X,Ys,Zs).
  2776. insert(X,[Y|Ys],[X|Zs]) :- X =< Y, 
  2777.    insert(Y,Ys,Zs).
  2778.  
  2779.