Giter Club home page Giter Club logo

sudoku-dart's Introduction

sudoku-dart

关于 about

License License pub package

数独 解题器生成器 开源库 dart

支持对 唯一/非唯一解数独进行解题 以及 唯一解数独随机生成

open-source sudoku solver and puzzle generator library with dart

安装 install

only-dart

Depend on it

Run this command:

With Dart:

dart pub add sudoku_dart

with-flutter :

flutter pub add sudoku_dart

This will add a line like this to your package's pubspec.yaml (and run an implicit dart pub get):

dependencies:
  sudoku_dart: ^1.1.0

Import it

import 'package:sudoku_dart/sudoku_dart.dart';

使用 tutorial

解题 solver

import 'package:sudoku_dart/sudoku_dart.dart';
// 支持数独解题
// 输入一维数组的puzzle,-1为待填空
 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,
  ];

sudoku = Sudoku(puzzle);

// if you need check this puzzle is one-solution sudoku or not,use  strict:true 
// sudoku = Sudoku(puzzle, strict: true);

// debug print
sudoku.debug();
// origin puzzle
sudoku.puzzle;
// sudoku solution
sudoku.solution;

随机生成数独 generator

import 'package:sudoku_dart/sudoku_dart.dart';
// generate random puzzle with one-solution
// Level : easy(简单), medium(中等), hard(困难), expert(专家)
Sudoku sudoku = Sudoku.generate(Level.expert);

more

this library use on sudoku-flutter , support for android and iOS app , if interesting welcome visit this repository :

einsitang/sudoku-flutter

sudoku-dart's People

Contributors

einsitang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

sudoku-dart's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.