hasItemAt method

bool hasItemAt(
  1. ChessPos pos, {
  2. int team = -1,
})

Whether there is a valid item at pos

Implementation

bool hasItemAt(ChessPos pos, {int team = -1}) {
  String item = _rows[pos.y][pos.x];
  if (item == '0') {
    return false;
  }
  if (team < 0) {
    return true;
  }
  if ((team == 0 && item.codeUnitAt(0) < ChessFen.colIndexBase) ||
      (team == 1 && item.codeUnitAt(0) >= ChessFen.colIndexBase)) {
    return true;
  }
  return false;
}