(define "InitSite" 73)
(define "CentralSite" 2)
(define "FirstSiteBackward" 0)
(define "ThrowValue" (mapEntry "Throw" (count Pips)))
(define "ThrowOf1" (= ("ThrowValue") 1))
(define "ThrowOf2" (= ("ThrowValue") 2))
(define "SiteToMoveOnTrack" ("NextSiteOnTrack" #3 #1 #2))
(define "Untabulate"
(if (is Mover P1)
(forget Value "TabulatedP1" #1)
(if (is Mover P2)
(forget Value "TabulatedP2" #1)
(if (is Mover P3)
(forget Value "TabulatedP3" #1)
(if (is Mover P4)
(forget Value "TabulatedP4" #1)
(if (is Mover P5)
(forget Value "TabulatedP5" #1)
(if (is Mover P6)
(forget Value "TabulatedP6" #1)
(if (is Mover P7)
(forget Value "TabulatedP7" #1)
(forget Value "TabulatedP8" #1)
)
)
)
)
)
)
)
)
(define "Tabulate"
(if (is Mover P1)
(remember Value "TabulatedP1" #1)
(if (is Mover P2)
(remember Value "TabulatedP2" #1)
(if (is Mover P3)
(remember Value "TabulatedP3" #1)
(if (is Mover P4)
(remember Value "TabulatedP4" #1)
(if (is Mover P5)
(remember Value "TabulatedP5" #1)
(if (is Mover P6)
(remember Value "TabulatedP6" #1)
(if (is Mover P7)
(remember Value "TabulatedP7" #1)
(remember Value "TabulatedP8" #1)
)
)
)
)
)
)
)
)
(define "TabulatedValues"
(if (is Mover P1)
(values Remembered "TabulatedP1")
(if (is Mover P2)
(values Remembered "TabulatedP2")
(if (is Mover P3)
(values Remembered "TabulatedP3")
(if (is Mover P4)
(values Remembered "TabulatedP4")
(if (is Mover P5)
(values Remembered "TabulatedP5")
(if (is Mover P6)
(values Remembered "TabulatedP6")
(if (is Mover P7)
(values Remembered "TabulatedP7")
(values Remembered "TabulatedP8")
)
)
)
)
)
)
)
)
(define "AllowToMoveOutFromCentral" (= 4 (state at:(from) level:(level))))
(define "AllowToUseTabulatedToGoCentral"
(and {
(= 0 (state at:(from) level:(level)))
(= (from) ("FirstSiteBackward"))
(is In 1 ("TabulatedValues"))
})
)
(define "HyenaAllowToMoveOutFromCentral"
(= 9 (state at:(where "Hyena" Neutral) level:(where Level "Hyena" Neutral at:(where "Hyena" Neutral))))
)
(define "NextSite" ("NextSiteOnTrack" 1 from:#1 #2))
(define "MoveHyena"
(if (= (where "Hyena" Neutral) ("CentralSite"))
(if ("HyenaAllowToMoveOutFromCentral")
(move
(from (where "Hyena" Neutral) level:(where Level "Hyena" Neutral at:(where "Hyena" Neutral)))
(to ("FirstSiteBackward"))
)
(if ("ThrowOf1")
(move Select
(from (where "Hyena" Neutral) level:(where Level "Hyena" Neutral at:(where "Hyena" Neutral)))
(then (set State at:(last To) level:(last LevelTo) (+ 1 (state at:(last To) level:(last LevelTo)))))
)
(if (is In 1 ("TabulatedValues"))
(move Select
(from (where "Hyena" Neutral) level:(where Level "Hyena" Neutral at:(where "Hyena" Neutral)))
(then (and
(set State at:(last To) level:(last LevelTo) (+ 1 (state at:(last To) level:(last LevelTo))))
("Untabulate" 1)
)
)
)
)
)
)
(if (= 0 (state at:(where "Hyena" Neutral) level:(where Level "Hyena" Neutral at:(where "Hyena" Neutral))))
(or {
(if ("ThrowOf1")
(move Pass
(then ("Tabulate" ("ThrowValue")))
)
)
(move
(from (where "Hyena" Neutral) level:(where Level "Hyena" Neutral at:(where "Hyena" Neutral)))
(to
("SiteToMoveOnTrack" from:(where "Hyena" Neutral) "Track" (* 2 ("ThrowValue")))
)
)
(if (is In 1 ("TabulatedValues"))
(move
(from (where "Hyena" Neutral) level:(where Level "Hyena" Neutral at:(where "Hyena" Neutral)))
(to
("SiteToMoveOnTrack" from:(where "Hyena" Neutral) "Track" 1)
)
(then ("Untabulate" 1))
)
)
})
(or
(move
(from (where "Hyena" Neutral) level:(where Level "Hyena" Neutral at:(where "Hyena" Neutral)))
(to
("SiteToMoveOnTrack" from:(where "Hyena" Neutral) "ReverseTrack" (* 2 ("ThrowValue")))
)
(then
(forEach Site (sites Track "ReverseTrack" from:(last From) to:("SiteToMoveOnTrack" from:(last From) "ReverseTrack" (- (* 2 ("ThrowValue")) 1)))
(forEach Level (site) FromTop
(remove (site) level:(level))
)
)
)
)
(if (is In 1 ("TabulatedValues"))
(move
(from (where "Hyena" Neutral) level:(where Level "Hyena" Neutral at:(where "Hyena" Neutral)))
(to
("SiteToMoveOnTrack" from:(where "Hyena" Neutral) "ReverseTrack" 1)
)
(then (and
("Untabulate" 1)
(forEach Level (last From) FromTop
(remove (last From) level:(level))
)
)
)
)
)
)
)
)
)
(define "WinningCommonCondition"
(and {
(if (!= ("InitSite") (where "Hyena" Neutral)) ("IsSingletonStack" (where "Hyena" Neutral)) True)
("IsNotOffBoard" (where "Hyena" Neutral))
(all Sites (sites Occupied by:All top:False) if:(is In (site) (union (sites Hand Shared) (sites {("InitSite") (where "Hyena" Neutral)}))))
})
)
(define "NoStick" (= 0 (count Sites in:(sites Occupied by:#1 top:False))))
//------------------------------------------------------------------------------
(game "Li'b el-Merafib"
(players )
(equipment {
(board
(merge {
(shift 4 4 (rectangle 2 1))
(shift 4 4 (rectangle 1 4))
(shift 7 4 (rectangle 4 1))
(shift 2 7 (rectangle 1 6))
(shift 2 2 (rectangle 6 1))
(shift 2 2 (rectangle 1 8))
(shift 9 2 (rectangle 8 1))
(shift 0 9 (rectangle 1 10))
(rectangle 10 1)
(rectangle 1 12)
(shift 11 0 (rectangle 12 1))
(shift 0 11 (rectangle 1 12))
})
{
(track "Track" "73,E,S,W,N,E,S,W,N,E,S,W,N" directed:True)
(track "ReverseTrack" "0,E,N,W,S,E,N,W,S,E,N,W" directed:True)
}
)
("StickDice" 3)
(piece "Stick" Each
(if (= (from) ("CentralSite"))
(if ("AllowToMoveOutFromCentral")
(move
(from (from) level:(level))
(to ("FirstSiteBackward"))
)
(if ("ThrowOf1")
(move Select
(from (from) level:(level))
(then (set State at:(last To) level:(last LevelTo) (+ 1 (state at:(last To) level:(last LevelTo)))))
)
(if (is In 1 ("TabulatedValues"))
(move Select
(from (from) level:(level))
(then (and
(set State at:(last To) level:(last LevelTo) (+ 1 (state at:(last To) level:(last LevelTo))))
("Untabulate" 1)
)
)
)
)
)
)
(if ("AllowToUseTabulatedToGoCentral")
(move
(from (from) level:(level))
(to ("CentralSite"))
(then ("Untabulate" 1))
)
(if (= (from) ("InitSite"))
(move
(from (from) level:(level)
if:("ThrowOf1")
)
(to
("SiteToMoveOnTrack" from:(from) "Track" ("ThrowValue"))
)
)
(if (= 0 (state at:(from) level:(level)))
(if (not ("ThrowOf1"))
(move
(from (from) level:(level))
(to
("SiteToMoveOnTrack" from:(from) "Track" ("ThrowValue"))
)
)
(move Pass
(then ("Tabulate" ("ThrowValue")))
)
)
(or
(move
(from (from) level:(level))
(to
("SiteToMoveOnTrack" from:(from) "ReverseTrack" ("ThrowValue"))
)
(then
(if (= (last To) ("InitSite"))
(if ("IsOffBoard" (where "Hyena" Neutral))
(add (piece (id "Hyena" Neutral)) (to (last To)))
)
)
)
)
(if ("ThrowOf1")
(move Pass
(then ("Tabulate" ("ThrowValue")))
)
)
)
)
)
)
)
)
(piece "Hyena" Neutral maxState:10)
(map "Throw" {(pair 0 6) (pair 1 1) (pair 2 2) (pair 3 4)})
})
(rules
(start {
})
(play
("RollMove"
(if (and (= ("InitSite") (where "Stick" Mover)) (!= 0 (state at:(where "Stick" Mover) level:(where Level "Stick" Mover at:(where "Stick" Mover)))))
("MoveHyena")
(forEach Piece)
)
(then
(if (not ("ThrowOf2"))
(moveAgain)
)
)
)
)
(end {
(forEach Player
if:("NoStick" Player)
(result Player Loss)
)
(forEach Player
if:("WinningCommonCondition")
(result Player Win)
)
})
)
)
//------------------------------------------------------------------------------
(option "Players" args:{ }
{
(item "2" <2>
<
(place Stack items:{"Stick2" "Stick1"} "InitSite")
>
"The game has 2 players.")
(item "3" <3>
<
(place Stack items:{"Stick3" "Stick2" "Stick1"} "InitSite")
>
"The game has 3 players.")
(item "4" <4>
<
(place Stack items:{"Stick4" "Stick3" "Stick2" "Stick1"} "InitSite")
>
"The game has 4 players.")*
(item "5" <5>
<
(place Stack items:{"Stick5" "Stick4" "Stick3" "Stick2" "Stick1"} "InitSite")
>
"The game has 5 players.")
(item "6" <6>
<
(place Stack items:{"Stick6" "Stick5" "Stick4" "Stick3" "Stick2" "Stick1"} "InitSite")
>
"The game has 6 players.")
(item "7" <7>
<
(place Stack items:{"Stick7" "Stick6" "Stick5" "Stick4" "Stick3" "Stick2" "Stick1"} "InitSite")
>
"The game has 7 players.")
(item "8" <8>
<
(place Stack items:{"Stick8" "Stick7" "Stick6" "Stick5" "Stick4" "Stick3" "Stick2" "Stick1"} "InitSite")
>
"The game has 8 players.")
})
//------------------------------------------------------------------------------
(rulesets {
(ruleset "Ruleset/Li'b el-Merafib (Described)" {
"Players/4"
}
variations:{"Players/2" "Players/3" "Players/5" "Players/6" "Players/7" "Players/8"}
)*
})
//------------------------------------------------------------------------------
(metadata
(info
{
(description "Li'b el-Merafib is a race game played by the Kababish people of Sudan. The pieces represent the players' mothers, traveling from their home village to a well to get water, and they have to race home to avoid being eaten by the hyena, which eliminates players it overtakes.")
(aliases {"Hyena Game"})
(rules "The board is a square spiral of any number of spaces. Each player begins with one piece. Three casting sticks, each with a round and a flat side, are used as dice. The throws are as follows: One flat side up = 1; two flat sides up = 2; three flat sides up = 4, zero flat sides up = 6. The pieces begin on the outer end of the track, and must throw a 1 to begin play. Once a player has left the starting spot, they move according to the throws, except on throws of 1, which are tabulated for use later. Players continue to throw until they throw 2. Players must land on the last space of the track, I.e. at the center of the spiral, by an exact throw. The player must then roll 1 five times before leaving this space and proceeding back to the starting point. Accumulated rolls of 1 may be used for this. The first player to reach the starting space by an exact throw releases the hyena. The hyena proceeds along the track in the same manner, but moving twice the value of each throw. When the hyena reaches the end of the track, it must throw or pay 1 ten times. The hyena captures any piece it overtakes on the return to the starting space, eliminating that player from the game.")
(source "Davies 1925: 145-146.")
(id "179")
(version "1.3.7")
(classification "board/race/reach")
(credit "Eric Piette")
(origin "This game was played in Sudan, around 1925.")
}
)
(graphics {
(board Colour Phase0 (colour 223 178 110))
(board Colour InnerEdges (colour Black))
(board Colour OuterEdges (colour Black))
(stackType 0 Ground)
(piece Scale "Stick" 0.5)
(piece Scale "Hyena" 0.75)
(piece Rename piece:"Hyena" "Marker")
(player Colour Neutral (colour Black))
})
)