(define "Columns" ) (define "MoveAgainAfterCapture" (and (is Pending) ("SameTurn"))) (define "StylizedMove" (if (is Mover P1) (difference (expand (intersection (sites Row 1) (sites Left)) steps:2 E) (expand (intersection (sites Row 1) (sites Left)) steps:1 E) ) (difference (expand (intersection (sites Row 2) (sites Right)) steps:2 W) (expand (intersection (sites Row 2) (sites Right)) steps:1 W) ) ) ) (define "Sow" (then (sow "Track" owner:(mover) apply:(if (> (count at:(to)) 1) (moveAgain) (if (is In (to) (sites Mover "Inner")) (and { (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to)) ) (if (> (count at:("OppositePit" (to))) 0) (fromTo (from ("OppositePit" (to))) (to (handSite Mover)) count:(count at:("OppositePit" (to))) ) ) (if (> (count at:("OppositeOuterPit" (to))) 0) (fromTo (from ("OppositeOuterPit" (to))) (to (handSite Mover)) count:(count at:("OppositeOuterPit" (to))) ) ) (set Pending) // We indicate we can capture again in pending the next state. (moveAgain) } ) ) ) ) ) ) (define "PiecesOwnedBy" (+ (count Cell at:(handSite #1)) (count in:(sites #1 "Home")))) //------------------------------------------------------------------------------ (game "Mefuvha" (players 2) (equipment { (mancalaBoard 4 "Columns" store:None { (track "Track1" "0,E,N1,W" loop:True P1) (track "Track2" loop:True P2) } ) (regions "Home" P1 (sites Track "Track1")) // P1 Home (regions "Home" P2 (sites Track "Track2")) // P2 home (regions "Inner" P1 (difference (sites Track "Track1") (sites Bottom))) // P1 inner Home (regions "Inner" P2 (difference (sites Track "Track2") (sites Top))) // P2 inner Home (piece "Seed" Shared) (hand Each) }) (rules (start { (set Count 2 to:(difference (union (sites P1 "Home") (sites P2 "Home")) (union (expand (intersection (sites Row 1) (sites Left)) steps:1 E) (expand (intersection (sites Row 2) (sites Right)) steps:1 W) ) ) ) (set Count 1 to:(union (difference (expand (intersection (sites Row 1) (sites Left)) steps:1 E) (sites Left)) (difference (expand (intersection (sites Row 2) (sites Right)) steps:1 W) (sites Right)) ) ) }) (play (if "MoveAgainAfterCapture" (move Select (from (sites Next "Home") if:(> (count at:(from)) 0)) (then (fromTo (from (last From)) (to (handSite Mover)) count:(count at:(last From)) ) ) ) (priority (move Select (from (if ("SameTurn") "LastHoleSowed" (if (< (count Turns) 3) "StylizedMove" (sites Mover "Home") ) ) if:(> (count at:(from)) 1) ) "Sow" ) (move Select (from (if ("SameTurn") "LastHoleSowed" (sites Mover "Home") ) if:(= (count at:(from)) 1) ) "Sow" ) ) ) ) (end ("MancalaByScoreWhen" (no Moves Mover))) ) ) //------------------------------------------------------------------------------ (option "Board Size" args:{ } { (item "6" <6> <"12,E,N1,W"> "Each player has 6 holes per row.") (item "8" <8> <"16,E,N1,W"> "Each player has 8 holes per row.") (item "10" <10> <"20,E,N1,W"> "Each player has 10 holes per row.") (item "12" <12> <"24,E,N1,W"> "Each player has 12 holes per row.") (item "14" <14> <"28,E,N1,W"> "Each player has 14 holes per row.") (item "16" <16> <"32,E,N1,W"> "Each player has 16 holes per row.")* (item "18" <18> <"36,E,N1,W"> "Each player has 18 holes per row.") (item "20" <20> <"40,E,N1,W"> "Each player has 20 holes per row.") (item "22" <22> <"44,E,N1,W"> "Each player has 22 holes per row.") (item "24" <24> <"48,E,N1,W"> "Each player has 24 holes per row.") (item "26" <26> <"52,E,N1,W"> "Each player has 26 holes per row.") (item "28" <28> <"56,E,N1,W"> "Each player has 28 holes per row.") }) //------------------------------------------------------------------------------ (rulesets { (ruleset "Ruleset/Venda (Observed)" { "Board Size/16" } variations:{"Board Size/6" "Board Size/8" "Board Size/10" "Board Size/12" "Board Size/14" "Board Size/18" "Board Size/20" "Board Size/22" "Board Size/24" "Board Size/26" "Board Size/28" } )* }) //------------------------------------------------------------------------------ (metadata (info { (description "Mefuhva is a four-row mancala-style board game played by the Venda people in South Africa. It is played by men on large boards or in hollows dug into the ground.") (rules "4x6-28 board; 16-20 is most common, only even numbers of holes. Two counters in each hole except the leftmost on the inner row, which is left empty, and the one to its right which contains one counter. Players sow by picking up the counters in any of their holes and sowing them in an anti-clockwise direction. Sowing continues when the last counter falls into an occupied hole by picking up the counters in that hole and continuing in the same direction. When the final counter lands in an empty hole in the inner row, the counters in the opponent's hole opposite in the inner row are captured; if there are also counters in the opponent's outer row opposite, these are also captured. The player is also entitled to capture counters in any other hole on the opponent's side. The turn ends with a capture and the opponent's turn begins. Play always begins with a stylized move, where the counters are taken from the third hole from the left in the inner row, sowing and making captures as described above. Players may not sow single counters unless there are no holes on their side containing multiple counters. Play ends when one player has captured all of their opponent's counters.") (source "Stayt 1931: 364-366.") (id "187") (version "1.3.12") (classification "board/sow/four rows") (credit "Eric Piette") (origin "This game was played in South Africa, around 1931.") } ) (graphics { (board Style Mancala) }) (ai "Mefuvha_ai" ) )