sudoku_dart 1.0.2 copy "sudoku_dart: ^1.0.2" to clipboard
sudoku_dart: ^1.0.2 copied to clipboard

sudoku_dart is open-source sudoku solver and puzzle generator library with `dart`

example/lib/main.dart

import 'package:sudoku_dart/sudoku_dart.dart';

void main() {
  // resolve sudoku puzzle
  // List<int> puzzle = [
  //   -1,-1,8,    9,-1,6,     -1,-1,5,
  //   -1,4,3,     -1,-1,-1,   -1,2,-1,
  //   -1,-1,-1,   -1,-1,-1,   -1,-1,-1,
  //
  //   -1,-1,4,    -1,-1,-1,   9,-1,-1,
  //   5,-1,-1,    -1,4,-1,    6,8,-1,
  //   -1,-1,-1,   1,-1,-1,    -1,-1,-1,
  //
  //   2,-1,-1,    -1,8,-1,    -1,7,-1,
  //   -1,-1,-1,   -1,3,4,     1,-1,-1,
  //   -1,6,-1,    -1,-1,9,    -1,-1,-1,
  // ];

  // List<int> puzzle = [
  //   -1, -1, -1, 3, 1, 2, -1, -1, -1, -1, -1, -1, 6, 8, 9, -1, -1, -1, -1, -1, -1, 4, 7, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
  // ];

  // 唯一解数独
  List<int> puzzle = [
    -1,3,-1,-1,9,-1,-1,-1,7,8,9,-1,-1,-1,-1,-1,1,-1,-1,-1,2,-1,-1,-1,4,-1,-1,-1,4,8,-1,-1,6,-1,-1,-1,-1,-1,-1,-1,-1,8,-1,-1,9,-1,2,-1,-1,7,-1,-1,-1,-1,6,-1,-1,-1,3,9,1,5,-1,-1,-1,-1,2,-1,5,-1,6,-1,-1,5,9,-1,1,-1,-1,8,-1
  ];

  Sudoku sudoku_dart = Sudoku(puzzle, strict: true);
  sudoku_dart.debug();

  // sudo generator with expert level
  int beginTime = DateTime.now().millisecondsSinceEpoch;
  Sudoku newSudoku = Sudoku.generate(Level.expert);
  int endTime = DateTime.now().millisecondsSinceEpoch;
  newSudoku.debug();
  String str = newSudoku.puzzle.join(",");
  print('this is puzzle can be copy to the clipboard : ');
  print(str);
  print('generated total time : ${endTime - beginTime}\'ms');
}
5
likes
0
pub points
80%
popularity

Publisher

verified publisherdart.sevlow.com

sudoku_dart is open-source sudoku solver and puzzle generator library with `dart`

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

More

Packages that depend on sudoku_dart