Skip to content

Commit

Permalink
Merge pull request #1 from denissdubinin/1.1.0
Browse files Browse the repository at this point in the history
1.1.0
  • Loading branch information
denissdubinin authored Sep 8, 2018
2 parents e9ffa23 + fea28c8 commit 4cca2dd
Show file tree
Hide file tree
Showing 12 changed files with 303 additions and 69 deletions.
Binary file removed .DS_Store
Binary file not shown.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.DS_Store
package-lock.json
node_modules
5 changes: 4 additions & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ module.exports = function (grunt) {
'https://github.com/denissdubinin/Javascript-Sudoku - Licensed MIT */\n',
uglify: {
options: {
banner: '<%= banner %>'
banner: '<%= banner %>',
output: {
beautify: false
}
},
dist: {
files: {
Expand Down
120 changes: 120 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
# Javascript Sudoku

[![License](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/denissdubinin/Javascript-sudoku)

Javascript plugin that generates random sudoku grid.

![Javascript Sudoku](example.png)

## Installation

### CDN
1. Add a sudoku script to your page:

```html
<script src="https://cdn.jsdelivr.net/gh/denissdubinin/javascript-sudoku@latest/dist/sudoku.min.js"></script>
```

2. Add a sudoku stylesheet to your page:

```html
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/denissdubinin/javascript-sudoku@latest/dist/sudoku.min.css">
```

### Local files
1. Add a sudoku script to your page:

```html
<script src="PATH_TO_DIR/sudoku.min.js"></script>
```

2. Add a sudoku stylesheet to your page:

```html
<link rel="stylesheet" href="PATH_TO_DIR/sudoku.min.css">
```

## Usage

1. Create `div` element on your page:

```html
<div></div>
```

2. Initialise Sudoku plugin:

```javascript
$(element).Sudoku();
```

3. Custom control buttons

You can use custom buttons for sudoku. To disable default buttons, set options `useCustomButtons` to `true`.

For custom buttons use `ID` selector:

* `start-sudoku` for start button
* `r-sudoku` for reset button
* `gn-sudoku` for generate button

Example:

```html
<div class="button" id="start-sudoku">START</div>
<div class="button" id="r-sudoku">RESET</div>
<div class="button" id="gn-sudoku">GENERATE NEW SUDOKU</div>
```

# Example

```javascript
$(element).Sudoku({
dropTimerOnReset: true,
markWrongCellsOnFly: false,
useTimer: true,
timerOnly: true,
});
```

## Options

`squareSize`

Size of small squre. Default `3`

`dropTimerOnReset`

Reset timer on sudoku reset. Default `true`

`markWrongCellsOnFly`: false,

Mark cell with red if it has wrong value right after number is entered. Default `false`

`markWrongCellsOnFinish`

Mark cell with wrong value with red when all cells are filled. Default `true`

`useTimer`

Enable timer. Default `true`

`timerOnly`

Game can be started only with activated timer. Works only with `options.useTimer === true`. Default `true`

`useCustomButtons`

If you want to use own control buttons, enable this options. Default `false`

`sudokuMixIterations`

Iterations count for mixing random rows and columns between themselfs The larger number, the more mixed sudoku becomes and the more time script initialisation takes. Default `500`

## Dependencies
jQuery 1.7

## License
Copyright &copy; 2018 Deniss Dubinin

Licensed under the MIT license.
2 changes: 1 addition & 1 deletion dist/sudoku.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/sudoku.min.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/sudoku.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added docs/assets/favicon.ico
Binary file not shown.
Loading

0 comments on commit 4cca2dd

Please sign in to comment.