For a while I’d go from class to class with a deck of cards in my pocket, aces through fours on top. During the five minutes between, when us students were anxiously stirring in their seats, I’d get whoever was sitting next to me to play a game I’d learned as “Anxiety.” You lay all the cards out visible at the beginning, then whoever goes first has to put the ace of spades off to the side, and choose the card the next player has to lay down. Play carries on like that, and eventually a 4x4 grid forms (it’s illegal to break out of the grid once it exists). The winner is whoever forms a line of four cards which share an attribute: Odd/Even, Black/Red, Small/Large, or Sharp On Top/Dull On Top.

This game exists in Ludii! It’s called Quarto, and it uses pieces instead of cards. Nevertheless, I used it as a base for the Nigérien trick-taking card game Agram. As best I can tell, this is the first card game to be implemented in this language. There are six cards dealt to each player up top, biggest number that follows suit wins.

	(game "Agram"
		(players 2)
		(equipment {
			(board (rectangle 2 1) use:Vertex)
			(piece "Square" Each)
			(hand Each size:6)
			(map "Entry" {(pair P1 "A2") (pair P2 "A1")})
		})
		(rules 
		
			(start {
				(place "Square1" (handSite P1   ) state:3 value:(*    (value Random (range 2 3)) 2))
				(place "Square1" (handSite P1  1) state:2 value:(*    (value Random (range 0 1)) 2))
				(place "Square1" (handSite P1  2) state:1 value:(*    (value Random (range 0 4)) 2))
				(place "Square1" (handSite P1  3) state:0 value:(*    (value Random (range 0 4)) 2))
				(place "Square1" (handSite P1  4) state:3 value:(*    (value Random (range 0 1)) 2))
				(place "Square1" (handSite P1  5) state:2 value:(*    (value Random (range 2 4)) 2))
				(place "Square2" (handSite P2   ) state:1 value:(+ (* (value Random (range 2 3)) 2) 1))
				(place "Square2" (handSite P2  1) state:0 value:(+ (* (value Random (range 0 1)) 2) 1))
				(place "Square2" (handSite P2  2) state:3 value:(+ (* (value Random (range 0 3)) 2) 1))
				(place "Square2" (handSite P2  3) state:2 value:(+ (* (value Random (range 0 3)) 2) 1))
				(place "Square2" (handSite P2  4) state:1 value:(+ (* (value Random (range 0 1)) 2) 1))
				(place "Square2" (handSite P2  5) state:0 value:(+ (* (value Random (range 2 3)) 2) 1))
				(set Hidden State (sites Hand P1) to:P2)
				(set Hidden Value (sites Hand P1) to:P2)
				(set Hidden State (sites Hand P2) to:P1)
				(set Hidden Value (sites Hand P2) to:P1)			
			}      )
			
			phases:{
			(phase "Lead" 
				(play 
					(move  
						(from (sites Hand Mover))
						(to (mapEntry (mover)))
						(then (set Score Mover (+ (value Piece at:(mapEntry (mover))) 1) (then (set Hidden Value at:(mapEntry (mover)) False to:Next (then (set Hidden State at:(mapEntry (mover)) False to:Next)))))))
				) (nextPhase "Follow")
			)			
			(phase "Follow" 
				(play 
					(priority {
							(move
								(from (sites Hand Mover))
								(to (mapEntry (mover)) if:(= (state at:(mapEntry (prev))) (state at:(from))))
								(then (set Score Mover (+ (value Piece at:(mapEntry (mover))) 1) (then (set Hidden Value at:(mapEntry (mover)) False to:Next (then (set Hidden State at:(mapEntry (mover)) False to:Next)))))))
							(move  
								(from (sites Hand Mover))
								(to (mapEntry (mover)))
								(then (set Score Mover 0 (then (set Hidden Value at:(mapEntry (mover)) False to:Next (then (set Hidden State at:(mapEntry (mover)) False to:Next)))))))}
						(then 
								(if (> (score P1) (score P2))
									(set NextPlayer (player 1))
									(set NextPlayer (player 2)))))
				) (end {(if ("HandEmpty" Mover) (result Next Win))}) 
				(nextPhase "Lead")
			)
			
				}
		))
			
		
		
		//------------------------------------------------------------------------------
		
	(metadata 
		
		(info
			{
			(description "Agram is a trick-taking card game popular in Niger and Mali.")
			(rules "Players are dealt six cards at the beginning, and then must play six tricks, following the suit of the lead if possible. The biggest number wins, if it follows suit. The overall winner is the winner of the final trick.")
			(id "1536")
			(source "<a href=\"https://www.pagat.com/last/agram.html\" target=\"_blank\" class=\"style1\" style=\"color: #0000EE\" />Pagat</a>")
			(version "1.3.11")
			(classification "experimental")
			(author "Unknown")
			(publisher "<a href=\"https://www.pagat.com/last/agram.html\" target=\"_blank\" class=\"style1\" style=\"color: #0000EE\" />Pagat</a> (used without permission)")
			(credit "Noah Morris")
			(date "2023")
			}
		)
		
				(graphics {
					(piece Foreground state:0 image:"Heart" fillColour:(colour Red)    edgeColour:(colour Red)   scale:1)
					(piece Foreground state:1 image:"Cross" fillColour:(colour Red)    edgeColour:(colour Red)   scale:1)
					(piece Foreground state:2 image:"Star"  fillColour:(colour Yellow) edgeColour:(colour Yellow) scale:1)
					(piece Foreground state:3 image:"Moon"  fillColour:(colour Yellow) edgeColour:(colour Yellow) scale:1)
					(piece Foreground value:0 image:"3"     fillColour:(colour Hidden) edgeColour:(colour Blue) scale:0.4)
					(piece Foreground value:1 image:"4"     fillColour:(colour Hidden) edgeColour:(colour Blue) scale:0.4)
					(piece Foreground value:2 image:"5"     fillColour:(colour Hidden) edgeColour:(colour Blue) scale:0.4)
					(piece Foreground value:3 image:"6"     fillColour:(colour Hidden) edgeColour:(colour Blue) scale:0.4)
					(piece Foreground value:4 image:"7"     fillColour:(colour Hidden) edgeColour:(colour Blue) scale:0.4)
					(piece Foreground value:5 image:"8"     fillColour:(colour Hidden) edgeColour:(colour Blue) scale:0.4)
					(piece Foreground value:6 image:"9"     fillColour:(colour Hidden) edgeColour:(colour Blue) scale:0.4)
					(piece Foreground value:7 image:"X"     fillColour:(colour Hidden) edgeColour:(colour Blue) scale:0.4)
					(piece Foreground value:8 image:"A"     fillColour:(colour Hidden) edgeColour:(colour Blue) scale:0.4)
					(show Edges Hidden)
					(show Symbol "Hexagon" (sites Board) fillColour:(colour 185 130 85) edgeColour:(colour 225 182 130)) 
					(board Placement scale:0.8)
					(board Background image:"square.svg" fillColour:(colour 185 130 85) edgeColour:(colour 185 130 85) scale:1.45)
				})
		
		(ai
			"Agram_ai"
		)
	)