getHistory method

List getHistory([
  1. Map? options
])

Implementation

List getHistory([Map? options]) {
  final reversed_history = <Move?>[];
  final move_history = [];
  final verbose = (options != null && options.containsKey('verbose') && options['verbose'] == true);

  while (history.isNotEmpty) {
    reversed_history.add(undo_move());
  }

  while (reversed_history.isNotEmpty) {
    final move = reversed_history.removeLast()!;
    if (verbose) {
      move_history.add(make_pretty(move));
    } else {
      move_history.add(move_to_san(move));
    }
    make_move(move);
  }

  return move_history;
}