Advertisement
Guest User

Untitled

a guest
Feb 27th, 2023
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.07 KB | None | 0 0
  1. (define "IsFriendlyWorkerAt"
  2. (and
  3. (is Friend (who at:#1 #2))
  4. ("IsPieceAt" "Soldier" Mover #1)
  5. )
  6. )
  7.  
  8. (define "IsFriendlyBaseAt"
  9. (and
  10. (is Friend (who at:#1 #2))
  11. ("IsPieceAt" "Base" Mover #1)
  12. )
  13. )
  14.  
  15. (define "Produce"
  16. (and
  17. (custodial
  18. (from (last To))
  19. (between
  20. (max 1)
  21. if:(is Empty (between))
  22. (apply (add (piece (id "Base" Mover)) (to (between))))
  23. )
  24. (to if:("IsFriendlyWorkerAt" (to)))
  25. )
  26. (custodial
  27. (from (last To))
  28. (between
  29. (max 1)
  30. if:(is Empty (between))
  31. (apply (add (piece (id "Soldier" Mover)) (to (between))))
  32. )
  33. (to if:("IsFriendlyBaseAt" (to)))
  34. )
  35. )
  36. )
  37.  
  38. (define "AheadSite" (ahead (from) #1 (directions Vertex from:(from) to:(to))))
  39.  
  40. (define "AheadSiteList1" { ("AheadSite" steps:1) } )
  41. (define "AheadSiteList2" { ("AheadSite" steps:1) ("AheadSite" steps:2) } )
  42. (define "AheadSiteList3" { ("AheadSite" steps:1) ("AheadSite" steps:2) ("AheadSite" steps:3) } )
  43. (define "AheadSiteList4" { ("AheadSite" steps:1) ("AheadSite" steps:2) ("AheadSite" steps:3) ("AheadSite" steps:4) } )
  44.  
  45. (game "Workers and Soldiers"
  46. (players {(player N) (player S)})
  47. (equipment {
  48. (board (square 6))
  49.  
  50. (piece "Soldier" Each
  51. (or {
  52. (move Hop
  53. All
  54. (between
  55. (max (count Rows))
  56. if:(or {
  57. (is Empty (between))
  58. ("IsPieceAt" "Soldier" Mover (between))
  59. ("IsPieceAt" "Shooter" Mover (between))
  60. } )
  61. )
  62. (to
  63. if:(is Empty (to))
  64. )
  65. (then "Produce")
  66. )
  67. (forEach Direction
  68. All
  69. (if (and (>= (count Pieces Mover in:"AheadSiteList1") 1) (= (count Pieces Next in:"AheadSiteList1") 0)) (move (from (from)) (to if:(is Empty (to)) ("AheadSite" 2))))
  70. )
  71. } )
  72. )
  73. (piece "Shooter" Each
  74. (move Slide
  75. (to
  76. if:(is Enemy (who at:(to)))
  77. (apply (remove (to)))
  78. )
  79. )
  80. )
  81. (piece "Base" Each)
  82. (hand Each size:2)
  83. })
  84. (rules
  85. (start {
  86. (place "Soldier" "Hand" count:2)
  87. })
  88.  
  89. (play
  90. (or
  91. (forEach Piece)
  92. (move
  93. (from (sites Occupied by:Mover container:"Hand"))
  94. (to (sites Empty))
  95. (then "Produce")
  96. )
  97. (then
  98. (if (is Even (count Moves))
  99. (moveAgain)
  100. )
  101. )
  102. )
  103. )
  104.  
  105. (end {
  106. (if (no Moves P1) (result P2 Win))
  107. (if (no Moves P2) (result P1 Win))
  108. })
  109. )
  110. )
  111.  
  112. //------------------------------------------------------------------------------
  113.  
  114. (metadata
  115.  
  116. (info
  117. {
  118. (description "Ultimately originates from Indian Chaturanga, arrived in Western Europe during the Middle Ages as Shatranj. Over several centuries, after seeming experimentation with movement, the adoption of the modern movement of the queen and bishop made chess what it is today. Modern Chess appeared sometimes during the fourteenth or fifteenth Century, when the vizier piece was replaced by the queen. It since has become perhaps the most popular game in the world, with massive international competitions.")
  119. (aliases {"Mad Queen's Chess" "Queen's Chess" "�checs" "Schach" "Ajedrez" "Xadrez" "Scacchi"})
  120. (rules "Played on an 8x8 board with pieces with specialized moves: Pawns (8): can move one space forward; Rooks (2): can move any number of spaces orthogonally; Bishops (2): can move any number of spaces diagonally; Knight (2): moves in any direction, one space orthogonally with one space forward diagonally; Queens (1): can move any number of spaces orthogonally or diagonally; Kings (1): can move one space orthogonally or diagonally. Players capture pieces by moving onto a space occupied by an opponent's piece. Player wins when they capture the other player's king.")
  121. (source "<a href=\"https://en.wikipedia.org/wiki/Rules_of_chess\" target=\"_blank\" class=\"style1\" style=\"color: #0000EE\" />Wikipedia</a>")
  122. (version "1.3.0")
  123. (classification "board/war/replacement/checkmate/chess")
  124. (credit "Eric Piette")
  125. (origin "This game was played in Europe, around 1512.")
  126. }
  127. )
  128.  
  129. (graphics {
  130. (piece Families {"Defined" "Microsoft" "Pragmata" "Symbola"})
  131. (board Style Chess)
  132. })
  133.  
  134. )
  135.  
  136.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement