home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / lifeos2.zip / LIFE-1.02 / PITCH / WILDLIFE < prev    next >
Text File  |  1996-07-14  |  52KB  |  2,771 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,c_a_of_hearts,0,1).
  1665. heart(12,17,hearts,c_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,c_a_of_diamonds,0,1).
  1682. diamond(25,17,diamonds,c_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,c_a_of_spades,0,1).
  1699. spade(38,17,spades,c_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,c_a_of_clubs,0,1).
  1716. club(51,17,clubs,c_a_of_clubs,0,1).
  1717. valid_bid(Val) :- Val = 0.
  1718. valid_bid(Val) :- 2 =< Val , Val =< 7.
  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.        card(Nox,Valx,Suitex,Namex,Pt_takenx,Pt_playedx),
  1735.        member_djd(Nox,Hx).
  1736. %/* some predicates follow which are used for initialization */
  1737.  
  1738. bind_teams([[dennis,dick],[ruth,john]]).
  1739. bind_players([dennis,ruth,dick,john]).
  1740. succ_player(dennis,ruth).
  1741. succ_player(ruth,dick).
  1742. succ_player(dick,john).
  1743. succ_player(john,dennis).
  1744. partner(dennis,dick).
  1745. partner(dick,dennis).
  1746. partner(ruth,john).
  1747. partner(john,ruth).
  1748. bind_dealer(dennis).
  1749. bind_played([[],[],[],[]]).
  1750. bind_taken([[],[],[],[]]).
  1751. bind_score([0,0]).
  1752. %/*******************************************************************/
  1753. %/* The main predicate for invoking a game of pitch follows        */
  1754. %/* to invoke a game the query - play_game(R,S). - may be used.     */
  1755. %/******************************************************************/
  1756.  
  1757. play_game(Teams,Scores) :- bind_teams(Teams),
  1758.         bind_players(Players),
  1759.         asserta(is_out(dummy)),
  1760.         bind_score(Scores),bind_dealer(Dealer),
  1761.         play_hand(Players,Teams,Scores,Dealer,Deck,0).
  1762. play_hand(Players,Teams,Scores,Dealer,Deck,Cnt) :- done(Teams,Scores).
  1763. play_hand(Players,Teams,Scores,Dealer,Deck,Cnt) :-
  1764.  
  1765.         bind_played(Played),
  1766.         bind_taken(Taken),
  1767.         bind_deck(Cnt,Deck),
  1768.         deal(Players,Deck,Newdeckx,Hands,Dealer),
  1769.         bid_lf(Players,Hands,Dealer,Bidder,Bid,Suite),
  1770.         write_bl(bid_is),
  1771.         write_bl(Bidder),
  1772.         write_bl(Bid),
  1773.         write_nl(Suite),
  1774.         discard(Players,Hands,Hands2,Suite),
  1775.         deal2(Players,Newdeckx,Hands2,Hands3,Dealer,Bidder),
  1776.         discard(Players,Hands3,Hands4,Suite),
  1777.                 retract(is_out),
  1778. %                write_nl(before_play_cards), 
  1779.         play_cards(Players,Hands4,Played,Taken,
  1780.                 Bidder,Suite,
  1781.                 Newplayed,Newtaken,Npret,Ntret),
  1782.         score(Players,Teams,Npret,Ntret,Scores,Newscores,Bidder,Bid,Suite), 
  1783.         succ_player(Dealer,Newdealer),
  1784.         (Cnt2 = Cnt + 1), % was is changed to = for life
  1785.         play_hand(Players,Teams,Newscores,Newdealer,Newdeck,Cnt2).
  1786. %/* game is over when score reaches 21 */
  1787. done(Teams,[S1,S2]) :- S1 >= 21.
  1788. done(Teams,[S1,S2]) :- S2 >= 21. 
  1789. %/* deal cards 1st round.  Each player gets 9 cards */
  1790. deal(Players,Deck,Newdeckx,Hands,Dealer) :- write_nl(p_deal),
  1791.         Deck = [C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14,C15,
  1792.         C16,C17,C18,C19,C20,C21,C22,C23,C24,C25,C26,C27,C28,C29,C30,
  1793.         C31,C32,C33,C34,C35,C36,C37,C38,C39,C40,C41,C42,C43,C44,C45,
  1794.         C46,C47,C48,C49,C50,C51,C52,C53,C54],
  1795.         !,
  1796.         
  1797.         Newdeckx = [C37,C38,C39,C40,C41,C42,C43,C44,
  1798.         C45,C46,C47,C48,C49,C50,C51,C52,C53,C54],!,
  1799.         
  1800.         Hands = [[C1,C2,C3,C13,C14,C15,C25,C26,C27],
  1801.         [C4,C5,C6,C16,C17,C18,C28,C29,C30],
  1802.         [C7,C8,C9,C19,C20,C21,C31,C32,C33],
  1803.         [C10,C11,C12,C22,C23,C24,C34,C35,C36]],!.
  1804. %/* rules foer what a player can bid follow */
  1805. %/*
  1806. %can_bid(4,Hand,Suite1,Bidder) :- 
  1807. %        member_djd(No1,Hand),
  1808. %        member_djd(No2,Hand),
  1809. %        card(No1,2,Suite1,Name1,Pt_taken1,Pt_played1),
  1810. %        card(No2,17,Suite2,Name2,Pt_taken2,Pt_played2),
  1811. %        Suite1 = Suite2.
  1812. %can_bid(3,Hand,Suite,Bidder) :- 
  1813. %        member_djd(No1,Hand),
  1814. %        card(No1,17,Suite,Name1,Pt_taken1,Pt_played1).
  1815. %can_bid(2,Hand,Suite1,Bidder) :- 
  1816. %        member_djd(No1,Hand),
  1817. %        member_djd(No2,Hand),
  1818. %        card(No1,2,Suite1,Name1,Pt_taken1,Pt_played1),
  1819. %        card(No2,Val2,Suite2,Name2,Pt_taken2,Pt_played2),
  1820. %        Val2 >= 10,
  1821. %        Suite1 = Suite2.
  1822. %can_bid(0,Hand,0,Bidder).
  1823. %*/
  1824. %/* the bidding process is described below */
  1825. bid_lf(Players,Hands,Dealer,Bidder,Bid,Suite) :- write_nl(p_bid),
  1826.         succ_player(Dealer,Bidder1),!,
  1827.         get_hand(Players,Hands,Bidder1,Hand1),!,
  1828.         trybid(Bidder1,Hand1,0,0,0,Maxbidder1,Maxbid1,Maxsuite1),!,
  1829.         succ_player(Bidder1,Bidder2),!,
  1830.         get_hand(Players,Hands,Bidder2,Hand2),!,
  1831.         trybid(Bidder2,Hand2,Maxbid1,Maxbidder1,Maxsuite1,
  1832.                 Maxbidder2,Maxbid2,Maxsuite2),!,
  1833.         succ_player(Bidder2,Bidder3),!,
  1834.         get_hand(Players,Hands,Bidder3,Hand3),!,
  1835.         trybid(Bidder3,Hand3,Maxbid2,Maxbidder2,Maxsuite2,
  1836.                 Maxbidder3,Maxbid3,Maxsuite3),!,
  1837.         succ_player(Bidder3,Bidder4),!,
  1838.         get_hand(Players,Hands,Bidder4,Hand4),!,
  1839.         trybid(Bidder4,Hand4,Maxbid3,Maxbidder3,Maxsuite3,
  1840.                 Bidder5,Bid5,Suite5),!,
  1841.         no_bid(Dealer,Bidder5,Bid5,Suite5,Bidder,Bid,Suite).
  1842. no_bid(Dealer,Bidder5,Bid5,Suite5,Bidder,Bid,Suite) :-
  1843.      Bid5 = 0,
  1844.      Bidder = Dealer,
  1845.      Bid = 2,
  1846.      Suite = spades.
  1847. no_bid(Dealer,Bidder5,Bid5,Suite5,Bidder,Bid,Suite) :-
  1848.      \+ (Bid5 = 0),
  1849.      Bidder = Bidder5,
  1850.      Bid = Bid5,
  1851.      Suite = Suite5.
  1852.      
  1853. %/* get hand provodes a list of cards associated with a player */
  1854. get_hand(Players,Hands,P1,H1) :-
  1855.         Players = [P1,P2,P3,P4],
  1856.         Hands = [H1,H2,H3,H4].
  1857. get_hand(Players,Hands,P2,H2) :-
  1858.         Players = [P1,P2,P3,P4],
  1859.         Hands = [H1,H2,H3,H4].
  1860. get_hand(Players,Hands,P3,H3) :-
  1861.         Players = [P1,P2,P3,P4],
  1862.         Hands = [H1,H2,H3,H4].
  1863. get_hand(Players,Hands,P4,H4) :-
  1864.         Players = [P1,P2,P3,P4],
  1865.         Hands = [H1,H2,H3,H4].
  1866. %/* put_hand updates a list of cards associated with a player */
  1867. put_hand(Players,Hands,P1,Hand,Newhands) :-
  1868.         Players = [P1,P2,P3,P4],
  1869.         Hands = [H1,H2,H3,H4],
  1870.         Newhands = [Hand,H2,H3,H4].
  1871. put_hand(Players,Hands,P2,Hand,Newhands) :-
  1872.         Players = [P1,P2,P3,P4],
  1873.         Hands = [H1,H2,H3,H4],
  1874.         Newhands = [H1,Hand,H3,H4].
  1875. put_hand(Players,Hands,P3,Hand,Newhands) :-
  1876.         Players = [P1,P2,P3,P4],
  1877.         Hands = [H1,H2,H3,H4],
  1878.         Newhands = [H1,H2,Hand,H4].
  1879. put_hand(Players,Hands,P4,Hand,Newhands) :-
  1880.         Players = [P1,P2,P3,P4],
  1881.         Hands = [H1,H2,H3,H4],
  1882.         Newhands = [H1,H2,H3,Hand].
  1883. %/* current player can bid higher than high bid so far */
  1884. trybid(Bidder2,Hand2,Maxbid1,Maxbidder1,Maxsuite1,
  1885.         Maxbidder2,Maxbid2,Maxsuite2) :-
  1886.         dennis :\==Bidder2,
  1887.         max_bid(Bidval,Hand2,Suite,Bidder2),
  1888.         Bidval > Maxbid1, 
  1889.         write_bl(Bidder2),
  1890.         write_bl(bids),
  1891.         write_nl(Bidval),
  1892.         Maxbidder2 = Bidder2,
  1893.         Maxbid2 = Bidval,
  1894.         Maxsuite2 = Suite.
  1895. %/* current player can not bid higher than high bid so far */
  1896. trybid(Bidder2,Hand2,Maxbid1,Maxbidder1,Maxsuite1,
  1897.         Maxbidder2,Maxbid2,Maxsuite2) :-
  1898.         dennis :\== Bidder2,
  1899.         max_bid(Bidval,Hand2,Suite,Bidder2),
  1900.         Bidval =< Maxbid1,
  1901.         Maxbidder2 = Maxbidder1,
  1902.         Maxbid2 = Maxbid1,
  1903.         Maxsuite2 = Maxsuite1.
  1904. %/* rule repeated 3 times for 3 chances for valid answer */
  1905. trybid(dennis,Hand2,Maxbid1,Maxbidder1,Maxsuite1,
  1906.         Maxbidder2,Maxbid2,Maxsuite2) :-
  1907.         display_hand(Hand2),
  1908.         write_bl(enter),
  1909.         write_bl(bid),
  1910.         write_nl(value),
  1911.         read(Bidval),
  1912.         valid_bid(Bidval),
  1913.         write_bl(enter),
  1914.         write_bl(bid),
  1915.         write_nl(suite),
  1916.         read(Suite),
  1917.         valid_suite(Suite),!,
  1918.         trybid_b(dennis,Hand2,Maxbid1,Maxbidder1,Maxsuite1,
  1919.         Maxbidder2,Maxbid2,Maxsuite2,Bidval,Suite).
  1920. trybid(dennis,Hand2,Maxbid1,Maxbidder1,Maxsuite1,
  1921.         Maxbidder2,Maxbid2,Maxsuite2) :-
  1922.         display_hand(Hand2),
  1923.         write_bl(enter),
  1924.         write_bl(bid),
  1925.         write_nl(value),
  1926.         read(Bidval),
  1927.         valid_bid(Bidval),
  1928.         write_bl(enter),
  1929.         write_bl(bid),
  1930.         write_nl(suite),
  1931.         read(Suite),
  1932.         valid_suite(Suite),!,
  1933.         trybid_b(dennis,Hand2,Maxbid1,Maxbidder1,Maxsuite1,
  1934.         Maxbidder2,Maxbid2,Maxsuite2,Bidval,Suite).
  1935. trybid(dennis,Hand2,Maxbid1,Maxbidder1,Maxsuite1,
  1936.         Maxbidder2,Maxbid2,Maxsuite2) :-
  1937.         display_hand(Hand2),
  1938.         write_bl(enter),
  1939.         write_bl(bid),
  1940.         write_nl(value),
  1941.         read(Bidval),
  1942.         valid_bid(Bidval),
  1943.         write_bl(enter),
  1944.         write_bl(bid),
  1945.         write_nl(suite),
  1946.         read(Suite),
  1947.         valid_suite(Suite),!,
  1948.         trybid_b(dennis,Hand2,Maxbid1,Maxbidder1,Maxsuite1,
  1949.         Maxbidder2,Maxbid2,Maxsuite2,Bidval,Suite).
  1950. trybid_b(dennis,Hand2,Maxbid1,Maxbidder1,Maxsuite1,
  1951.         Maxbidder2,Maxbid2,Maxsuite2,Bidval,Suite) :-
  1952.         Bidval > Maxbid1, 
  1953.         write_bl(Bidder2),
  1954.         write_bl(bids),
  1955.         write_nl(Bidval),
  1956.         Maxbidder2 = dennis,
  1957.         Maxbid2 = Bidval,
  1958.         Maxsuite2 = Suite.
  1959. trybid_b(dennis,Hand2,Maxbid1,Maxbidder1,Maxsuite1,
  1960.         Maxbidder2,Maxbid2,Maxsuite2,Bidval,Suite) :-
  1961.         Bidval = 0,
  1962.         Maxbidder2 = Maxbidder1,
  1963.         Maxbid2 = Maxbid1,
  1964.         Maxsuite2 = Maxsuite1.
  1965.  
  1966. %/* max bid appear in order lowest to highest */
  1967.  
  1968.  
  1969. max_bid(7,Hand,Suite,Bidder) :- can_bid(7,Hand,Suite,Bidder),!.
  1970. max_bid(6,Hand,Suite,Bidder) :- can_bid(6,Hand,Suite,Bidder),!.
  1971. max_bid(5,Hand,Suite,Bidder) :- can_bid(5,Hand,Suite,Bidder),!.
  1972. max_bid(4,Hand,Suite,Bidder) :- can_bid(4,Hand,Suite,Bidder),!.
  1973. max_bid(3,Hand,Suite,Bidder) :- can_bid(3,Hand,Suite,Bidder),!.
  1974. max_bid(2,Hand,Suite,Bidder) :- can_bid(2,Hand,Suite,Bidder),!.
  1975. max_bid(0,Hand,Suite,Bidder) :- can_bid(0,Hand,Suite,Bidder),!.
  1976.  
  1977. %/* delete item (card) from list of items (cards) */
  1978. delete(Item,List,Newlist) :-
  1979.         discard_item(Item,List,Nl,[],Newlist).
  1980.                  
  1981.                  
  1982. discard_item(Item,List,Nl,Partl,Newlist) :-
  1983.         List = [Item | Nl],
  1984.         Partl2 = Partl,
  1985.         discard_item(Item,Nl,Nl2,Partl2,Newlist).
  1986. discard_item(Item,List,Nl,Partl,Newlist) :-
  1987.         List = [Item],
  1988.         Partl2 = Partl,
  1989.         discard_item(Item,[],Nl2,Partl2,Newlist).
  1990.  
  1991. discard_item(Item,List,Nl,Partl,Newlist) :-
  1992.         List = [I | Nl],
  1993.         I :\== Item, 
  1994.         Partl2 = [I | Partl],
  1995.         discard_item(Item,Nl,Nl2,Partl2,Newlist).
  1996. discard_item(Item,List,Nl,Partl,Newlist) :-
  1997.         List = [I],
  1998.         I :\== Item,
  1999.         Partl2 = [I,Part],
  2000.         discard_item(Item,[],Nl2,Partl2,Newlist).
  2001.  
  2002. discard_item(Item,List,Nl,Partl,Newlist) :-
  2003.         List = [],!,
  2004.         Newlist = Partl.
  2005. %/* once suite is determined by high bidder players must discard cards
  2006. %not of that suite (except left jack & jokers) & also not retain more 
  2007. %than 6 cards*/
  2008. discard(Players,Hands,Hands2,Suite) :- write_nl(p_discard),
  2009.         Hands = [H1,H2,H3,H4],!,
  2010.         discard_non_suite(H1,Nh1,[],Hand1,Suite),!,
  2011.         discard_non_suite(H2,Nh2,[],Hand2,Suite),!,
  2012.         discard_non_suite(H3,Nh3,[],Hand3,Suite),!,
  2013.         discard_non_suite(H4,Nh4,[],Hand4,Suite),!,
  2014.         discard_excess(Hand1,Newhand1,Suite),!,
  2015.         discard_excess(Hand2,Newhand2,Suite),!,
  2016.         discard_excess(Hand3,Newhand3,Suite),!,
  2017.         discard_excess(Hand4,Newhand4,Suite),!,
  2018.         Hands2 = [Newhand1,Newhand2,Newhand3,Newhand4],!.
  2019. discard_non_suite(H,Nh,Parthand,Hand,Suite) :-
  2020.         H = [No | Nh],
  2021.         card(No,Val,Suite2,Name,Pt_taken,Pt_played),
  2022.         Suite = Suite2,
  2023.         append_djd(Parthand , [No] ,Parthand2),
  2024.         discard_non_suite(Nh,Nh2,Parthand2,Hand,Suite).
  2025. discard_non_suite(H,Nh,Parthand,Hand,Suite) :-
  2026.         H = [No | Nh],
  2027.         \+(card(No,Val,Suite,Name,Pt_taken,Pt_played)),
  2028.         discard_non_suite(Nh,Nh2,Parthand,Hand,Suite).
  2029. discard_non_suite([],Nh,Parthand,Hand,Suite) :-
  2030.         Hand = Parthand.
  2031. discard_non_suite(H,Nh,Parthand,Hand,Suite) :-
  2032.         Hand = [].
  2033. discard_excess(Hand,Newhand,Suite) :-
  2034.         length_djd(Hand,Len),
  2035.         Len =< 6, 
  2036.         Newhand = Hand.
  2037. discard_excess(Hand,Newhand,Suite) :-
  2038.         length_djd(Hand,Len),
  2039.         Len > 6,
  2040.         card(No,Val,Suite,Name,Pt_taken,Pt_played),
  2041.         member_djd(No,Hand),
  2042.         2 < Val,
  2043.         10 > Val,
  2044.         delete(No,Hand,Newhand2),
  2045.         discard_excess(Newhand2,Newhand,Suite).
  2046. discard_excess(Hand,Newhand,Suite) :-
  2047.         length_djd(Hand,Len),
  2048.         Len > 6,
  2049.         card(No,Val,Suite,Name,Pt_taken,Pt_played),
  2050.         member_djd(No,Hand),
  2051.         15 = Val,
  2052.         delete(No,Hand,Newhand2),
  2053.         discard_excess(Newhand2,Newhand,Suite).
  2054. discard_excess(Hand,Newhand,Suite) :-
  2055.         length_djd(Hand,Len),
  2056.         Len > 6,
  2057.         card(No,Val,Suite,Name,Pt_taken,Pt_played),
  2058.         member_djd(No,Hand),
  2059.         16 = Val,
  2060.         delete(No,Hand,Newhand2),
  2061.         discard_excess(Newhand2,Newhand,Suite).
  2062. discard_excess(Hand,Newhand,Suite) :-
  2063.         length_djd(Hand,Len),
  2064.         Len > 6,
  2065.         card(No,Val,Suite,Name,Pt_taken,Pt_played),
  2066.         member_djd(No,Hand),
  2067.         2 = Val,
  2068.         delete(No,Hand,Newhand2),
  2069.         discard_excess(Newhand2,Newhand,Suite).
  2070.         
  2071. %/* after discarding players (other than the bidder) receive enough
  2072. %cards th raise their total cards to 6.  The bidder gets to look through
  2073. %whatever is then left */
  2074.  
  2075. deal2(Players,Newdeck,Hands2,Hands3,Dealer,Bidder) :- 
  2076.         write_nl(p_deal2),
  2077.         succ_player(Dealer,P1),
  2078.         extras(Players,Newdeck,Newdeck2,Hands2,Hands2a,P1,Bidder),
  2079.         succ_player(P1,P2),
  2080.         extras(Players,Newdeck2,Newdeck3,Hands2a,Hands2b,P2,Bidder),
  2081.         succ_player(P2,P3),
  2082.         extras(Players,Newdeck3,Newdeck4,Hands2b,Hands2c,P3,Bidder),
  2083.         succ_player(P3,P4),
  2084.         extras(Players,Newdeck4,Newdeck5,Hands2c,Hands2d,P4,Bidder),
  2085.         remaining(Players,Newdeck5,Hands2d,Hands3,Bidder),!.
  2086.         
  2087. extras(Players,Newdeck,Newdeck2,Hands2,Hands2a,P1,Bidder) :-
  2088.         P1 = Bidder, ! ,
  2089.         Newdeck2 = Newdeck,
  2090.         Hands2a = Hands2.
  2091. extras(Players,Newdeck,Newdeck2,Hands2,Hands2a,P1,Bidder) :-
  2092.         Newdeck = [], ! ,
  2093.         Newdeck2 = Newdeck,
  2094.         Hands2a = Hands2.
  2095. extras(Players,Newdeck,Newdeck2,Hands2,Hands2a,P1,Bidder) :-
  2096.         get_hand(Players,Hands2,P1,H1),
  2097.         length_djd(H1,Len),
  2098.         Len = 6, ! ,
  2099.         Newdeck2 = Newdeck,
  2100.         Hands2a = Hands2.
  2101. extras(Players,Newdeck,Newdeck2,Hands2,Hands2a,P1,Bidder) :-
  2102.         get_hand(Players,Hands2,P1,H1),
  2103.         length_djd(H1,Len),
  2104.         Len < 6,
  2105.         Newdeck = [No | Newdeck3],
  2106.         H1a = [No | H1],
  2107.         put_hand(Players,Hands2,P1,H1a,Hands3),
  2108.         extras(Players,Newdeck3,Newdeck2,Hands3,Hands2a,P1,Bidder).
  2109.         
  2110.         
  2111. remaining(Players,Newdeck5,Hands2d,Hands3,Bidder) :-
  2112.         get_hand(Players,Hands2d,Bidder,H1),
  2113.         append_djd(H1,Newdeck5,H1a),
  2114.         put_hand(Players,Hands2d,Bidder,H1a,Hands3).
  2115.         
  2116. %/* each player plays a card the highest card wins */
  2117. play_cards(Players,Hands,Played,Taken,Leader,
  2118.         Suite,Newplayed,Newtaken,
  2119.         Npret,Ntret) :- 
  2120.         Hands = [H1,H2,H3,H4],
  2121.         arrange_by_val(H1,H1s,Suite),
  2122.         arrange_by_val(H2,H2s,Suite),
  2123.         arrange_by_val(H3,H3s,Suite),
  2124.         arrange_by_val(H4,H4s,Suite),
  2125.         Hands2 = [H1s,H2s,H3s,H4s],
  2126.         write_bl(dennis),
  2127.         write_nl(hand),
  2128.         display_hand(H1s),
  2129.         play_card([Players,Hands2,Played,Taken,Leader,
  2130.         Newhands,Newplayed,Newtaken,Newleader,Suite]),
  2131.         play_cards(Players,Newhands,Newplayed,Newtaken,Newleader,Suite,
  2132.                 Np,Nt,Npret,Ntret).  
  2133. %/* a hand ends when all players are out of cards */
  2134. play_cards(Players,Hands,Played,Taken,Leader,Suite,Newplayed,Newtaken,
  2135.         Npret,Ntret) :- 
  2136.         out(Players,Hands), !,
  2137.         Npret =Played,
  2138.         Ntret = Taken.
  2139.         
  2140. out(Players,Hands) :- 
  2141.         Hands = [[],[],[],[]], !,
  2142.                 write_nl(p_out).
  2143. play_card([Players,Hands,Played,Taken,Leader,Newhands,Newplayed,
  2144.         Newtaken,Newleader,Suite]) :-
  2145.         play_1card([Players,Hands,Played,Leader,Newhands1,Newplayed1,
  2146.         0,none,Newhigh1,Newwhohigh1,[],Newcards1,Suite]),
  2147.         succ_player(Leader,P2),
  2148.         play_1card([Players,Newhands1,Newplayed1,P2,Newhands2,Newplayed2,
  2149.         Newhigh1,Newwhohigh1,Newhigh2,Newwhohigh2,
  2150.         Newcards1,Newcards2,Suite]),
  2151.         succ_player(P2,P3),
  2152.         play_1card([Players,Newhands2,Newplayed2,P3,Newhands3,Newplayed3,
  2153.         Newhigh2,Newwhohigh2,Newhigh3,Newwhohigh3,
  2154.         Newcards2,Newcards3,Suite]),
  2155.         succ_player(P3,P4),
  2156.         play_1card([Players,Newhands3,Newplayed3,P4,Newhands,Newplayed,
  2157.         Newhigh3,Newwhohigh3,Newhigh4,Newwhohigh4,
  2158.         Newcards3,Newcards4,Suite]),
  2159.         summary_cards_taken([Players,Taken,Newtaken,Newhigh4,Newwhohigh4,
  2160.         Newcards4,Newleader]).
  2161. play_1card([Players,Newhands1,Newplayed1,P2,Newhands2,Newplayed2,
  2162.         Newhigh1,Newwhohigh1,Newhigh2,Newwhohigh2,
  2163.         Newcards1,Newcards2,Suite]) :-
  2164.         get_hand(Players,Newhands1,P2,H2),
  2165.         H2 = [],!,
  2166.         asserta(is_out(P2)), 
  2167.                 write_bl(P2),
  2168.                 write_nl(is_out),
  2169.         Newhigh2 = Newhigh1,
  2170.         Newhands2 = Newhands1,
  2171.         Newplayed2 = Newplayed1,
  2172.         Newcards2 = Newcards1, 
  2173.         Newwhohigh2 = Newwhohigh1.
  2174. play_1card([Players,Newhands1,Newplayed1,P2,Newhands2,Newplayed2,
  2175.         Newhigh1,Newwhohigh1,Newhigh2,Newwhohigh2,
  2176.         Newcards1,Newcards2,Suite]) :-
  2177.         P2 :\== dennis,
  2178.         get_hand(Players,Newhands1,P2,H2),
  2179.         best_card(Players,P2,H2,Newplayed1,Newtaken1,Newcards1,Card1,
  2180.         Suite,Newhigh1,Newwhohigh1),
  2181.         card(Card1,Val,Suite,Name,Pt_taken,Pt_played),
  2182.         Val > Newhigh1, ! ,
  2183.         write_bl(P2),
  2184.         write_bl(plays),
  2185.         write_nl(Name),
  2186.         delete(Card1,H2,Nh2),
  2187.         Newhigh2 = Val,
  2188.         Newwhohigh2 = P2,
  2189.         put_hand(Players,Newhands1,P2,Nh2,Newhands2),
  2190.         get_hand(Players,Newplayed1,P2,Pl1),
  2191.         Pl2 = [Card1 | Pl1],
  2192.         Newcards2 = [Card1 | Newcards1],
  2193.   %/*      write_bl(newcards2),write_nl(Newcards2), */
  2194.         put_hand(Players,Newplayed1,P2,Pl2,Newplayed2). %/* was , */
  2195.     %/*    write_bl(newplayed2),write_nl(Newplayed2). */
  2196. play_1card([Players,Newhands1,Newplayed1,P2,Newhands2,Newplayed2,
  2197.         Newhigh1,Newwhohigh1,Newhigh2,Newwhohigh2,
  2198.         Newcards1,Newcards2,Suite]) :-
  2199.         P2 :\== dennis,
  2200.         get_hand(Players,Newhands1,P2,H2),
  2201.         best_card(Players,P2,H2,Newplayed1,Newtaken1,Newcards1,Card1,
  2202.         Suite,Newhigh1,Newwhohigh1),
  2203.         card(Card1,Val,Suite,Name,Pt_taken,Pt_played),
  2204.         Val < Newhigh1, ! ,
  2205.         write_bl(P2),
  2206.         write_bl(plays),
  2207.         write_nl(Name),
  2208.         delete(Card1,H2,Nh2),
  2209.         Newhigh2 = Newhigh1,
  2210.         Newwhohigh2 = Newwhohigh1,
  2211.         put_hand(Players,Newhands1,P2,Nh2,Newhands2),
  2212.         get_hand(Players,Newplayed1,P2,Pl1),
  2213.         Pl2 = [Card1 | Pl1],
  2214.         Newcards2 = [Card1 | Newcards1],
  2215.    %/*     write_bl(newcards2),write_nl(Newcards2), */
  2216.         put_hand(Players,Newplayed1,P2,Pl2,Newplayed2). %/* was , */
  2217.    %/*     write_bl(newplayed2),write_nl(Newplayed2). */
  2218. %/* rule repeated 3 times for 3 chances */
  2219. play_1card([Players,Newhands1,Newplayed1,dennis,Newhands2,Newplayed2,
  2220.         Newhigh1,Newwhohigh1,Newhigh2,Newwhohigh2,
  2221.         Newcards1,Newcards2,Suite]) :-
  2222.         get_hand(Players,Newhands1,dennis,H2),
  2223.         write_bl(play),
  2224.         write_bl(what),
  2225.         write_nl(card),
  2226.         read(Name),
  2227.         valid_card(Name,Suite,H2),!,
  2228.         play_1card_b(Players,Newhands1,Newplayed1,dennis,Newhands2,Newplayed2,
  2229.         Newhigh1,Newwhohigh1,Newhigh2,Newwhohigh2,
  2230.         Newcards1,Newcards2,Suite,Name,H2).
  2231. play_1card([Players,Newhands1,Newplayed1,dennis,Newhands2,Newplayed2,
  2232.         Newhigh1,Newwhohigh1,Newhigh2,Newwhohigh2,
  2233.         Newcards1,Newcards2,Suite]) :-
  2234.         get_hand(Players,Newhands1,dennis,H2),
  2235.         write_bl(play),
  2236.         write_bl(what),
  2237.         write_nl(card),
  2238.         read(Name),
  2239.         valid_card(Name,Suite,H2),!,
  2240.         play_1card_b(Players,Newhands1,Newplayed1,dennis,Newhands2,Newplayed2,
  2241.         Newhigh1,Newwhohigh1,Newhigh2,Newwhohigh2,
  2242.         Newcards1,Newcards2,Suite,Name,H2).
  2243. play_1card([Players,Newhands1,Newplayed1,dennis,Newhands2,Newplayed2,
  2244.         Newhigh1,Newwhohigh1,Newhigh2,Newwhohigh2,
  2245.         Newcards1,Newcards2,Suite]) :-
  2246.         get_hand(Players,Newhands1,dennis,H2),
  2247.         write_bl(play),
  2248.         write_bl(what),
  2249.         write_nl(card),
  2250.         read(Name),
  2251.         valid_card(Name,Suite,H2),!,
  2252.         play_1card_b(Players,Newhands1,Newplayed1,dennis,Newhands2,Newplayed2,
  2253.         Newhigh1,Newwhohigh1,Newhigh2,Newwhohigh2,
  2254.         Newcards1,Newcards2,Suite,Name,H2).
  2255.  
  2256. play_1card_b(Players,Newhands1,Newplayed1,dennis,Newhands2,Newplayed2,
  2257.         Newhigh1,Newwhohigh1,Newhigh2,Newwhohigh2,
  2258.         Newcards1,Newcards2,Suite,Name,H2) :-
  2259.         card(Card1,Val,Suite,Name,Pt_taken,Pt_played),
  2260.         Val > Newhigh1, ! ,
  2261.         write_bl(dennis),
  2262.         write_bl(plays),
  2263.         write_nl(Name),
  2264.         delete(Card1,H2,Nh2),
  2265.         Newhigh2 = Val,
  2266.         Newwhohigh2 = dennis,
  2267.         put_hand(Players,Newhands1,dennis,Nh2,Newhands2),
  2268.         get_hand(Players,Newplayed1,dennis,Pl1),
  2269.         Pl2 = [Card1 | Pl1],
  2270.         Newcards2 = [Card1 | Newcards1],
  2271.   %/*      write_bl(newcards2),write_nl(Newcards2), */
  2272.         put_hand(Players,Newplayed1,dennis,Pl2,Newplayed2). %/* was , */
  2273.     %/*    write_bl(newplayed2),write_nl(Newplayed2). */
  2274.         
  2275.  
  2276. play_1card_b(Players,Newhands1,Newplayed1,dennis,Newhands2,Newplayed2,
  2277.         Newhigh1,Newwhohigh1,Newhigh2,Newwhohigh2,
  2278.         Newcards1,Newcards2,Suite,Name,H2) :-
  2279.         card(Card1,Val,Suite,Name,Pt_taken,Pt_played),
  2280.         Val =< Newhigh1, ! ,
  2281.         write_bl(dennis),
  2282.         write_bl(plays),
  2283.         write_nl(Name),
  2284.         delete(Card1,H2,Nh2),
  2285.         Newhigh2 = Newhigh1,
  2286.         Newwhohigh2 = Newwhohigh1,
  2287.         put_hand(Players,Newhands1,dennis,Nh2,Newhands2),
  2288.         get_hand(Players,Newplayed1,dennis,Pl1),
  2289.         Pl2 = [Card1 | Pl1],
  2290.         Newcards2 = [Card1 | Newcards1],
  2291.    %/*     write_bl(newcards2),write_nl(Newcards2), */
  2292.         put_hand(Players,Newplayed1,dennis,Pl2,Newplayed2). %/* was , */
  2293.    %/*     write_bl(newplayed2),write_nl(Newplayed2). */
  2294.  
  2295. summary_cards_taken([Players,Taken,Newtaken,Newhigh4,Newwhohigh4,
  2296.         Newcards4,Newleader]):-
  2297.         get_hand(Players,Taken,Newwhohigh4,H2),
  2298.         append_djd(H2,Newcards4,H3),
  2299.                 write_bl(Newwhohigh4),
  2300.                 write_nl(takes_the_hand),
  2301.         Newleader = Newwhohigh4,
  2302.         put_hand(Players,Taken,Newwhohigh4,H3,Newtaken). %/* was , */
  2303.    %/*     write_bl(newtaken),write_nl(Newtaken). */
  2304. write_nl(X) :- write(X), put(46), put(10), put(13).
  2305. %                write(Log,X), put(Log,46), put(Log,10), put(Log,13).
  2306. write_bl(X) :- write(X), put(32).
  2307. %                 write(Log,X), put(Log,32).
  2308.         
  2309.         
  2310. score(Players,Teams,Played,Taken,Scores,Newscores,Bidder,Bid,Suite) :- 
  2311.         Scores = [S1,S2],
  2312.                 Players = [P1,P2,P3,P4],
  2313.                 get_hand(Players,Taken,P1,Card1s_taken1),
  2314.                 pts_taken(Card1s_taken1,Suite,Score_addt1,0),
  2315.                 get_hand(Players,Played,P1,Card1s_played1),
  2316.                 pts_played(Card1s_played1,Suite,Score_addp1,0),
  2317.                 get_hand(Players,Taken,P2,Card1s_taken2),
  2318.                 pts_taken(Card1s_taken2,Suite,Score_addt2,0),
  2319.                 get_hand(Players,Played,P2,Card1s_played2),
  2320.                 pts_played(Card1s_played2,Suite,Score_addp2,0),
  2321.                 get_hand(Players,Taken,P3,Card1s_taken3),
  2322.                 pts_taken(Card1s_taken3,Suite,Score_addt3,0),
  2323.                 get_hand(Players,Played,P3,Card1s_played3),
  2324.                 pts_played(Card1s_played3,Suite,Score_addp3,0),
  2325.                 get_hand(Players,Taken,P4,Card1s_taken4),
  2326.                 pts_taken(Card1s_taken4,Suite,Score_addt4,0),
  2327.                 get_hand(Players,Played,P4,Card1s_played4),
  2328.                 pts_played(Card1s_played4,Suite,Score_addp4,0),
  2329.                 (Pts1 = Score_addt1 + Score_addp1 + Score_addt3 + 
  2330.                  Score_addp3),
  2331.                 (Pts2 = Score_addt2 + Score_addp2 + Score_addt4 + 
  2332.                 Score_addp4),
  2333.                 Teams = [T1,T2],
  2334.                 member_djd(Bidder,T1),
  2335.                 Pts1 >= Bid, 
  2336.         (S1a = S1 + Pts1),
  2337.         (S2a = S2 + Pts2), 
  2338.         Newscores = [S1a,S2a],
  2339.         write_nl(p_score),
  2340.         write_nl(Teams),
  2341.         write_nl(Scores),
  2342.         write_nl(Newscores).
  2343.  
  2344. score(Players,Teams,Played,Taken,Scores,Newscores,Bidder,Bid,Suite) :- 
  2345.         Scores = [S1,S2],
  2346.                 Players = [P1,P2,P3,P4],
  2347.                 get_hand(Players,Taken,P1,Card1s_taken1),
  2348.                 pts_taken(Card1s_taken1,Suite,Score_addt1,0),
  2349.                 get_hand(Players,Played,P1,Card1s_played1),
  2350.                 pts_played(Card1s_played1,Suite,Score_addp1,0),
  2351.                 get_hand(Players,Taken,P2,Card1s_taken2),
  2352.                 pts_taken(Card1s_taken2,Suite,Score_addt2,0),
  2353.                 get_hand(Players,Played,P2,Card1s_played2),
  2354.                 pts_played(Card1s_played2,Suite,Score_addp2,0),
  2355.                 get_hand(Players,Taken,P3,Card1s_taken3),
  2356.                 pts_taken(Card1s_taken3,Suite,Score_addt3,0),
  2357.                 get_hand(Players,Played,P3,Card1s_played3),
  2358.                 pts_played(Card1s_played3,Suite,Score_addp3,0),
  2359.                 get_hand(Players,Taken,P4,Card1s_taken4),
  2360.                 pts_taken(Card1s_taken4,Suite,Score_addt4,0),
  2361.                 get_hand(Players,Played,P4,Card1s_played4),
  2362.                 pts_played(Card1s_played4,Suite,Score_addp4,0),
  2363.                 (Pts1 = Score_addt1 + Score_addp1 + Score_addt3 + 
  2364.                 Score_addp3),
  2365.                 (Pts2 = Score_addt2 + Score_addp2 + Score_addt4 + 
  2366.                 Score_addp4),
  2367.                 Teams = [T1,T2],
  2368.                 member_djd(Bidder,T2),
  2369.                 Pts2 >= Bid, 
  2370.         (S1a = S1 + Pts1),
  2371.         (S2a = S2 + Pts2), 
  2372.         Newscores = [S1a,S2a],
  2373.         write_nl(p_score),
  2374.         write_nl(Teams),
  2375.         write_nl(Scores),
  2376.         write_nl(Newscores).
  2377.  
  2378. score(Players,Teams,Played,Taken,Scores,Newscores,Bidder,Bid,Suite) :- 
  2379.         Scores = [S1,S2],
  2380.                 Players = [P1,P2,P3,P4],
  2381.                 get_hand(Players,Taken,P1,Card1s_taken1),
  2382.                 pts_taken(Card1s_taken1,Suite,Score_addt1,0),
  2383.                 get_hand(Players,Played,P1,Card1s_played1),
  2384.                 pts_played(Card1s_played1,Suite,Score_addp1,0),
  2385.                 get_hand(Players,Taken,P2,Card1s_taken2),
  2386.                 pts_taken(Card1s_taken2,Suite,Score_addt2,0),
  2387.                 get_hand(Players,Played,P2,Card1s_played2),
  2388.                 pts_played(Card1s_played2,Suite,Score_addp2,0),
  2389.                 get_hand(Players,Taken,P3,Card1s_taken3),
  2390.                 pts_taken(Card1s_taken3,Suite,Score_addt3,0),
  2391.                 get_hand(Players,Played,P3,Card1s_played3),
  2392.                 pts_played(Card1s_played3,Suite,Score_addp3,0),
  2393.                 get_hand(Players,Taken,P4,Card1s_taken4),
  2394.                 pts_taken(Card1s_taken4,Suite,Score_addt4,0),
  2395.                 get_hand(Players,Played,P4,Card1s_played4),
  2396.                 pts_played(Card1s_played4,Suite,Score_addp4,0),
  2397.                 (Pts1 = Score_addt1 + Score_addp1 + Score_addt3 + 
  2398.                 Score_addp3),
  2399.                 (Pts2 = Score_addt2 + Score_addp2 + Score_addt4 + 
  2400.                 Score_addp4),
  2401.                 Teams = [T1,T2],
  2402.                 member_djd(Bidder,T1),
  2403.                 Pts1 < Bid, 
  2404.         (S1a = S1 - Bid),
  2405.         (S2a = S2 + Pts2), 
  2406.         Newscores = [S1a,S2a],
  2407.         write_nl(bidder_went_set),
  2408.         write_nl(p_score),
  2409.         write_nl(Teams),
  2410.         write_nl(Scores),
  2411.         write_nl(Newscores).
  2412.  
  2413. score(Players,Teams,Played,Taken,Scores,Newscores,Bidder,Bid,Suite) :- 
  2414.         Scores = [S1,S2],
  2415.                 Players = [P1,P2,P3,P4],
  2416.                 get_hand(Players,Taken,P1,Card1s_taken1),
  2417.                 pts_taken(Card1s_taken1,Suite,Score_addt1,0),
  2418.                 get_hand(Players,Played,P1,Card1s_played1),
  2419.                 pts_played(Card1s_played1,Suite,Score_addp1,0),
  2420.                 get_hand(Players,Taken,P2,Card1s_taken2),
  2421.                 pts_taken(Card1s_taken2,Suite,Score_addt2,0),
  2422.                 get_hand(Players,Played,P2,Card1s_played2),
  2423.                 pts_played(Card1s_played2,Suite,Score_addp2,0),
  2424.                 get_hand(Players,Taken,P3,Card1s_taken3),
  2425.                 pts_taken(Card1s_taken3,Suite,Score_addt3,0),
  2426.                 get_hand(Players,Played,P3,Card1s_played3),
  2427.                 pts_played(Card1s_played3,Suite,Score_addp3,0),
  2428.                 get_hand(Players,Taken,P4,Card1s_taken4),
  2429.                 pts_taken(Card1s_taken4,Suite,Score_addt4,0),
  2430.                 get_hand(Players,Played,P4,Card1s_played4),
  2431.                 pts_played(Card1s_played4,Suite,Score_addp4,0),
  2432.                 (Pts1 = Score_addt1 + Score_addp1 + Score_addt3 + 
  2433.                 Score_addp3),
  2434.                 (Pts2 = Score_addt2 + Score_addp2 + Score_addt4 + 
  2435.                 Score_addp4),
  2436.                 Teams = [T1,T2],
  2437.                 member_djd(Bidder,T2),
  2438.                 Pts2 < Bid, 
  2439.         (S1a = S1 + Pts1),
  2440.         (S2a = S2 - Bid), 
  2441.         Newscores = [S1a,S2a],
  2442.         write_nl(bidder_went_set),
  2443.         write_nl(p_score),
  2444.         write_nl(Teams),
  2445.         write_nl(Scores),
  2446.         write_nl(Newscores).
  2447.  
  2448. pts_taken(Card1s_taken1,Suite,Score_add1,Temp) :-
  2449.         Card1s_taken1 = [Card1 | Card1s_left],
  2450.     card(Card1,Val,Suite,Name,Pt_taken,Pt_played),
  2451.         (Temp2 = Temp + Pt_taken),
  2452.         pts_taken(Card1s_left,Suite,Score_add1,Temp2).
  2453. pts_taken(Card1s_taken1,Suite,Score_add1,Temp) :-
  2454.         Card1s_taken1 = [], ! ,
  2455.         Score_add1 = Temp.
  2456.         
  2457. pts_played(Card1s_played1,Suite,Score_add1,Temp) :-
  2458.         Card1s_played1 = [Card1 | Card1s_left],
  2459.     card(Card1,Val,Suite,Name,Pt_taken,Pt_played),
  2460.         (Temp2 = Temp + Pt_played),
  2461.         pts_played(Card1s_left,Suite,Score_add1,Temp2).
  2462. pts_played(Card1s_played1,Suite,Score_add1,Temp) :-
  2463.         Card1s_played1 = [], ! ,
  2464.         Score_add1 = Temp.
  2465.  
  2466. %/* lead highest card left */
  2467. best_card(Players,P2,H2,Newplayed1,Newtaken1,Newcards1,Card1,
  2468.     Suite,Newhigh1,Newwhohigh1) :-
  2469.     \+(am_last_to_play(Players,P2,H2,Newplayed1,Newtaken1,Newcards1,
  2470.     Card1,Suite)),
  2471.     have_highest_card_left(Players,P2,H2,Newplayed1,Newtaken1,Newcards1,
  2472.     Cardx,Suite),
  2473.     Card1 = Cardx,
  2474. %/*    write_nl(have_highest_card), */
  2475.     card(Card1,Val,Suite,Name,Pt_taken,Pt_played).
  2476. %/* take point card - last (with smallest card that woll take because arrangeed*/
  2477. best_card(Players,P2,H2,Newplayed1,Newtaken1,Newcards1,Card1,
  2478.     Suite,Newhigh1,Newwhohigh1) :-
  2479.     am_last_to_play(Players,P2,H2,Newplayed1,Newtaken1,Newcards1,
  2480.     Card1,Suite),
  2481.     pt_card_played(Players,P2,H2,Newplayed1,Newtaken1,Newcards1,
  2482.     Cardp,Suite),
  2483.     have_higher_card_left(Players,P2,H2,Newplayed1,Newtaken1,Newcards1,
  2484.     Cardx,Suite),
  2485.     \+(partner(P2,Newwhohigh1)),
  2486.     Card1 = Cardx,
  2487. %/*    write_nl(take_pt_card_last), */
  2488.     card(Card1,Val,Suite,Name,Pt_taken,Pt_played).
  2489. %/* save point cards playing last */
  2490. best_card(Players,P2,H2,Newplayed1,Newtaken1,Newcards1,Card1,
  2491.     Suite,Newhigh1,Newwhohigh1) :-
  2492.     am_last_to_play(Players,P2,H2,Newplayed1,Newtaken1,Newcards1,
  2493.     Card1,Suite),
  2494.     can_save_point(Players,P2,H2,Newplayed1,Newtaken1,Newcards1,
  2495.     Cardx,Suite),
  2496.     Card1 = Cardx,
  2497. %/*    write_nl(can_save_point), */
  2498.     card(Card1,Val,Suite,Name,Pt_taken,Pt_played).
  2499. %/* opponent has played high card - plays small card */
  2500. best_card(Players,P2,H2,Newplayed1,Newtaken1,Newcards1,Card1,
  2501.     Suite,Newhigh1,Newwhohigh1) :-
  2502.     \+(have_highest_card_left(Players,P2,H2,Newplayed1,Newtaken1,Newcards1,
  2503.     Cardw,Suite)),
  2504.     \+(partner(P2,Newwhohigh1)),
  2505.     have_small_card(Players,P2,H2,Newplayed1,Newtaken1,Newcards1,
  2506.     Cardx,Suite),
  2507.     Card1 = Cardx,
  2508.     card(Card1,Val,Suite,Name,Pt_taken,Pt_played).
  2509. %/*    write_nl(play_small_card). */
  2510.     
  2511. %/* partner has played high card - plays point card */
  2512. best_card(Players,P2,H2,Newplayed1,Newtaken1,Newcards1,Card1,
  2513.     Suite,Newhigh1,Newwhohigh1) :-
  2514.     \+(have_highest_card_left(Players,P2,H2,Newplayed1,Newtaken1,Newcards1,
  2515.     Cardw,Suite)),
  2516.     partner(P2,Newwhohigh1),
  2517.     have_point_card(Players,P2,H2,Newplayed1,Newtaken1,Newcards1,
  2518.     Cardx,Suite),
  2519.     Card1 = Cardx,
  2520.     card(Card1,Val,Suite,Name,Pt_taken,Pt_played).
  2521. %/*    write_nl(play_point_card). */
  2522.     
  2523. %/* no special rule applied so play any card */
  2524. best_card(Players,P2,H2,Newplayed1,Newtaken1,Newcards1,Card1,
  2525.     Suite,Newhigh1,Newwhohigh1) :-
  2526.         H2 = [Card1 | H3],
  2527.         card(Card1,Val,Suite,Name,Pt_taken,Pt_played).
  2528.         
  2529. have_highest_card_left(Players,P2,H2,Newplayed1,Newtaken1,Newcards1,
  2530.     Cardx,Suite) :-
  2531.     member_djd(Cardx,H2),
  2532.     card(Cardx,Val,Suite,Name,Pt_taken,Pt_played),
  2533.     \+(exists_higher_card_not_in_list(Newcards1,Suite,Val,Newplayed1)).
  2534. exists_higher_card_not_in_list(Newcards1,Suite,Val,Newplayed1) :-
  2535.     card(Card2,Val2,Suite,Name,Pt_taken,Pt_played),
  2536.     Val2 > Val,
  2537.     \+(sub_member(Card2,Newplayed1,Newcards1)).
  2538. sub_member(Card2,Newplayed1,Newcards1) :-
  2539.     member_djd(Pl,Newplayed1),
  2540.     \+(member_djd(Card2,Newcards1)),
  2541.     member_djd(Card2,Pl).
  2542.  
  2543. point_card_played(Players,P2,H2,Newplayed1,Newtaken1,Newcards1,
  2544.     Card1,Suite) :-
  2545.     member_djd(Card,Newcards1),
  2546.     card(Card,Val,Suite,Name,Pt_taken,Pt_played),
  2547.     Pt_taken > 0.
  2548. am_first_to_play(Players,P2,H2,Newplayed1,Newtaken1,Newcards1,
  2549.     Card1,Suite) :-
  2550.     length_djd(Newcards1,Len),
  2551.     Len = 0.    
  2552. am_last_to_play(Players,P2,H2,Newplayed1,Newtaken1,Newcards1,
  2553.     Card1,Suite) :-
  2554.     length_djd(Newcards1,Len),
  2555.     Len = 3.    
  2556. am_last_to_play(Players,P2,H2,Newplayed1,Newtaken1,Newcards1,
  2557.     Card1,Suite) :-
  2558.     length_djd(Newcards1,Len),
  2559.     succ_player(P2,P3),
  2560.     is_out(P3),
  2561.     Len = 2.    
  2562. am_last_to_play(Players,P2,H2,Newplayed1,Newtaken1,Newcards1,
  2563.     Card1,Suite) :-
  2564.     length_djd(Newcards1,Len),
  2565.     succ_player(P2,P3),
  2566.     is_out(P3),
  2567.     succ_player(P3,P4),
  2568.     is_out(P4),
  2569.     Len = 1.    
  2570. point_card_may_be_played(Players,P2,H2,Newplayed1,Newtaken1,Newcards1,
  2571.     Card1,Suite) :-
  2572.     \+(am_last_to_play(Players,P2,H2,Newplayed1,Newtaken1,Newcards1,
  2573.     Card1,Suite)),
  2574.     card(Card2,Val2,Suite,Name,Pt_taken,Pt_played),
  2575.     Pt_taken > 0,
  2576.     \+(sub_member(Card2,Newplayed1)).
  2577. can_save_point(Players,P2,H2,Newplayed1,Newtaken1,Newcards1,
  2578.     Cardx,Suite) :-
  2579.     am_last_to_play(Players,P2,H2,Newplayed1,Newtaken1,Newcards1,
  2580.     Cardx,Suite),
  2581.     member_djd(Cardx,H2),
  2582.     card(Cardx,Val,Suite,Name,Pt_taken,Pt_played),
  2583.     Pt_taken > 0,
  2584.     \+(exists_higher_card_in_list(Val,Newcards1,Suite)).
  2585. exists_higher_card_in_list(Val,Newcards1,Suite) :-
  2586.     member_djd(Card2,Newcards1),
  2587.     card(Card2,Val2,Suite,Name,Pt_taken,Pt_played),
  2588.     Val2 > Val.
  2589.     
  2590. partner_played_highest_card_so_far(Players,P2,H2,Newplayed1,Newtaken1,
  2591.     Newcards1,Card1,Suite,Newhigh1,Newwhohigh1) :-
  2592.     partner(P2,Newwhohigh1).
  2593.     
  2594. have_small_card(Players,P2,H2,Newplayed1,Newtaken1,Newcards1,
  2595.     Cardx,Suite) :-
  2596.     member_djd(Cardx,H2),
  2597.     card(Cardx,Val,Suite,Name,Pt_taken,Pt_played),
  2598.     Val < 10.
  2599. have_point_card(Players,P2,H2,Newplayed1,Newtaken1,Newcards1,
  2600.     Cardx,Suite) :-
  2601.     member_djd(Cardx,H2),
  2602.     card(Cardx,Val,Suite,Name,Pt_taken,Pt_played),
  2603.     Pt_taken > 0.
  2604.     
  2605.     
  2606. display_hand(H) :-
  2607.     H = [C | H2],
  2608.     card(C,Val,Suite,Name,Pt_taken,Pt_played),!,
  2609.     write_bl(C),
  2610.     write_nl(Name),
  2611.     display_hand(H2).
  2612. display_hand([]).
  2613.  
  2614. pt_card_played(Players,P2,H2,Newplayed1,Newtaken1,Newcards1,
  2615. Cardp,Suite) :-
  2616.     member_djd(Cardp,Newcards1),
  2617.     card(Cardp,Val,Suite,Name,Pt_taken,Pt_played),
  2618.     Pt_taken > 0.
  2619.     
  2620. have_higher_card_left(Players,P2,H2,Newplayed1,Newtaken1,Newcards1,
  2621. Cardx,Suite) :-
  2622.     member_djd(Cardx,H2),
  2623.     card(Cardx,Val,Suite,Name,Pt_taken,Pt_played),
  2624.     \+(exists_higher_card_in_list(Newcards1,Suite,Val)).
  2625.     
  2626. exists_higher_card_in_list(Newcards1,Suite,Val) :-
  2627.     card(Card2,Val2,Suite,Name,Pt_taken,Pt_played),
  2628.     Val2 > Val,
  2629.     member_djd(Card2,Newcards1).
  2630. arrange_by_val(H,Hs,Suite) :-
  2631.     get_vals(H,V,Suite),
  2632.     arrange(V,Vs),
  2633.     get_nos(Vs,Hs,Suite).
  2634. get_vals([],[],Suite).
  2635. get_vals(H,V,Suite) :-
  2636.     H = [No2 | Nos2],
  2637.     card(No2,Val2,Suite,Name2,Pt_taken2,Pt_played2),
  2638.     get_vals(Nos2,Vals2,Suite),
  2639.     V = [Val2 | Vals2].
  2640. get_nos([],[],Suite).
  2641. get_nos(V,H,Suite) :-
  2642.     V = [Val3 | Vals3],
  2643.     card(No3,Val3,Suite,Name3,Pt_taken3,Pt_played3),
  2644.     get_nos(Vals3,Nos3,Suite),
  2645.     H = [No3 | Nos3].
  2646. minimimd(N1,N2,N1) :- N1 =< N2.
  2647. minimimd(N1,N2,N2) :- N2 =< N1.
  2648. can_bid(Guess,Hand,Suite1,Bidder) :-
  2649.     member_djd(S,[diamonds,clubs,spades,hearts]),
  2650.     can_bid_suite(Guess2,Hand,S,Bidder),
  2651.     Suite1 = S,
  2652.     minimimd(7,Guess2,Guess).
  2653. can_bid(0,Hand,0,Bidder).
  2654. bind_cs(0.6,0.04,0.04,1.0,0.2,dennis).
  2655. bind_cs(0.6,0.04,0.04,1.0,0.2,dick).
  2656. bind_cs(0.5,0.05,0.05,1.0,0.2,ruth).
  2657. bind_cs(0.5,0.05,0.05,1.0,0.2,john).
  2658. can_bid_suite(Guess,Hand,Suite1,Bidder) :- 
  2659.     discard_non_suite(Hand,Nh1,[],Handsuite,Suite1),
  2660.     get_vals(Handsuite,Vals,Suite1),
  2661.     no_high_cards(Vals,No_high),
  2662. %/*    write_bl(no_high),write_nl(No_high), */
  2663.     tot_face(Vals,Tot_face),
  2664. %/*    write_bl(no_face),write_nl(Tot_face), */
  2665.     tot_pts(Vals,Tot_pts),
  2666. %/*    write_bl(no_pts),write_nl(Tot_pts), */
  2667.     no_sure(Vals,No_sure),
  2668. %/*    write_bl(no_sure),write_nl(No_sure), */
  2669.     length_djd(Vals,No_cds),
  2670. %/*    write_bl(no_cds),write_nl(No_cds), */
  2671.     bind_cs(C1,C2,C3,C4,C5,Bidder),
  2672.     (Guessf1 = C1 * No_high) ,
  2673.         (Guessf2 = Guessf1 + C2 * Tot_face),
  2674.     (Guessf3 = Guessf2 + C3 * Tot_pts),
  2675.     (Guessf4 = Guessf3 + C4 * No_sure),
  2676.     (Guessf5 = Guessf4 + C5 * No_cds),
  2677.     (Guess = floor(Guessf5)).
  2678.  
  2679. no_high_cards(Vals,6) :-
  2680.     member_djd(17,Vals),
  2681.     member_djd(16,Vals),
  2682.     member_djd(15,Vals),
  2683.     member_djd(14,Vals),
  2684.     member_djd(13,Vals),
  2685.     member_djd(12,Vals),!.
  2686. no_high_cards(Vals,5) :-
  2687.     member_djd(17,Vals),
  2688.     member_djd(16,Vals),
  2689.     member_djd(15,Vals),
  2690.     member_djd(14,Vals),
  2691.     member_djd(13,Vals),!.
  2692. no_high_cards(Vals,4) :-
  2693.     member_djd(17,Vals),
  2694.     member_djd(16,Vals),
  2695.     member_djd(15,Vals),
  2696.     member_djd(14,Vals),!.
  2697. no_high_cards(Vals,3) :-
  2698.     member_djd(17,Vals),
  2699.     member_djd(16,Vals),
  2700.     member_djd(15,Vals),!.
  2701. no_high_cards(Vals,2) :-
  2702.     member_djd(17,Vals),
  2703.     member_djd(16,Vals),!.
  2704. no_high_cards(Vals,1) :-
  2705.     member_djd(17,Vals),!.
  2706. no_high_cards(Vals,0) :-
  2707.     \+(member_djd(17,Vals)),!.
  2708.     
  2709. tot_face([],0). 
  2710. tot_face(Vals,Tot_face) :-
  2711.     Vals = [V1 | Vs],
  2712.     V1 > 10,!,
  2713.     tot_face(Vs,Tot2),
  2714.     (Tot_face = V1 + Tot2). 
  2715. tot_face(Vals,Tot_face) :-
  2716.     Vals = [V1 | Vs],
  2717.     V1 =< 10,!,
  2718.     tot_face(Vs,Tot2),
  2719.     Tot_face = Tot2.
  2720. tot_pts([],0).
  2721. tot_pts(Vals,Tot_pts) :-
  2722.     Vals = [V1 | Vs],
  2723.     V1 > 9,
  2724.     V1 < 14,!,
  2725.     tot_pts(Vs,Tot2),
  2726.     (Tot_pts = V1 + Tot2). 
  2727. tot_pts(Vals,Tot_pts) :-
  2728.     Vals = [V1 | Vs],
  2729.     V1 < 10,!,
  2730.     tot_pts(Vs,Tot2),
  2731.     Tot_pts = Tot2. 
  2732. tot_pts(Vals,Tot_pts) :-
  2733.     Vals = [V1 | Vs],
  2734.     V1 < 10,!,
  2735.     tot_pts(Vs,Tot2),
  2736.     Tot_pts = Tot2. 
  2737. no_sure(Vals,2) :-
  2738.     member_djd(2,Vals),
  2739.     member_djd(17,Vals),!.
  2740. no_sure(Vals,1) :-
  2741.     member_djd(2,Vals),
  2742.     \+(member_djd(17,Vals)),!.
  2743. no_sure(Vals,1) :-
  2744.     \+(member_djd(2,Vals)),
  2745.     member_djd(17,Vals),!.
  2746. no_sure(Vals,0) :-
  2747.     \+(member_djd(2,Vals)),
  2748.     \+(member_djd(17,Vals)),!.
  2749. %trace(true)?
  2750.  
  2751. %play_game(R,S)?
  2752.  
  2753. reset_out(P,H) :-
  2754.     P=[P1,P2,P3,P4],
  2755.     H=[H1,H2,H3,H4],
  2756.     reset(P1,H1),
  2757.     reset(P2,H2),
  2758.     reset(P3,H3),
  2759.     reset(P4,H4).
  2760. arrange([X|Xs],Ys) :-
  2761.    arrange(Xs,Zs), 
  2762.    insert(X,Zs,Ys).
  2763. arrange([],[]).
  2764. insert(X,[],[X]).
  2765. insert(X,[Y|Ys],[Y|Zs]) :- X > Y,
  2766.    insert(X,Ys,Zs).
  2767. insert(X,[Y|Ys],[X|Zs]) :- X =< Y, 
  2768.    insert(Y,Ys,Zs).
  2769.  
  2770. play_game(R,S)?
  2771.