diff --git a/dist/js/sdm.min.js b/dist/js/sdm.min.js index 28c70ef..a577e7f 100644 --- a/dist/js/sdm.min.js +++ b/dist/js/sdm.min.js @@ -1,3 +1,3 @@ "use strict";var _PATTERN={};_PATTERN.A=[[0,1,2],[3,4,5],[6,7,8]],_PATTERN.B=[[1,2,0],[4,5,3],[7,8,6]],_PATTERN.C=[[2,0,1],[5,3,4],[8,6,7]],_PATTERN.D=[[3,4,5],[6,7,8],[0,1,2]],_PATTERN.E=[[4,5,3],[7,8,6],[1,2,0]],_PATTERN.F=[[5,3,4],[8,6,7],[2,0,1]],_PATTERN.G=[[6,7,8],[0,1,2],[3,4,5]],_PATTERN.H=[[7,8,6],[1,2,0],[4,5,3]],_PATTERN.I=[[8,6,7],[2,0,1],[5,3,4]],_PATTERN.J=[[8,7,6],[2,1,0],[5,4,3]],_PATTERN.K=[[4,3,5],[7,6,8],[1,0,2]],_PATTERN.L=[[6,8,7],[0,2,1],[3,5,4]],_PATTERN.M=[[4,8,1],[7,5,6],[2,0,3]],_PATTERN.N=[[8,2,4],[5,6,7],[1,3,0]],_PATTERN.O=[[6,5,8],[0,7,2],[3,4,1]],_PATTERN.P=[[7,2,6],[4,3,0],[8,1,5]],_PATTERN.Q=[[5,6,7],[1,0,3],[2,8,4]],_PATTERN.R=[[7,4,3],[6,1,8],[0,5,2]],_PATTERN.S=[[3,0,5],[2,8,1],[4,6,7]],_PATTERN.T=[[1,3,0],[8,2,4],[5,7,6]],_PATTERN.U=[[4,2,0],[5,3,1],[8,6,7]],_PATTERN.V=[[7,5,4],[1,8,3],[2,0,6]],_PATTERN.W=[[8,5,3],[7,0,6],[2,4,1]],_PATTERN.X=[[6,1,7],[0,2,8],[4,3,5]],_PATTERN.Y=[[1,8,2],[5,6,0],[3,7,4]],_PATTERN.Z=[[6,4,7],[2,1,8],[0,3,5]],_PATTERN.AA=[[5,8,3],[7,6,4],[1,2,0]],_PATTERN.AB=[[3,0,6],[4,7,2],[8,5,1]];var _GAME=[];_GAME[0]=["A","D","G","B","E","H","C","F","I"],_GAME[1]=["A","G","D","B","H","E","C","I","F"],_GAME[2]=["A","G","D","C","I","F","B","H","E"],_GAME[3]=["A","J","F","I","K","A","B","L","E"],_GAME[4]=["A","G","D","F","C","I","E","B","H"],_GAME[5]=["A","O","R","M","P","S","N","Q","T"],_GAME[6]=["A","R","O","M","S","P","N","T","Q"],_GAME[7]=["A","R","O","N","T","Q","M","S","P"],_GAME[8]=["A","O","R","N","Q","T","M","P","S"],_GAME[9]=["A","W","Z","U","X","AA","V","Y","AB"],_GAME[10]=["A","Z","W","U","AA","X","V","AB","Y"],_GAME[11]=["A","Z","W","V","AB","Y","U","AA","X"],_GAME[12]=["A","W","Z","V","Y","AB","U","X","AA"]; -"use strict";!function(r){var o=function(){var r={},o=[[1,2,3],[4,5,6],[7,8,9]],t=function(){for(var r=[1,2,3,4,5,6,7,8,9],t=0;3>t;t++)for(var a=0;3>a;a++)o[a][t]=[],o[a][t]=r.splice(Math.floor(Math.random()*r.length),1)[0]};r.init=function(){t()},r.getGameData=function(r){t();var a=Math.floor(Math.random()*_GAME.length),c=_GAME[a],i=[];if(c.forEach(function(r,t){i.push(n(o,_PATTERN[r]))}),"random"===r){for(var e=i,h=["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"],u=30,l=15,v=Math.floor(Math.random()*(u-l+1)+l),M=0;v>M;M++){var d=Math.floor(Math.random()*h.length),s=f(h[d]);try{e[s.i][s.j][s.k]=void 0}catch(m){console.error(s),console.error(h[d])}h.splice(d,d++)}i={org:i,data:e}}return i};var a=function(r,o){for(var t=[],a=0;3>a;a++)t=t.concat(r[a]);return t[o]},n=function(r,o){for(var t=[[0,0,0],[0,0,0],[0,0,0]],n=0;3>n;n++)for(var f=0;3>f;f++)t[n][f]=a(r,o[n][f]);return t},f=function(r){var o=Math.floor((r-1)/9),t=Math.floor(r%9/3),a=Math.floor(r%9%3);return{i:o,j:t,k:a}};return r}();r.sdm=o}(window); +"use strict";!function(r){var o=function(){var r={},o=[[1,2,3],[4,5,6],[7,8,9]],n=function(){for(var r=[1,2,3,4,5,6,7,8,9],n=0;3>n;n++)for(var t=0;3>t;t++)o[t][n]=[],o[t][n]=r.splice(Math.floor(Math.random()*r.length),1)[0]};r.init=function(){n()},r.getGameData=function(r){n();var t=Math.floor(Math.random()*_GAME.length),c=_GAME[t],e=[];if(c.forEach(function(r,n){e.push(a(o,_PATTERN[r]))}),"random"===r){for(var u=f(e),h=["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"],l=30,v=15,M=Math.floor(Math.random()*(l-v+1)+v),s=0;M>s;s++){var d=Math.floor(Math.random()*h.length),m=i(h[d]);try{u[m.i][m.j][m.k]=void 0}catch(g){console.error(m),console.error(h[d])}h.splice(d,d++)}e={org:e,data:u}}return e};var t=function(r,o){for(var n=[],t=0;3>t;t++)n=n.concat(r[t]);return n[o]},a=function(r,o){for(var n=[[0,0,0],[0,0,0],[0,0,0]],a=0;3>a;a++)for(var f=0;3>f;f++)n[a][f]=t(r,o[a][f]);return n},f=function(r){return JSON.parse(JSON.stringify(r))},i=function(r){var o=Math.floor((r-1)/9),n=Math.floor(r%9/3),t=Math.floor(r%9%3);return{i:o,j:n,k:t}};return r}();r.sdm=o}(window); //# sourceMappingURL=sdm.min.js.map diff --git a/dist/js/sdm.min.js.map b/dist/js/sdm.min.js.map index 5e5b731..cca5568 100644 --- a/dist/js/sdm.min.js.map +++ b/dist/js/sdm.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["pattern.js","sdm.js"],"names":["_PATTERN","_GAME","window","sdm","my","_target","initRndNum","number","i","j","splice","Math","floor","random","length","init","getGameData","game_type","type","game_data","forEach","data","index","push","moveCard","random_game","value","end","start","pick_cnt","pick_idx","coord","getCoordByCount","k","undefined","e","console","error","org","searchXY","temp","concat","pattern","result","count","_i","_j","_k"],"mappings":"AAAA,YAAA,IAAIA,YACJA,UAAY,IAAQ,EAAG,EAAG,IAAO,EAAG,EAAG,IAAO,EAAG,EAAG,IACpDA,SAAY,IAAQ,EAAG,EAAG,IAAO,EAAG,EAAG,IAAO,EAAG,EAAG,IACpDA,SAAY,IAAQ,EAAG,EAAG,IAAO,EAAG,EAAG,IAAO,EAAG,EAAG,IACpDA,SAAY,IAAQ,EAAG,EAAG,IAAO,EAAG,EAAG,IAAO,EAAG,EAAG,IACpDA,SAAY,IAAQ,EAAG,EAAG,IAAO,EAAG,EAAG,IAAO,EAAG,EAAG,IACpDA,SAAY,IAAQ,EAAG,EAAG,IAAO,EAAG,EAAG,IAAO,EAAG,EAAG,IACpDA,SAAY,IAAQ,EAAG,EAAG,IAAO,EAAG,EAAG,IAAO,EAAG,EAAG,IACpDA,SAAY,IAAQ,EAAG,EAAG,IAAO,EAAG,EAAG,IAAO,EAAG,EAAG,IACpDA,SAAY,IAAQ,EAAG,EAAG,IAAO,EAAG,EAAG,IAAO,EAAG,EAAG,IACpDA,SAAY,IAAQ,EAAG,EAAG,IAAO,EAAG,EAAG,IAAO,EAAG,EAAG,IACpDA,SAAY,IAAQ,EAAG,EAAG,IAAO,EAAG,EAAG,IAAO,EAAG,EAAG,IACpDA,SAAY,IAAQ,EAAG,EAAG,IAAO,EAAG,EAAG,IAAO,EAAG,EAAG,IACpDA,SAAY,IAAQ,EAAG,EAAG,IAAO,EAAG,EAAG,IAAO,EAAG,EAAG,IACpDA,SAAY,IAAQ,EAAG,EAAG,IAAO,EAAG,EAAG,IAAO,EAAG,EAAG,IACpDA,SAAY,IAAQ,EAAG,EAA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A\", \"D\", \"G\", \"B\", \"E\", \"H\", \"C\", \"F\", \"I\" ];\n_GAME[1] = [ \"A\", \"G\", \"D\", \"B\", \"H\", \"E\", \"C\", \"I\", \"F\" ];\n_GAME[2] = [ \"A\", \"G\", \"D\", \"C\", \"I\", \"F\", \"B\", \"H\", \"E\" ];\n_GAME[3] = [ \"A\", \"J\", \"F\", \"I\", \"K\", \"A\", \"B\", \"L\", \"E\" ];\n_GAME[4] = [ \"A\", \"G\", \"D\", \"F\", \"C\", \"I\", \"E\", \"B\", \"H\" ];\n_GAME[5] = [ \"A\", \"O\", \"R\", \"M\", \"P\", \"S\", \"N\", \"Q\", \"T\" ];\n_GAME[6] = [ \"A\", \"R\", \"O\", \"M\", \"S\", \"P\", \"N\", \"T\", \"Q\" ];\n_GAME[7] = [ \"A\", \"R\", \"O\", \"N\", \"T\", \"Q\", \"M\", \"S\", \"P\" ];\n_GAME[8] = [ \"A\", \"O\", \"R\", \"N\", \"Q\", \"T\", \"M\", \"P\", \"S\" ];\n_GAME[9] = [ \"A\", \"W\", \"Z\", \"U\", \"X\", \"AA\", \"V\", \"Y\", \"AB\" ];\n_GAME[10] = [ \"A\", \"Z\", \"W\", \"U\", \"AA\", \"X\", \"V\", \"AB\", \"Y\" ];\n_GAME[11] = [ \"A\", \"Z\", \"W\", \"V\", \"AB\", \"Y\", \"U\", \"AA\", \"X\" ];\n_GAME[12] = [ \"A\", \"W\", \"Z\", \"V\", \"Y\", \"AB\", \"U\", \"X\", \"AA\" ];\n\n\n\n","'use strict';\n\n(function(window) {\n\tvar sdm = (function () {\n\t\tvar my = {};\n\n\t\tlet a = 1;\n\t\tconst b = 1;\n\n\t\tvar _target = [ [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] ];\n\n\t\tvar initRndNum = function() {\n\t\t\tvar number = [ 1, 2, 3, 4, 5, 6, 7, 8, 9 ];\n\t\t\tfor ( var i = 0; i < 3; i++) {\n\t\t\t\tfor ( var j = 0; j < 3; j++) {\n\t\t\t\t\t_target[j][i] = [];\n\t\t\t\t\t_target[j][i] = (number.splice(Math.floor(Math.random() * number.length), 1))[0];\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\t\n\n\t\tmy.init = function () {\n\t\t\tinitRndNum();\n\t\t}\n\n\t\tmy.getGameData = function(game_type) {\n\t\t\tinitRndNum();\n\t\t\tvar number = Math.floor((Math.random() * _GAME.length));\n\t\t\tvar type = _GAME[number];\n\t\t\tvar game_data = [];\n\n\t\t\ttype.forEach(function (data, index) {\n\t\t\t\tgame_data.push(moveCard(_target, _PATTERN[data]));\n\t\t\t});\n\n\t\t\tif(game_type === 'random') {\n\t\t\t\tvar random_game = game_data;\n\t\t\t\tvar 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']\n\t\t\t\tvar end = 30;\n\t\t\t\tvar start = 15;\n\t\t\t\tvar pick_cnt = Math.floor((Math.random() * (end-start+1)) + start);\n\n\t\t\t\tfor(var i = 0; i < pick_cnt; i++) {\n\t\t\t\t\tvar pick_idx = Math.floor(Math.random() * value.length);\n\t\t\t\t\tvar coord = getCoordByCount(value[pick_idx]);\n\t\t\t\t\ttry{\n\n\t\t\t\t\trandom_game[coord.i][coord.j][coord.k] = undefined;\n\t\t\t\t\t} catch(e) {\n\t\t\t\t\t\tconsole.error(coord);\n\t\t\t\t\t\tconsole.error(value[pick_idx]);\n\t\t\t\t\t}\n\t\t\t\t\tvalue.splice(pick_idx, pick_idx++);\n\t\t\t\t}\n\n\n\t\t\t\tgame_data = {\n\t\t\t\t\torg : game_data,\n\t\t\t\t\tdata: random_game\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn game_data;\n\t\t}\n\n\t\tvar searchXY = function(data, value) {\n\t\t\tvar temp = [];\n\t\t\tfor ( var i = 0; i < 3; i++) {\n\t\t\t\ttemp = temp.concat(data[i]);\n\t\t\t}\n\t\t\treturn temp[value]\n\t\t}\n\n\t\tvar moveCard = function(data, pattern) {\n\t\t\tvar result = [ [ 0, 0, 0 ], [ 0, 0, 0 ], [ 0, 0, 0 ] ];\n\t\t\tvar getTable = [];\n\t\t\tfor ( var i = 0; i < 3; i++) {\n\t\t\t\tfor ( var j = 0; j < 3; j++) {\n\t\t\t\t\tresult[i][j] = searchXY(data, pattern[i][j]);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn result;\n\t\t};\n\n\t\tvar getCoordByCount = function (count) {\n\t\t\tvar _i = Math.floor((count - 1) / 9);\n\t\t\tvar _j = Math.floor((count % 9) / 3);\n\t\t\tvar _k = Math.floor((count % 9) % 3);\n\n\t\t\treturn {\n\t\t\t\ti: _i,\n\t\t\t\tj: _j,\n\t\t\t\tk: _k\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn my;\n\t})();\n\n\twindow.sdm = sdm;\n\n})(window);"],"sourceRoot":"/source/"} \ No newline at end of file +{"version":3,"sources":["pattern.js","sdm.js"],"names":["_PATTERN","_GAME","window","sdm","my","_target","initRndNum","number","i","j","splice","Math","floor","random","length","init","getGameData","game_type","type","game_data","forEach","data","index","push","moveCard","random_game","objectClone","value","end","start","pick_cnt","pick_idx","coord","getCoordByCount","k","undefined","e","console","error","org","searchXY","temp","concat","pattern","result","object","JSON","parse","stringify","count","_i","_j","_k"],"mappings":"AAAA,YAAA,IAAIA,YACJA,UAAY,IAAQ,EAAG,EAAG,IAAO,EAAG,EAAG,IAAO,EAAG,EAAG,IACpDA,SAAY,IAAQ,EAAG,EAAG,IAAO,EAAG,EAAG,IAAO,EAAG,EAAG,IACpDA,SAAY,IAAQ,EAAG,EAAG,IAAO,EAAG,EA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ATTERN[\"Q\"] = [ [ 5, 6, 7 ], [ 1, 0, 3 ], [ 2, 8, 4 ] ];\n_PATTERN[\"R\"] = [ [ 7, 4, 3 ], [ 6, 1, 8 ], [ 0, 5, 2 ] ];\n_PATTERN[\"S\"] = [ [ 3, 0, 5 ], [ 2, 8, 1 ], [ 4, 6, 7 ] ];\n_PATTERN[\"T\"] = [ [ 1, 3, 0 ], [ 8, 2, 4 ], [ 5, 7, 6 ] ];\n_PATTERN[\"U\"] = [ [ 4, 2, 0 ], [ 5, 3, 1 ], [ 8, 6, 7 ] ];\n_PATTERN[\"V\"] = [ [ 7, 5, 4 ], [ 1, 8, 3 ], [ 2, 0, 6 ] ];\n_PATTERN[\"W\"] = [ [ 8, 5, 3 ], [ 7, 0, 6 ], [ 2, 4, 1 ] ];\n_PATTERN[\"X\"] = [ [ 6, 1, 7 ], [ 0, 2, 8 ], [ 4, 3, 5 ] ];\n_PATTERN[\"Y\"] = [ [ 1, 8, 2 ], [ 5, 6, 0 ], [ 3, 7, 4 ] ];\n_PATTERN[\"Z\"] = [ [ 6, 4, 7 ], [ 2, 1, 8 ], [ 0, 3, 5 ] ];\n_PATTERN[\"AA\"] = [ [ 5, 8, 3 ], [ 7, 6, 4 ], [ 1, 2, 0 ] ];\n_PATTERN[\"AB\"] = [ [ 3, 0, 6 ], [ 4, 7, 2 ], [ 8, 5, 1 ] ];\n\n\nvar _GAME = [];\n_GAME[0] = [ \"A\", \"D\", \"G\", \"B\", \"E\", \"H\", \"C\", \"F\", \"I\" ];\n_GAME[1] = [ \"A\", \"G\", \"D\", \"B\", \"H\", \"E\", \"C\", \"I\", \"F\" ];\n_GAME[2] = [ \"A\", \"G\", \"D\", \"C\", \"I\", \"F\", \"B\", \"H\", \"E\" ];\n_GAME[3] = [ \"A\", \"J\", \"F\", \"I\", \"K\", \"A\", \"B\", \"L\", \"E\" ];\n_GAME[4] = [ \"A\", \"G\", \"D\", \"F\", \"C\", \"I\", \"E\", \"B\", \"H\" ];\n_GAME[5] = [ \"A\", \"O\", \"R\", \"M\", \"P\", \"S\", \"N\", \"Q\", \"T\" ];\n_GAME[6] = [ \"A\", \"R\", \"O\", \"M\", \"S\", \"P\", \"N\", \"T\", \"Q\" ];\n_GAME[7] = [ \"A\", \"R\", \"O\", \"N\", \"T\", \"Q\", \"M\", \"S\", \"P\" ];\n_GAME[8] = [ \"A\", \"O\", \"R\", \"N\", \"Q\", \"T\", \"M\", \"P\", \"S\" ];\n_GAME[9] = [ \"A\", \"W\", \"Z\", \"U\", \"X\", \"AA\", \"V\", \"Y\", \"AB\" ];\n_GAME[10] = [ \"A\", \"Z\", \"W\", \"U\", \"AA\", \"X\", \"V\", \"AB\", \"Y\" ];\n_GAME[11] = [ \"A\", \"Z\", \"W\", \"V\", \"AB\", \"Y\", \"U\", \"AA\", \"X\" ];\n_GAME[12] = [ \"A\", \"W\", \"Z\", \"V\", \"Y\", \"AB\", \"U\", \"X\", \"AA\" ];\n\n\n\n","'use strict';\n\n(function(window) {\n\tvar sdm = (function () {\n\t\tvar my = {};\n\n\t\tlet a = 1;\n\t\tconst b = 1;\n\n\t\tvar _target = [ [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] ];\n\n\t\tvar initRndNum = function() {\n\t\t\tvar number = [ 1, 2, 3, 4, 5, 6, 7, 8, 9 ];\n\t\t\tfor ( var i = 0; i < 3; i++) {\n\t\t\t\tfor ( var j = 0; j < 3; j++) {\n\t\t\t\t\t_target[j][i] = [];\n\t\t\t\t\t_target[j][i] = (number.splice(Math.floor(Math.random() * number.length), 1))[0];\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\t\n\n\t\tmy.init = function () {\n\t\t\tinitRndNum();\n\t\t}\n\n\t\tmy.getGameData = function(game_type) {\n\t\t\tinitRndNum();\n\t\t\tvar number = Math.floor((Math.random() * _GAME.length));\n\t\t\tvar type = _GAME[number];\n\t\t\tvar game_data = [];\n\n\t\t\ttype.forEach(function (data, index) {\n\t\t\t\tgame_data.push(moveCard(_target, _PATTERN[data]));\n\t\t\t});\n\n\t\t\tif(game_type === 'random') {\n\t\t\t\tvar random_game = objectClone(game_data);\n\t\t\t\tvar 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']\n\t\t\t\tvar end = 30;\n\t\t\t\tvar start = 15;\n\t\t\t\tvar pick_cnt = Math.floor((Math.random() * (end-start+1)) + start);\n\n\t\t\t\tfor(var i = 0; i < pick_cnt; i++) {\n\t\t\t\t\tvar pick_idx = Math.floor(Math.random() * value.length);\n\t\t\t\t\tvar coord = getCoordByCount(value[pick_idx]);\n\t\t\t\t\ttry{\n\t\t\t\t\t\trandom_game[coord.i][coord.j][coord.k] = undefined;\n\t\t\t\t\t} catch(e) {\n\t\t\t\t\t\tconsole.error(coord);\n\t\t\t\t\t\tconsole.error(value[pick_idx]);\n\t\t\t\t\t}\n\t\t\t\t\tvalue.splice(pick_idx, pick_idx++);\n\t\t\t\t}\n\n\n\t\t\t\tgame_data = {\n\t\t\t\t\torg : game_data,\n\t\t\t\t\tdata: random_game\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn game_data;\n\t\t}\n\n\t\tvar searchXY = function(data, value) {\n\t\t\tvar temp = [];\n\t\t\tfor ( var i = 0; i < 3; i++) {\n\t\t\t\ttemp = temp.concat(data[i]);\n\t\t\t}\n\t\t\treturn temp[value]\n\t\t}\n\n\t\tvar moveCard = function(data, pattern) {\n\t\t\tvar result = [ [ 0, 0, 0 ], [ 0, 0, 0 ], [ 0, 0, 0 ] ];\n\t\t\tvar getTable = [];\n\t\t\tfor ( var i = 0; i < 3; i++) {\n\t\t\t\tfor ( var j = 0; j < 3; j++) {\n\t\t\t\t\tresult[i][j] = searchXY(data, pattern[i][j]);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn result;\n\t\t}\n\n\t\tvar objectClone = function (object) {\n\t\t\treturn JSON.parse(JSON.stringify(object));\n\t\t}\n\n\t\tvar getCoordByCount = function (count) {\n\t\t\tvar _i = Math.floor((count - 1) / 9);\n\t\t\tvar _j = Math.floor((count % 9) / 3);\n\t\t\tvar _k = Math.floor((count % 9) % 3);\n\n\t\t\treturn {\n\t\t\t\ti: _i,\n\t\t\t\tj: _j,\n\t\t\t\tk: _k\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn my;\n\t})();\n\n\twindow.sdm = sdm;\n\n})(window);"],"sourceRoot":"/source/"} \ No newline at end of file diff --git a/src/sdm.js b/src/sdm.js index 56c2fe4..2621115 100644 --- a/src/sdm.js +++ b/src/sdm.js @@ -36,7 +36,7 @@ }); if(game_type === 'random') { - var random_game = game_data; + var random_game = objectClone(game_data); 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'] var end = 30; var start = 15; @@ -46,8 +46,7 @@ var pick_idx = Math.floor(Math.random() * value.length); var coord = getCoordByCount(value[pick_idx]); try{ - - random_game[coord.i][coord.j][coord.k] = undefined; + random_game[coord.i][coord.j][coord.k] = undefined; } catch(e) { console.error(coord); console.error(value[pick_idx]); @@ -82,7 +81,11 @@ } } return result; - }; + } + + var objectClone = function (object) { + return JSON.parse(JSON.stringify(object)); + } var getCoordByCount = function (count) { var _i = Math.floor((count - 1) / 9);