toString function

dynamic toString(
  1. dynamic arrangement
)

Converts an arrangement of pieces from Array to String.

param arrangement A starting position's arrangement return The same arrangement as a string, or false if invalid arrangement

Implementation

dynamic toString(arrangement) {
  if (!FischerRandomValidators().isValidArrangement(arrangement)) return false;
  if (arrangement is List<String>) {
    return arrangement.join('');
  } else {
    return arrangement;
  }
}