Log inStart free
LESSON 16.25 · 6 STAGES · 3 CONTROLS · 3 CHECKSPRO · PREVIEW

PettingZoo: turn-based (AEC) vs parallel APIs

One claim game runs through both PettingZoo APIs, call by call.


Pro lesson. Stage 1 is free to watch. Pro opens all 6 stages, 3 controls and 3 checks, in this lesson and every other.

Go Pro · $8.25/mo
EXPLAINER · 16.25 · AGENT LOOP3 PLAYERS · 4 CELLS · 3 ROUNDS
01
Stage 1 of 6 · The game
Each round, 3 players each claim one of 4 cells. A cell pays its coins to the first claimer.
Explain it simply

You see a board with 3 rows, one per round, and 4 cells in each row. The number in a cell is its coins. In turn-taking play, the players claim one after another, and the first claim on a cell gets its coins.

A board of 3 rounds by 4 cells, each with its coins. 3 player lanes wait on the right.

coins, observationaction (a claim), rewardclash or blocked claimdashed chip: held claim or dead step
board: coins per cellenv.step calls (AEC)callP0P1P2round 1round 2round 3cell 0cell 1cell 2cell 3184283983636the AEC loopfor agent in env.agent_iter(): obs, reward, term, trunc, info = env.last() action = None if term or trunc else policy(obs, agent) env.step(action)board: coins per cellenv.step calls (AEC)callP0P1P2round 1round 2round 3cell 0cell 1cell 2cell 3184283983636the AEC loopfor agent in env.agent_iter(): obs, reward, term, trunc, info = env.last() action = None if term or trunc else policy(obs, agent) env.step(action)
Toy: 4 cells, 3 rounds, 2 or 3 players, one seeded policy
STAGE 1 / 6
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
ri=vc if ai=c wins the cell, else 0\sy{r}{out}{r_i} = \sy{v}{data}{v_{c}} \text{ if } \sy{a}{out}{a_i} = c \text{ wins the cell, else } 0
round 1: v=(1,8,4,2)\text{round 1: } v = (1, 8, 4, 2)

A player gets the coins of its cell only if its claim wins the cell.

Common mix-ups

MYTHAny AEC game runs the same through the parallel API.

The fix, and 1 more mix-up with the diagram to show them, come with Pro.

Predict, then reveal
3 CHECKS · PRO
Q01In simultaneous play, does the parallel API pay the same coins as the AEC API?

Make your guess, then test it in the diagram. All 3 checks come with Pro.

PRO LESSON · YOU WATCHED STAGE 1 OF 6
Unlock the full explainer
  • 5 more stages and 3 live controls
  • 2 mix-up cards and 3 predict-then-reveal checks
  • Watch it as a narrated video, in three voices
  • Every Pro lesson and capstone · 656 in total

$99 a year, or $15 a month. Cancel any time.