{(display:"Setup")
(set:$numbers to (a:"Two","Three","Four","Five","Six","Seven","Eight","Nine","Ten","Jack","Queen","King","Ace"))
(set:$hearts to (altered: _number via _number + " of Hearts", ...$numbers))
(set:$spades to (altered: _number via _number + " of Spades", ...$numbers))
(set:$clubs to (altered: _number via _number + " of Clubs", ...$numbers))
(set:$diamonds to (altered: _number via _number + " of Diamonds", ...$numbers))
(set:$deck to (a:...$hearts)+(a:...$spades)+(a:...$clubs)+(a:...$diamonds))
(set:$values to (range:2,14))
(set:$values to (a:...$values)+(a:...$values)+(a:...$values)+(a:...$values))
(set:$valuesData to (interlaced:$deck,$values))}
(print:$valuesData)
(goto:"Deal"){(set:$deck to (shuffled: ...$deck))
(set:$hand1 to (sorted:$deck's 1st, $deck's 2nd, $deck's 3rd, $deck's 4th))
(set:$hand2 to (a:$deck's 5th, $deck's 6th, $deck's 7th, $deck's 8th))
(set:$hand3 to (a:$deck's 9th, $deck's 10th, $deck's 11th, $deck's 12th))}
(goto:"Bid"){(set:$trumps to (either:"Hearts","Diamonds","Clubs","Spades"))
}(print: $hand1.join("
"))
0 (link:"Specialism")[(set:$bid to 0)(set:$move to $classMove)(goto:"First Trick")]
1 (link:"Hold")[(set:$bid to 1)(set:$move to "hold")(goto:"First Trick")]
2 (link:"Attack")[(set:$bid to 2)(set:$move to "attack a foe")(goto:"First Trick")]
3 (link:"Protect")[(set:$bid to 3)(set:$move to "protect an ally")(goto:"First Trick")]
4 (link:"Enchant")[(set:$bid to 4)(set:$move to "cast an enchantment")(goto:"First Trick")]
$trumps are trumps.{(display:"Friends Bid")
(display:"First Card Down")}{(set:$cardDown to 1st of $hand2)
(move:$hand2's 1st into $dealtCard)
(set:$trick to $trick + (a:$dealtCard))
(display:"Translate to Values")}{(set:$secondHandName to "Ru")
(set:$thirdHandName to "Raven")
(set:$classMove to (either:"cast an enchantment","protect an ally","attack a foe"))
(set: $bid to 0)
(set: $secondHandBid to 0)
(set: $thirdHandBid to 0)
(set: $cardValue to 0)
(set: $cardDown to "")
(set: $secondHandString to "")
(set: $thirdHandString to "")}{(set:$cardDown to 1st of $hand3)
(move:$hand3's 1st into $dealtCard)
(set:$trick to $trick + (a:$dealtCard))
(display:"Translate to Values")}{(set: $cardValue to $cardDown of (dm: ...$valuesData))
(if:$trumps is in $cardDown)[(set:$cardValue to it+20)](else:)[(if:not($leadSuit is in $cardDown))[(set:$cardValue to $cardValue-20)]]
}{(if:"Hearts" is in $cardDown)[(set:$leadSuit to "Hearts")]
(if:"Clubs" is in $cardDown)[(set:$leadSuit to "Clubs")]
(if:"Spades" is in $cardDown)[(set:$leadSuit to "Spades")]
(if:"Diamonds" is in $cardDown)[(set:$leadSuit to "Diamonds")]}{(set:$lead to it+1)
(if:$lead is 4)[(set:$lead to 1)]
(set:$trick to (a:))
(display:"Second Hand Plays")
(display:"Establish Lead Suit")
}To $move, take $bid (if:$bid is 1)[trick](else:)[tricks].
$secondHandName plays $cardDown. (Its value is $cardValue). (display:"Third Hand Plays") $thirdHandName plays $cardDown. (Its value is $cardValue). The trick contains: (print:$trick.join(", ")).
The lead suit is $leadSuit and $trumps are trumps.
$secondHandName has bid to take $secondHandBid (they have (print:$hand2.join(", "))).
$thirdHandName has bid to take $thirdHandBid (they have (print:$hand3.join(", "))).{(set:$secondHandString to (text:...$hand2))
(set:$thirdHandString to (text:...$hand3))
(set:$secondHandBid to (random:1,2))
(if:$secondHandString contains $trumps)[(set:$secondHandBid to $secondHandBid+1)]
(if:$secondHandString contains "Ace")[(set:$secondHandBid to $secondHandBid+1)]
(if:$secondHandString contains "King")[(set:$secondHandBid to $secondHandBid+1)]
(if:$secondHandString contains "Queen")[(set:$secondHandBid to $secondHandBid+1)]
(unless:$leadSuit is in $secondHandString)[(set:$secondHandBid to $secondHandBid-1)]
(if:$secondHandString contains "Two")[(set:$secondHandBid to $secondHandBid-1)]
(if:$secondHandString contains "Three")[(set:$secondHandBid to $secondHandBid-1)]
(if:$secondHandString contains "Four")[(set:$secondHandBid to $secondHandBid-1)]
(if:$secondHandBid>4)[(set:$secondHandBid to 4)]
(if:$secondHandBid<0)[(set:$secondHandBid to 0)]
(set:$thirdHandBid to 4-$bid-$secondHandBid)
(if:$thirdHandString contains $trumps)[(set:$thirdHandBid to $thirdHandBid+1)]
(if:$thirdHandString contains "Ace")[(set:$thirdHandBid to $thirdHandBid+1)]
(if:$thirdHandString contains "King")[(set:$thirdHandBid to $thirdHandBid+1)]
(if:$thirdHandString contains "Queen")[(set:$thirdHandBid to $thirdHandBid+1)]
(unless:$leadSuit is in $thirdHandString)[(set:$thirdHandBid to $thirdHandBid-1)]
(if:$thirdHandString contains "Two")[(set:$thirdHandBid to $thirdHandBid-1)]
(if:$thirdHandString contains "Three")[(set:$thirdHandBid to $thirdHandBid-1)]
(if:$thirdHandString contains "Four")[(set:$thirdHandBid to $thirdHandBid-1)]
(if:$bid+$secondHandBid+$thirdHandBid>4)[(set:$thirdHandBid to $thirdHandBid-1)]
(if:$bid+$secondHandBid+$thirdHandBid>4)[(set:$secondHandBid to $secondHandBid-1)]
(if:$bid+$secondHandBid+$thirdHandBid>4)[(set:$thirdHandBid to $thirdHandBid-1)]
(if:$bid+$secondHandBid+$thirdHandBid>6)[(set:$thirdHandBid to $thirdHandBid-1)]
(if:$bid+$secondHandBid+$thirdHandBid>6)[(set:$secondHandBid to $secondHandBid-1)]
(if:$secondHandBid>4)[(set:$secondHandBid to 4)]
(if:$secondHandBid<0)[(set:$secondHandBid to 0)]
(if:$thirdHandBid>4)[(set:$thirdHandBid to 4)]
(if:$thirdHandBid<0)[(set:$thirdHandBid to 0)]}