materialCount method

IMap<Role, int> materialCount(
  1. Side side
)

Gets the number of pieces of each Role for the given Side.

Implementation

IMap<Role, int> materialCount(Side side) => IMap.fromEntries(
    Role.values.map((role) => MapEntry(role, piecesOf(side, role).size)));