Labs

Lab 04 Game

Jev plays truco

Truco argentino, one on one, first to 15. The rules engine deals and keeps score. Before every move it simulates a few hundred hands you could be holding, weighted by what you have sung, and Jev reads those odds to make up to five calls: how much to risk, how often you bluff, whether to bluff back, what kind of move and which card or call. The simulation only vetoes clear blunders; among the good moves Jev's own probabilities decide, so it does not play the same hand the same way twice.

dealing

you 0 · jev 0

See one of Jev's moves, exactly as the server sends it
POST /api/labs step 1, once per hand jev · score
{
  "state": "Truco argentino, first to 15 points. Score: you 0, rival 0, the game is tied. You need 15 more points, the rival needs 15. Hand 1. Being far behind calls for bolder calls and bluffs; being ahead calls for safe play.",
  "questions": {
    "risk": {
      "type": "score",
      "instructions": "Given the score of this game of truco, how much risk should you take in the coming hand",
      "criteria": [
        "none",
        "a little",
        "some",
        "a lot",
        "everything"
      ]
    }
  }
}

The first call reads the score and answers how much risk the hand deserves. When you have sung something, a second question in the same call reads how often you bluff. Both answers travel back with the reply and are reused for the rest of the hand, so most moves skip this call.

step 2 which move jev · choice
{
  "state": "Truco argentino, one on one, first to 15 points. Score: you 0, rival 0. Hand 2, you are mano and lead the first trick.\nYour appetite for risk in this hand: some.\nThe rival has not sung anything yet in this game.\nTrick 1: you lead.\nWinning this first trick puts you ahead; losing it means you must win the next two.\nYour cards: 4 of copas (a four, the weakest card, 34 of the 37 cards you have not seen beat it); 12 of espadas (a king, mediocre, 14 of the 37 cards you have not seen beat it); 12 of bastos (a king, mediocre, 14 of the 37 cards you have not seen beat it). The rival has 3 cards left.\nEnvido has not been sung yet. Your envido is 4 (hopeless); 33 is the maximum, 20 to 27 is common, under 20 is bad.\nTruco has not been sung, the hand is worth 1 point.\nSimulating 160 hands the rival could hold given everything it has shown: you take the tricks in about 18% of them if nobody backs down; your envido beats theirs in about 16%.",
  "questions": {
    "move": {
      "type": "choice",
      "instructions": "You are playing a hand of truco. Pick your next move",
      "criteria": {
        "4c": "Play the 4 of copas (a four, the weakest card, 34 of the 37 cards you have not seen beat it) to lead the trick: leads your weakest card and keeps the good ones. Simulated result for you this hand: -1.2 points on average",
        "12e": "Play the 12 of espadas (a king, mediocre, 14 of the 37 cards you have not seen beat it) to lead the trick: leads your middle card. Simulated result for you this hand: -1.0 points on average",
        "12b": "Play the 12 of bastos (a king, mediocre, 14 of the 37 cards you have not seen beat it) to lead the trick: leads your strongest card. Simulated result for you this hand: -1.0 points on average",
        "envido": "Sing envido with your envido of 4 (hopeless): 2 points on the line. Simulated result for you this hand: -1.2 points on average",
        "real": "Sing real envido with your envido of 4 (hopeless): 3 points on the line. Simulated result for you this hand: -1.7 points on average",
        "falta": "Sing falta envido with your envido of 4 (hopeless): 15 points, enough to end the game on the line. Simulated result for you this hand: -7.3 points on average",
        "truco": "Sing truco: the hand goes to 2 points. Simulated result for you this hand: -1.6 points on average",
        "mazo": "Go to the mazo: give up the hand, the rival gets 2 points. Simulated result for you this hand: -2.0 points on average"
      }
    }
  }
}

The state is the hand from Jev's side: its cards measured against the cards it has not seen, what it needs to win the hand, what you have sung and what a simulation of the hands you could hold says about its odds. Every legal move is a criterion with its simulated result. When its cards are weak and a call is cheap enough, a yes-or-no bluff question rides in the same call. The simulation vetoes clear blunders; the probabilities in the aside are the ones Jev returned.