From 2ae800ed980f6850246e4328d129e6a644c5e3d5 Mon Sep 17 00:00:00 2001 From: jykim Date: Sun, 18 Sep 2016 15:40:42 +0900 Subject: [PATCH] logic change --- dist/sudokumaker.js | 6 ++++-- dist/sudokumaker.min.js | 2 +- src/index.js | 6 ++++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/dist/sudokumaker.js b/dist/sudokumaker.js index a3b735f..c2659d6 100644 --- a/dist/sudokumaker.js +++ b/dist/sudokumaker.js @@ -148,8 +148,10 @@ return /******/ (function(modules) { // webpackBootstrap }); if (this.createType === _constants.CreateTypes.RANDOM) { - var end = 40; - var start = 25; + // max show number count + var end = 30; + // min show number count + var start = 19; var pick_cnt = Math.floor(Math.random() * (end - start + 1) + start); var randomGamePattern = objectClone(gameData); var value = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35', '36', '37', '38', '39', '40', '41', '42', '43', '44', '45', '46', '47', '48', '49', '50', '51', '52', '53', '54', '55', '56', '57', '58', '59', '60', '61', '62', '63', '64', '65', '66', '67', '68', '69', '70', '71', '72', '73', '74', '75', '76', '77', '78', '79', '80']; diff --git a/dist/sudokumaker.min.js b/dist/sudokumaker.min.js index 10c1cc0..0b58125 100644 --- a/dist/sudokumaker.min.js +++ b/dist/sudokumaker.min.js @@ -1 +1 @@ -!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.sudokumaker=e():t.sudokumaker=e()}(this,function(){return function(t){function e(r){if(o[r])return o[r].exports;var n=o[r]={exports:{},id:r,loaded:!1};return t[r].call(n.exports,n,n.exports,e),n.loaded=!0,n.exports}var o={};return e.m=t,e.c=o,e.p="/",e(0)}([function(t,e,o){t.exports=o(1)},function(t,e,o){var r,n,a,r,n,a;!function(f,i){n=[t,e,o(3),o(2)],r=i,a="function"==typeof r?r.apply(e,n):r,!(void 0!==a&&(t.exports=a))}(this,function(t,e){!function(f,i){n=[t,e,o(3),o(2)],r=i,a="function"==typeof r?r.apply(e,n):r,!(void 0!==a&&(t.exports=a))}(this,function(t,e,o,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(){for(var t=[],e=[1,2,3,4,5,6,7,8,9],o=0;o<3;o++)for(var r=0;r<3;r++)t[r]||(t[r]=[]),t[r][o]=[],t[r][o]=e.splice(Math.floor(Math.random()*e.length),1)[0];return t}function f(t,e){for(var o=[],r=0;r<3;r++)o=o.concat(t[r]);return o[e]}function i(t,e){for(var o=[[0,0,0],[0,0,0],[0,0,0]],r=0;r<3;r++)for(var n=0;n<3;n++)o[r][n]=f(t,e[r][n]);return o}function u(t){return JSON.parse(JSON.stringify(t))}function c(t){var e=Math.floor((t-1)/9),o=Math.floor(t%9/3),r=Math.floor(t%9%3);return{i:e,j:o,k:r}}Object.defineProperty(e,"__esModule",{value:!0});var s=function(){function t(t,e){for(var o=0;o=0&&t){n=!0;var c=""+r+f+i;e.box[c]={_i:r,_j:f,_k:i};var s=Math.floor(u/3),p=u%3,l=""+r+s+p;e.box[l]={_i:r,_j:s,_k:p}}else t||(o=!0);a.push(t)})})},f=0;f<9;f++)a(f);for(var i=function(r){for(var a=function(a){var f=[],i=t[r][a].concat(t[r+1][a],t[r+2][a]);i.forEach(function(t,i){var u=r+Math.floor(i/3),c=i%3,s=f.indexOf(t);if(s>=0&&t){n=!0;var p=""+u+a+c;e.rows[p]={_i:u,_j:a,_k:c};var l=r+Math.floor(s/3),v=s%3,y=""+l+a+v;e.rows[y]={_i:l,_j:a,_k:v}}else t||(o=!0);f.push(t)})},f=0;f<3;f++)a(f)},u=0;u<9;u+=3)i(u);for(var c=function(r){for(var a=function(a){var f=[],i=0,u=[];u.push(t[r][i][a]),u.push(t[r][i+1][a]),u.push(t[r][i+2][a]),u.push(t[r+3][i][a]),u.push(t[r+3][i+1][a]),u.push(t[r+3][i+2][a]),u.push(t[r+6][i][a]),u.push(t[r+6][i+1][a]),u.push(t[r+6][i+2][a]),u.forEach(function(t,i){var u=3*Math.floor(i/3)+r,c=i%3,s=f.indexOf(t);if(s>=0&&t){n=!0;var p=""+u+c+a;e.cols[p]={_i:u,_j:c,_k:a};var l=3*Math.floor(s/3)+r,v=s%3,y=""+l+v+a;e.cols[y]={_i:l,_j:v,_k:a}}else t||(o=!0);f.push(t)})},f=0;f<3;f++)a(f)},s=0;s<3;s++)c(s);return n?e.state=r.PlayTypes.FAIL:o?e.state=r.PlayTypes.SOLVING:r.PlayTypes.state=r.PlayTypes.SUCCESS,e}}]),t}();e["default"]=new p,t.exports=e["default"]})})},function(t,e,o){var r,n,a,r,n,a;!function(o,f){n=[e],r=f,a="function"==typeof r?r.apply(e,n):r,!(void 0!==a&&(t.exports=a))}(this,function(e){!function(o,f){n=[e],r=f,a="function"==typeof r?r.apply(e,n):r,!(void 0!==a&&(t.exports=a))}(this,function(t){"use strict";"use strict;";Object.defineProperty(t,"__esModule",{value:!0});var e={SUCCESS:"SUCCESS",FAIL:"FAIL",SOLVING:"SOLVING"},o={RANDOM:"RANDOM"};t.PlayTypes=e,t.CreateTypes=o})})},function(t,e,o){var r,n,a,r,n,a;!function(o,f){n=[e],r=f,a="function"==typeof r?r.apply(e,n):r,!(void 0!==a&&(t.exports=a))}(this,function(e){!function(o,f){n=[e],r=f,a="function"==typeof r?r.apply(e,n):r,!(void 0!==a&&(t.exports=a))}(this,function(t){"use strict";"use strict;";Object.defineProperty(t,"__esModule",{value:!0});var e={};e.A=[[0,1,2],[3,4,5],[6,7,8]],e.B=[[1,2,0],[4,5,3],[7,8,6]],e.C=[[2,0,1],[5,3,4],[8,6,7]],e.D=[[3,4,5],[6,7,8],[0,1,2]],e.E=[[4,5,3],[7,8,6],[1,2,0]],e.F=[[5,3,4],[8,6,7],[2,0,1]],e.G=[[6,7,8],[0,1,2],[3,4,5]],e.H=[[7,8,6],[1,2,0],[4,5,3]],e.I=[[8,6,7],[2,0,1],[5,3,4]],e.J=[[8,7,6],[2,1,0],[5,4,3]],e.K=[[4,3,5],[7,6,8],[1,0,2]],e.L=[[6,8,7],[0,2,1],[3,5,4]],e.M=[[4,8,1],[7,5,6],[2,0,3]],e.N=[[8,2,4],[5,6,7],[1,3,0]],e.O=[[6,5,8],[0,7,2],[3,4,1]],e.P=[[7,2,6],[4,3,0],[8,1,5]],e.Q=[[5,6,7],[1,0,3],[2,8,4]],e.R=[[7,4,3],[6,1,8],[0,5,2]],e.S=[[3,0,5],[2,8,1],[4,6,7]],e.T=[[1,3,0],[8,2,4],[5,7,6]],e.U=[[4,2,0],[5,3,1],[8,6,7]],e.V=[[7,5,4],[1,8,3],[2,0,6]],e.W=[[8,5,3],[7,0,6],[2,4,1]],e.X=[[6,1,7],[0,2,8],[4,3,5]],e.Y=[[1,8,2],[5,6,0],[3,7,4]],e.Z=[[6,4,7],[2,1,8],[0,3,5]],e.AA=[[5,8,3],[7,6,4],[1,2,0]],e.AB=[[3,0,6],[4,7,2],[8,5,1]];var o=[];o[0]=["A","D","G","B","E","H","C","F","I"],o[1]=["A","G","D","B","H","E","C","I","F"],o[2]=["A","G","D","C","I","F","B","H","E"],o[3]=["A","J","F","I","K","A","B","L","E"],o[4]=["A","G","D","F","C","I","E","B","H"],o[5]=["A","O","R","M","P","S","N","Q","T"],o[6]=["A","R","O","M","S","P","N","T","Q"],o[7]=["A","R","O","N","T","Q","M","S","P"],o[8]=["A","O","R","N","Q","T","M","P","S"],o[9]=["A","W","Z","U","X","AA","V","Y","AB"],o[10]=["A","Z","W","U","AA","X","V","AB","Y"],o[11]=["A","Z","W","V","AB","Y","U","AA","X"],o[12]=["A","W","Z","V","Y","AB","U","X","AA"],t.TilePattern=e,t.GamePattern=o})})}])}); \ No newline at end of file +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.sudokumaker=e():t.sudokumaker=e()}(this,function(){return function(t){function e(r){if(o[r])return o[r].exports;var n=o[r]={exports:{},id:r,loaded:!1};return t[r].call(n.exports,n,n.exports,e),n.loaded=!0,n.exports}var o={};return e.m=t,e.c=o,e.p="/",e(0)}([function(t,e,o){t.exports=o(1)},function(t,e,o){var r,n,a,r,n,a;!function(f,i){n=[t,e,o(3),o(2)],r=i,a="function"==typeof r?r.apply(e,n):r,!(void 0!==a&&(t.exports=a))}(this,function(t,e){!function(f,i){n=[t,e,o(3),o(2)],r=i,a="function"==typeof r?r.apply(e,n):r,!(void 0!==a&&(t.exports=a))}(this,function(t,e,o,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(){for(var t=[],e=[1,2,3,4,5,6,7,8,9],o=0;o<3;o++)for(var r=0;r<3;r++)t[r]||(t[r]=[]),t[r][o]=[],t[r][o]=e.splice(Math.floor(Math.random()*e.length),1)[0];return t}function f(t,e){for(var o=[],r=0;r<3;r++)o=o.concat(t[r]);return o[e]}function i(t,e){for(var o=[[0,0,0],[0,0,0],[0,0,0]],r=0;r<3;r++)for(var n=0;n<3;n++)o[r][n]=f(t,e[r][n]);return o}function u(t){return JSON.parse(JSON.stringify(t))}function c(t){var e=Math.floor((t-1)/9),o=Math.floor(t%9/3),r=Math.floor(t%9%3);return{i:e,j:o,k:r}}Object.defineProperty(e,"__esModule",{value:!0});var s=function(){function t(t,e){for(var o=0;o=0&&t){n=!0;var c=""+r+f+i;e.box[c]={_i:r,_j:f,_k:i};var s=Math.floor(u/3),p=u%3,l=""+r+s+p;e.box[l]={_i:r,_j:s,_k:p}}else t||(o=!0);a.push(t)})})},f=0;f<9;f++)a(f);for(var i=function(r){for(var a=function(a){var f=[],i=t[r][a].concat(t[r+1][a],t[r+2][a]);i.forEach(function(t,i){var u=r+Math.floor(i/3),c=i%3,s=f.indexOf(t);if(s>=0&&t){n=!0;var p=""+u+a+c;e.rows[p]={_i:u,_j:a,_k:c};var l=r+Math.floor(s/3),v=s%3,y=""+l+a+v;e.rows[y]={_i:l,_j:a,_k:v}}else t||(o=!0);f.push(t)})},f=0;f<3;f++)a(f)},u=0;u<9;u+=3)i(u);for(var c=function(r){for(var a=function(a){var f=[],i=0,u=[];u.push(t[r][i][a]),u.push(t[r][i+1][a]),u.push(t[r][i+2][a]),u.push(t[r+3][i][a]),u.push(t[r+3][i+1][a]),u.push(t[r+3][i+2][a]),u.push(t[r+6][i][a]),u.push(t[r+6][i+1][a]),u.push(t[r+6][i+2][a]),u.forEach(function(t,i){var u=3*Math.floor(i/3)+r,c=i%3,s=f.indexOf(t);if(s>=0&&t){n=!0;var p=""+u+c+a;e.cols[p]={_i:u,_j:c,_k:a};var l=3*Math.floor(s/3)+r,v=s%3,y=""+l+v+a;e.cols[y]={_i:l,_j:v,_k:a}}else t||(o=!0);f.push(t)})},f=0;f<3;f++)a(f)},s=0;s<3;s++)c(s);return n?e.state=r.PlayTypes.FAIL:o?e.state=r.PlayTypes.SOLVING:r.PlayTypes.state=r.PlayTypes.SUCCESS,e}}]),t}();e["default"]=new p,t.exports=e["default"]})})},function(t,e,o){var r,n,a,r,n,a;!function(o,f){n=[e],r=f,a="function"==typeof r?r.apply(e,n):r,!(void 0!==a&&(t.exports=a))}(this,function(e){!function(o,f){n=[e],r=f,a="function"==typeof r?r.apply(e,n):r,!(void 0!==a&&(t.exports=a))}(this,function(t){"use strict";"use strict;";Object.defineProperty(t,"__esModule",{value:!0});var e={SUCCESS:"SUCCESS",FAIL:"FAIL",SOLVING:"SOLVING"},o={RANDOM:"RANDOM"};t.PlayTypes=e,t.CreateTypes=o})})},function(t,e,o){var r,n,a,r,n,a;!function(o,f){n=[e],r=f,a="function"==typeof r?r.apply(e,n):r,!(void 0!==a&&(t.exports=a))}(this,function(e){!function(o,f){n=[e],r=f,a="function"==typeof r?r.apply(e,n):r,!(void 0!==a&&(t.exports=a))}(this,function(t){"use strict";"use strict;";Object.defineProperty(t,"__esModule",{value:!0});var e={};e.A=[[0,1,2],[3,4,5],[6,7,8]],e.B=[[1,2,0],[4,5,3],[7,8,6]],e.C=[[2,0,1],[5,3,4],[8,6,7]],e.D=[[3,4,5],[6,7,8],[0,1,2]],e.E=[[4,5,3],[7,8,6],[1,2,0]],e.F=[[5,3,4],[8,6,7],[2,0,1]],e.G=[[6,7,8],[0,1,2],[3,4,5]],e.H=[[7,8,6],[1,2,0],[4,5,3]],e.I=[[8,6,7],[2,0,1],[5,3,4]],e.J=[[8,7,6],[2,1,0],[5,4,3]],e.K=[[4,3,5],[7,6,8],[1,0,2]],e.L=[[6,8,7],[0,2,1],[3,5,4]],e.M=[[4,8,1],[7,5,6],[2,0,3]],e.N=[[8,2,4],[5,6,7],[1,3,0]],e.O=[[6,5,8],[0,7,2],[3,4,1]],e.P=[[7,2,6],[4,3,0],[8,1,5]],e.Q=[[5,6,7],[1,0,3],[2,8,4]],e.R=[[7,4,3],[6,1,8],[0,5,2]],e.S=[[3,0,5],[2,8,1],[4,6,7]],e.T=[[1,3,0],[8,2,4],[5,7,6]],e.U=[[4,2,0],[5,3,1],[8,6,7]],e.V=[[7,5,4],[1,8,3],[2,0,6]],e.W=[[8,5,3],[7,0,6],[2,4,1]],e.X=[[6,1,7],[0,2,8],[4,3,5]],e.Y=[[1,8,2],[5,6,0],[3,7,4]],e.Z=[[6,4,7],[2,1,8],[0,3,5]],e.AA=[[5,8,3],[7,6,4],[1,2,0]],e.AB=[[3,0,6],[4,7,2],[8,5,1]];var o=[];o[0]=["A","D","G","B","E","H","C","F","I"],o[1]=["A","G","D","B","H","E","C","I","F"],o[2]=["A","G","D","C","I","F","B","H","E"],o[3]=["A","J","F","I","K","A","B","L","E"],o[4]=["A","G","D","F","C","I","E","B","H"],o[5]=["A","O","R","M","P","S","N","Q","T"],o[6]=["A","R","O","M","S","P","N","T","Q"],o[7]=["A","R","O","N","T","Q","M","S","P"],o[8]=["A","O","R","N","Q","T","M","P","S"],o[9]=["A","W","Z","U","X","AA","V","Y","AB"],o[10]=["A","Z","W","U","AA","X","V","AB","Y"],o[11]=["A","Z","W","V","AB","Y","U","AA","X"],o[12]=["A","W","Z","V","Y","AB","U","X","AA"],t.TilePattern=e,t.GamePattern=o})})}])}); \ No newline at end of file diff --git a/src/index.js b/src/index.js index fa3e631..aeb0d7e 100644 --- a/src/index.js +++ b/src/index.js @@ -28,8 +28,10 @@ class sudokuMaker { }); if(this.createType === CreateTypes.RANDOM) { - const end = 40; - const start = 25; + // max show number count + const end = 30; + // min show number count + const start = 19; const pick_cnt = Math.floor((Math.random() * (end-start+1)) + start); let randomGamePattern = objectClone(gameData); let value = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35', '36', '37', '38', '39', '40', '41', '42', '43', '44', '45', '46', '47', '48', '49', '50', '51', '52', '53', '54', '55', '56', '57', '58', '59', '60', '61', '62', '63', '64', '65', '66', '67', '68', '69', '70', '71', '72', '73', '74', '75', '76', '77', '78', '79', '80']