Advertisement
Guest User

Untitled

a guest
Jul 1st, 2015
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.50 KB | None | 0 0
  1. ;==== ADDITIONALS ===
  2.  
  3. ;(defrule rollRandom
  4. ; (initial-fact)
  5. ; =>
  6. ; (bind ?roll1 (random 1 6))
  7. ; (bind ?roll2 (random 1 6))
  8. ;(printout t "Wylosowano: " ?roll1 " oraz " ?roll2 crlf)
  9. ;)
  10.  
  11. ;(defrule printAreas
  12. ; (fieldType (coordX ?coordX)(coordY ?coordY)(index ?index)(category ?category)(playerType ?playerType))
  13. ; (or(and(test (eq ?category playera))(test (eq ?playerType playera)))(and(test (eq ?category playerb))(test (eq ?playerType playerb))))
  14. ;=>
  15. ; (if (eq ?playerType playera) then (bind ?indexField ?index)(printout t "Player A - bind index" crlf))
  16. ; (if (eq ?playerType playerb) then (bind ?indexField ?index)(printout t "Player B - bind index" crlf))
  17. ; (assert (pI(indexField ?indexField)))
  18. ;)
  19.  
  20.  
  21. ;============================================================
  22. ;=================== PROCESS DATA ===========================
  23.  
  24. (defrule freeField
  25. (AIFields
  26. (coordX ?coordX)
  27. (coordY ?coordY)
  28. (index ?index)
  29. (iloscWoja ?iloscWoja)
  30.  
  31. (neighbour0coordX ?neighbour0coordX)
  32. (neighbour0coordY ?neighbour0coordY)
  33. (neighbour0index ?index0)
  34. (neighbour0field ?neighbour0field)
  35. (neighbour0iloscWoja ?wojo0)
  36. )
  37. (test (eq ?neighbour0field none))
  38. (test (> ?iloscWoja 2))
  39. =>
  40. (printout t "EmptyField indexAI" ?index " indexEnemy " ?index0 " iloscWoja " ?iloscWoja crlf)
  41. (assert (EmptyField(indexAI ?index)(indexEnemy ?index0)(iloscWoja ?iloscWoja)))
  42. )
  43.  
  44. (defrule ownField
  45. (AIFields
  46. (coordX ?coordX)
  47. (coordY ?coordY)
  48. (index ?index)
  49. (iloscWoja ?iloscWoja)
  50.  
  51. (neighbour0coordX ?neighbour0coordX)
  52. (neighbour0coordY ?neighbour0coordY)
  53. (neighbour0index ?index0)
  54. (neighbour0field ?neighbour0field)
  55. (neighbour0iloscWoja ?wojo0)
  56. )
  57. (test (eq ?neighbour0field player))
  58. =>
  59. (printout t "PlayerField indexAI" ?index " indexEnemy " ?index0 " iloscWoja " ?iloscWoja crlf)
  60. (assert (PlayerField(indexAI ?index)(indexEnemy ?index0)(iloscWoja ?iloscWoja)))
  61. )
  62.  
  63. (defrule enemyField
  64. (AIFields
  65. (coordX ?coordX)
  66. (coordY ?coordY)
  67. (index ?index)
  68. (iloscWoja ?iloscWoja)
  69.  
  70. (neighbour0coordX ?neighbour0coordX)
  71. (neighbour0coordY ?neighbour0coordY)
  72. (neighbour0index ?index0)
  73. (neighbour0field ?neighbour0field)
  74. (neighbour0iloscWoja ?wojo0)
  75. )
  76. (test (eq ?neighbour0field enemy))
  77. =>
  78. (bind ?diference (- ?iloscWoja ?wojo0))
  79. (printout t "EnemyField indexAI" ?index " indexEnemy " ?index0 " iloscWoja " ?iloscWoja crlf)
  80. (assert (EnemyField(indexAI ?index)(indexEnemy ?index0)(iloscWoja ?difference)))
  81. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement