teamOf function
Returns the LudoTeam that playerIndex belongs to, from teams.
Returns null if teams is null (i.e. not in teams mode).
Implementation
LudoTeam? teamOf(int playerIndex, List<LudoTeam>? teams) {
if (teams == null) return null;
for (final t in teams) {
if (t.contains(playerIndex)) return t;
}
return null;
}