From 3e759894a6e1e0d125918242b7e35d505f0fd262 Mon Sep 17 00:00:00 2001 From: Lennard Sprong Date: Tue, 31 Dec 2024 20:51:37 +0100 Subject: [PATCH] Remove Kanpen export support --- src-ui/js/ui/PopupMenu.js | 25 +------ src-ui/p.html | 4 - src-ui/res/p.en.json | 4 - src-ui/res/p.ja.json | 4 - src/puzzle/Encode.js | 36 +-------- src/puzzle/FileData.js | 25 +------ src/pzpr/parser.js | 50 ++----------- src/variety-common/FileData.js | 129 --------------------------------- src/variety/bonsan.js | 14 ---- src/variety/fillomino.js | 11 --- src/variety/goishi.js | 11 --- src/variety/hashikake.js | 21 ------ src/variety/heyawake.js | 22 ------ src/variety/hitori.js | 11 --- src/variety/kakuro.js | 11 --- src/variety/kurochute.js | 3 - src/variety/kurodoko.js | 10 --- src/variety/lightup.js | 22 ------ src/variety/lits.js | 11 --- src/variety/mashu.js | 17 ----- src/variety/nanro.js | 4 - src/variety/numlin.js | 11 --- src/variety/nurikabe.js | 10 --- src/variety/ripple.js | 14 ---- src/variety/shakashaka.js | 28 ------- src/variety/shikaku.js | 11 --- src/variety/slalom.js | 11 --- src/variety/slither.js | 13 ---- src/variety/sudoku.js | 11 --- src/variety/yajilin.js | 11 --- test/puzzle/encode_test.js | 38 ---------- test/puzzle/filedata_test.js | 21 ------ 32 files changed, 11 insertions(+), 613 deletions(-) diff --git a/src-ui/js/ui/PopupMenu.js b/src-ui/js/ui/PopupMenu.js index 2a27f1f40..225f2ba10 100644 --- a/src-ui/js/ui/PopupMenu.js +++ b/src-ui/js/ui/PopupMenu.js @@ -487,17 +487,9 @@ ui.popupmgr.addpopup("urloutput", { }, reset: function(px, py) { - var form = this.form, - pid = ui.puzzle.pid, - exists = pzpr.variety(pid).exists, - parser = pzpr.parser; + var parser = pzpr.parser; var url = ui.puzzle.getURL(parser.URL_PZPRV3); this.urlanchor.href = this.urlanchor.textContent = url; - form.kanpen.style.display = form.kanpen.nextSibling.style.display = exists.kanpen - ? "" - : "none"; - form.heyaapp.style.display = form.heyaapp.nextSibling.style.display = - pid === "heyawake" ? "" : "none"; }, show: function(px, py) { @@ -513,17 +505,11 @@ ui.popupmgr.addpopup("urloutput", { var url = "", parser = pzpr.parser; switch (e.target.name) { - case "kanpen": - url = ui.puzzle.getURL(parser.URL_KANPEN); - break; case "pzprv3e": url = ui.puzzle .getURL(parser.URL_PZPRV3) .replace(/\?(\w+)/, "?$1_edit"); break; - case "heyaapp": - url = ui.puzzle.getURL(parser.URL_HEYAAPP); - break; } this.urlanchor.href = this.urlanchor.textContent = url; } @@ -577,9 +563,6 @@ ui.popupmgr.addpopup("filesave", { }, reset: function() { /* ファイル形式選択オプション */ - var ispencilbox = pzpr.variety(ui.puzzle.pid).exists.pencilbox; - this.form.filetype.options[1].disabled = !ispencilbox; - this.form.filetype.options[2].disabled = !ispencilbox; var parser = pzpr.parser; this.form.ta.value = ui.puzzle.getFileData(parser.FILE_PZPR, {}); this.form.ta2.value = this.form.ta.value.replace(/\n/g, "/"); @@ -637,12 +620,6 @@ ui.popupmgr.addpopup("filesave", { filetype = parser.FILE_PZPR, option = {}; switch (form.filetype.value) { - case "filesave2": - filetype = parser.FILE_PBOX; - break; - case "filesave4": - filetype = parser.FILE_PBOX_XML; - break; case "filesave3": filetype = parser.FILE_PZPR; option.history = true; diff --git a/src-ui/p.html b/src-ui/p.html index a63ab9eea..d9c2db244 100644 --- a/src-ui/p.html +++ b/src-ui/p.html @@ -569,8 +569,6 @@

読み込み中です...


-
-


@@ -603,8 +601,6 @@

読み込み中です...

__filesave.format__
__filesave.filename__ diff --git a/src-ui/res/p.en.json b/src-ui/res/p.en.json index 5f3dd4c2f..09881ac72 100644 --- a/src-ui/res/p.en.json +++ b/src-ui/res/p.en.json @@ -241,16 +241,12 @@ "urlinput.title": "Load from URL", "urlinput.submit": "Load", "urloutput.title": "Export URL", - "urloutput.kanpen": "Change to Kanpen URL", - "urloutput.heyaapp": "Change to Heyawake-Applet URL", "urloutput.pzprv3e": "Change to PUZ-PRE v3 Re-Edit URL", "fileopen.title": "Open File", "fileopen.choose": "Choose file", "filesave.title": "Save File", "filesave.format": "File format", "filesave.format.pzprv3": "Puz-Pre v3 format", - "filesave.format.penciltxt": "Pencilbox Text format", - "filesave.format.pencilxml": "Pencilbox XML format", "filesave.filename": "Filename", "filesave.submit": "Save", "filesave.invalid": "The filename contains invalid characters.", diff --git a/src-ui/res/p.ja.json b/src-ui/res/p.ja.json index ae2bd6dd8..8e5420f5d 100644 --- a/src-ui/res/p.ja.json +++ b/src-ui/res/p.ja.json @@ -227,16 +227,12 @@ "urlinput.title": "URL入力", "urlinput.submit": "読み込む", "urloutput.title": "URL出力", - "urloutput.kanpen": "カンペンのURLを出力する", - "urloutput.heyaapp": "へやわけアプレットのURLを出力する", "urloutput.pzprv3e": "ぱずぷれv3の再編集用URLを出力する", "fileopen.title": "ファイルを開く", "fileopen.choose": "ファイル選択", "filesave.title": "ファイルを保存する", "filesave.format": "ファイル形式", "filesave.format.pzprv3": "ファイル形式", - "filesave.format.penciltxt": "pencilbox形式", - "filesave.format.pencilxml": "pencilbox XML形式", "filesave.filename": "ファイル名", "filesave.submit": "保存", "filesave.invalid": "ファイル名として使用できない文字が含まれています。", diff --git a/src/puzzle/Encode.js b/src/puzzle/Encode.js index 771912baf..19a1b11bd 100644 --- a/src/puzzle/Encode.js +++ b/src/puzzle/Encode.js @@ -85,11 +85,7 @@ pzpr.classmgr.makeCommon({ bd = puzzle.board; var pzl = new pzpr.parser.URLData("", mode); - type = - type || pzl.URL_PZPRV3; /* type===pzl.URL_AUTO(0)もまとめて変換する */ - if (type === pzl.URL_KANPEN && pid === "lits") { - type = pzl.URL_KANPENP; - } + type = type || pzl.URL_PZPRV3; this.outpflag = null; var variant = puzzle.getConfig("variant"); @@ -109,30 +105,6 @@ pzpr.classmgr.makeCommon({ this.outbstr = lines.join("/"); break; - case pzl.URL_PZPRAPP: - throw Error("no implementation"); - - case pzl.URL_KANPENP: - if (!puzzle.info.exists.kanpen) { - throw Error("no implementation"); - } - this.encodePzpr(pzl.URL_PZPRAPP); - this.outpflag = this.outpflag || ""; - break; - - case pzl.URL_KANPEN: - this.fio = new puzzle.klass.FileIO(); - this.encodeKanpen(); - this.outbstr = this.fio.datastr - .replace(/\r?\n/g, "/") - .replace(/ /g, "_"); - this.fio = null; - break; - - case pzl.URL_HEYAAPP: - this.encodeHeyaApp(); - break; - default: throw Error("invalid URL Type"); } @@ -158,14 +130,8 @@ pzpr.classmgr.makeCommon({ decodeKanpen: function() { throw Error("no implementation"); }, - encodeKanpen: function() { - throw Error("no implementation"); - }, decodeHeyaApp: function() { throw Error("no implementation"); - }, - encodeHeyaApp: function() { - throw Error("no implementation"); } } }); diff --git a/src/puzzle/FileData.js b/src/puzzle/FileData.js index a2b24b166..6e09c04e1 100644 --- a/src/puzzle/FileData.js +++ b/src/puzzle/FileData.js @@ -85,15 +85,6 @@ this.filever = 0; this.datastr = ""; - if (filetype === pzl.FILE_PBOX_XML) { - this.xmldoc = new DOMParser().parseFromString( - '', - "text/xml" - ); - var puzzlenode = this.xmldoc.querySelector("puzzle"); - puzzlenode.appendChild(this.createXMLNode("board")); - puzzlenode.appendChild(this.createXMLNode("answer")); - } // メイン処理 switch (filetype) { @@ -104,14 +95,6 @@ } break; - case pzl.FILE_PBOX: - this.kanpenSave(); - break; - - case pzl.FILE_PBOX_XML: - this.kanpenSaveXML(); - break; - default: throw Error("invalid filetype"); } @@ -120,11 +103,7 @@ pzl.filever = this.filever; pzl.cols = bd.cols; pzl.rows = bd.rows; - if (filetype !== pzl.FILE_PBOX_XML) { - pzl.body = this.datastr; - } else { - pzl.body = this.xmldoc; - } + pzl.body = this.datastr; pzl.metadata.update(puzzle.metadata); if (option.history && filetype === pzl.FILE_PZPR) { pzl.history = puzzle.opemgr.encodeHistory({ time: !!option.time }); @@ -139,9 +118,7 @@ decodeData: throwNoImplementation, encodeData: throwNoImplementation, kanpenOpen: throwNoImplementation, - kanpenSave: throwNoImplementation, kanpenOpenXML: throwNoImplementation, - kanpenSaveXML: throwNoImplementation, //--------------------------------------------------------------------------- // fio.decodeTrial() 仮置きデータを復旧する diff --git a/src/pzpr/parser.js b/src/pzpr/parser.js index ac2ab4ba1..4378db692 100644 --- a/src/pzpr/parser.js +++ b/src/pzpr/parser.js @@ -225,15 +225,6 @@ case URL_PZPRV3: url = url + "?%PID%/"; break; - case URL_KANPEN: - url = "http://www.kanpen.net/%KID%.html?problem="; - break; - case URL_KANPENP: - url = "http://www.kanpen.net/%KID%.html?pzpr="; - break; - case URL_HEYAAPP: - url = "http://www.geocities.co.jp/heyawake/?problem="; - break; case URL_PZPRFILE: url = url + "?"; break; @@ -253,9 +244,7 @@ if (this.type === URL_PZPRFILE) { url = url + typ; } - return url - .replace("%PID%", pzpr.variety(pid).urlid) - .replace("%KID%", pzpr.variety(this.pid).kanpenid); + return url.replace("%PID%", pzpr.variety(pid).urlid); }, //--------------------------------------------------------------------------- @@ -329,29 +318,15 @@ out = []; /* URLにつけるオプション */ - if (pzl.type !== URL_KANPEN && pzl.type !== URL_HEYAAPP) { - if (pzl.variant !== null) { - out.push("v:" + pzl.variant); - } - if (pzl.type === URL_KANPENP || !!pzl.pflag) { - out.push(pzl.pflag); - } + if (pzl.variant !== null) { + out.push("v:" + pzl.variant); + } + if (!!pzl.pflag) { + out.push(pzl.pflag); } /* サイズを表す文字列 */ - if (pzl.type === URL_KANPEN) { - if (pzl.pid === "kakuro") { - out.push(row + 1); - out.push(col + 1); - } else if (pzl.pid === "sudoku") { - out.push(col); - } else { - out.push(row); - out.push(col); - } - } else if (pzl.type === URL_HEYAAPP) { - out.push([col, row].join("x")); - } else if (pzl.type !== URL_PZPRFILE) { + if (pzl.type !== URL_PZPRFILE) { out.push(col); out.push(row); } @@ -731,16 +706,7 @@ puzzlenode.appendChild(puzzlenode.querySelector("answer")); } - var outputdata; - if (pzl.type !== FILE_PBOX_XML) { - outputdata = out.join("\n"); - } else { - outputdata = new XMLSerializer().serializeToString(this.body); - if (!outputdata.match(/^\<\?xml/)) { - outputdata = '\n' + outputdata; - } - } - return outputdata; + return out.join("\n"); }, createXMLNode: function(name, attrs) { diff --git a/src/variety-common/FileData.js b/src/variety-common/FileData.js index da557bf62..5ffbebb4e 100644 --- a/src/variety-common/FileData.js +++ b/src/variety-common/FileData.js @@ -654,7 +654,6 @@ pzpr.classmgr.makeCommon({ //--------------------------------------------------------------------------- // fio.decodeCellQnum_kanpen() pencilbox用問題数字のデコードを行う - // fio.encodeCellQnum_kanpen() pencilbox用問題数字のエンコードを行う //--------------------------------------------------------------------------- decodeCellQnum_kanpen: function() { this.decodeCell(function(cell, ca) { @@ -663,14 +662,8 @@ pzpr.classmgr.makeCommon({ } }); }, - encodeCellQnum_kanpen: function() { - this.encodeCell(function(cell) { - return cell.qnum >= 0 ? cell.qnum + " " : ". "; - }); - }, //--------------------------------------------------------------------------- // fio.decodeCellAnum_kanpen() pencilbox用回答数字のデコードを行う - // fio.encodeCellAnum_kanpen() pencilbox用回答数字のエンコードを行う //--------------------------------------------------------------------------- decodeCellAnum_kanpen: function() { this.decodeCell(function(cell, ca) { @@ -679,20 +672,8 @@ pzpr.classmgr.makeCommon({ } }); }, - encodeCellAnum_kanpen: function() { - this.encodeCell(function(cell) { - if (cell.qnum !== -1) { - return ". "; - } else if (cell.anum === -1) { - return "0 "; - } else { - return cell.anum + " "; - } - }); - }, //--------------------------------------------------------------------------- // fio.decodeCellQnumAns_kanpen() pencilbox用問題数字+黒マス白マスのデコードを行う - // fio.encodeCellQnumAns_kanpen() pencilbox用問題数字+黒マス白マスのエンコードを行う //--------------------------------------------------------------------------- decodeCellQnumAns_kanpen: function() { this.decodeCell(function(cell, ca) { @@ -707,25 +688,9 @@ pzpr.classmgr.makeCommon({ } }); }, - encodeCellQnumAns_kanpen: function() { - this.encodeCell(function(cell) { - if (cell.qnum >= 0) { - return cell.qnum + " "; - } else if (cell.qnum === -2) { - return "? "; - } else if (cell.qans === 1) { - return "# "; - } else if (cell.qsub === 1) { - return "+ "; - } else { - return ". "; - } - }); - }, //--------------------------------------------------------------------------- // fio.decodeCellQnum_XMLBoard() pencilbox XML用問題用数字のデコードを行う - // fio.encodeCellQnum_XMLBoard() pencilbox XML用問題用数字のエンコードを行う //--------------------------------------------------------------------------- UNDECIDED_NUM_XML: -1, decodeCellQnum_XMLBoard: function() { @@ -739,23 +704,9 @@ pzpr.classmgr.makeCommon({ } }); }, - encodeCellQnum_XMLBoard: function() { - var minnum = this.board.cell[0].getminnum() > 0 ? 1 : 0; - var undecnum = this.UNDECIDED_NUM_XML; - this.encodeCellXMLBoard(function(cell) { - var val = null; - if (cell.qnum === -2) { - val = undecnum; - } else if (cell.qnum >= minnum) { - val = cell.qnum; - } - return val; - }); - }, //--------------------------------------------------------------------------- // fio.decodeCellQnum_XMLBoard() pencilbox XML用問題用数字(browタイプ)のデコードを行う - // fio.encodeCellQnum_XMLBoard() pencilbox XML用問題用数字(browタイプ)のエンコードを行う //--------------------------------------------------------------------------- decodeCellQnum_XMLBoard_Brow: function() { var undecnum = this.UNDECIDED_NUM_XML; @@ -767,21 +718,9 @@ pzpr.classmgr.makeCommon({ } }); }, - encodeCellQnum_XMLBoard_Brow: function() { - var undecnum = this.UNDECIDED_NUM_XML; - this.encodeCellXMLBrow(function(cell) { - if (cell.qnum === -2) { - return "n" + undecnum; - } else if (cell.qnum >= 0) { - return "n" + cell.qnum; - } - return "s"; - }); - }, //--------------------------------------------------------------------------- // fio.decodeCellAnum_XMLBoard() pencilbox XML用回答用数字のデコードを行う - // fio.encodeCellAnum_XMLBoard() pencilbox XML用回答用数字のエンコードを行う //--------------------------------------------------------------------------- decodeCellAnum_XMLAnswer: function() { this.decodeCellXMLArow(function(cell, name) { @@ -792,20 +731,9 @@ pzpr.classmgr.makeCommon({ } }); }, - encodeCellAnum_XMLAnswer: function() { - this.encodeCellXMLArow(function(cell) { - if (cell.anum > 0) { - return "n" + cell.anum; - } else if (cell.anum === -1) { - return "n0"; - } - return "s"; - }); - }, //--------------------------------------------------------------------------- // fio.decodeAreaRoom_XMLBoard() pencilbox XML用問題用不定形部屋のデコードを行う - // fio.encodeAreaRoom_XMLBoard() pencilbox XML用問題用不定形部屋のエンコードを行う //--------------------------------------------------------------------------- decodeAreaRoom_XMLBoard: function() { var rdata = []; @@ -815,22 +743,9 @@ pzpr.classmgr.makeCommon({ this.rdata2Border(true, rdata); this.board.roommgr.rebuild(); }, - encodeAreaRoom_XMLBoard: function() { - var bd = this.board; - bd.roommgr.rebuild(); - var rooms = bd.roommgr.components; - this.xmldoc - .querySelector("board") - .appendChild(this.createXMLNode("areas", { N: rooms.length })); - this.encodeCellXMLBrow(function(cell) { - var roomid = rooms.indexOf(cell.room); - return "n" + (roomid > 0 ? roomid : -1); - }); - }, //--------------------------------------------------------------------------- // fio.decodeCellAns_XMLAnswer() pencilbox XML用黒マスのデコードを行う - // fio.encodeCellAns_XMLAnswer() pencilbox XML用黒マスのエンコードを行う //--------------------------------------------------------------------------- decodeCellAns_XMLAnswer: function() { this.decodeCellXMLArow(function(cell, name) { @@ -841,20 +756,9 @@ pzpr.classmgr.makeCommon({ } }); }, - encodeCellAns_XMLAnswer: function() { - this.encodeCellXMLArow(function(cell) { - if (cell.qans === 1) { - return "w"; - } else if (cell.qsub === 1) { - return "s"; - } - return "u"; - }); - }, //--------------------------------------------------------------------------- // fio.decodeBorderLine_XMLAnswer() pencilbox XML用Lineのデコードを行う - // fio.encodeBorderLine_XMLAnswer() pencilbox XML用Lineのエンコードを行う //--------------------------------------------------------------------------- decodeBorderLine_XMLAnswer: function() { this.decodeCellXMLArow(function(cell, name) { @@ -884,39 +788,6 @@ pzpr.classmgr.makeCommon({ bdv.qsub = 2; } }); - }, - encodeBorderLine_XMLAnswer: function() { - this.encodeCellXMLArow(function(cell) { - var val = 0, - nodename = ""; - var bdh = cell.adjborder.bottom, - bdv = cell.adjborder.right; - if (bdh.line === 1) { - val += 1; - } - if (bdv.line === 1) { - val += 2; - } - if (bdh.qsub === 2) { - val += 4; - } - if (bdv.qsub === 2) { - val += 8; - } - - if (val === 0) { - nodename = "s"; - } else if (val === 1) { - nodename = "h"; - } else if (val === 2) { - nodename = "v"; - } else if (val === 3) { - nodename = "hv"; - } else { - nodename = "n" + val; - } - return nodename; - }); } } }); diff --git a/src/variety/bonsan.js b/src/variety/bonsan.js index 52dbd6531..9adbfae80 100644 --- a/src/variety/bonsan.js +++ b/src/variety/bonsan.js @@ -752,10 +752,6 @@ decodeKanpen: function() { this.fio.decodeAreaRoom(); this.fio.decodeQnum_PBox_Sato(); - }, - encodeKanpen: function() { - this.fio.encodeAreaRoom(); - this.fio.encodeQnum_PBox_Sato(); } }, "Encode@rectslider,timebomb": { @@ -809,11 +805,6 @@ this.decodeQnum_PBox_Sato(); this.decodeLine_PBox_Sato(); }, - kanpenSave: function() { - this.encodeAreaRoom(); - this.encodeQnum_PBox_Sato(); - this.encodeLine_PBox_Sato(); - }, decodeQnum_PBox_Sato: function() { this.decodeCell(function(cell, ca) { if (ca === "-") { @@ -854,11 +845,6 @@ this.decodeCellQnum_XMLBoard(); this.decodeBorderLine_satogaeri_XMLAnswer(); }, - kanpenSaveXML: function() { - this.encodeAreaRoom_XMLBoard(); - this.encodeCellQnum_XMLBoard(); - this.encodeBorderLine_satogaeri_XMLAnswer(); - }, UNDECIDED_NUM_XML: -2, diff --git a/src/variety/fillomino.js b/src/variety/fillomino.js index 98a3564c6..5cb7d6a1e 100644 --- a/src/variety/fillomino.js +++ b/src/variety/fillomino.js @@ -855,9 +855,6 @@ decodeKanpen: function() { this.fio.decodeCellQnum_kanpen(); - }, - encodeKanpen: function() { - this.fio.encodeCellQnum_kanpen(); } }, "Encode@pentominous,tetrominous": { @@ -1020,10 +1017,6 @@ this.inputBorderFromNumber(); // 境界線を自動入力 }, - kanpenSave: function() { - this.encodeCellQnum_kanpen(); - this.encodeCellAnum_kanpen(); - }, inputBorderFromNumber: function() { var bd = this.board; @@ -1048,10 +1041,6 @@ this.inputBorderFromNumber(); // 境界線を自動入力 }, - kanpenSaveXML: function() { - this.encodeCellQnum_XMLBoard(); - this.encodeCellAnum_XMLAnswer(); - }, UNDECIDED_NUM_XML: 0 }, diff --git a/src/variety/goishi.js b/src/variety/goishi.js index 4a57bc799..511fb8a8d 100644 --- a/src/variety/goishi.js +++ b/src/variety/goishi.js @@ -237,9 +237,6 @@ decodeKanpen: function() { this.fio.decodeGoishi_kanpen(); }, - encodeKanpen: function() { - this.fio.encodeGoishi_kanpen(); - }, decodeGoishi: function() { var bstr = this.outbstr, @@ -299,10 +296,6 @@ this.decodeGoishi_kanpen(); this.decodeQansPos_kanpen(); }, - kanpenSave: function() { - this.encodeGoishi_kanpen(); - this.encodeQansPos_kanpen(); - }, decodeGoishiFile: function() { this.decodeCell(function(cell, ca) { @@ -381,10 +374,6 @@ this.decodeCellQnum_goishi_XMLBoard(); this.decodeQansPos_XMLAnswer(); }, - kanpenSaveXML: function() { - this.encodeCellQnum_goishi_XMLBoard(); - this.encodeQansPos_XMLAnswer(); - }, decodeCellQnum_goishi_XMLBoard: function() { this.decodeCellXMLBoard(function(cell, val) { diff --git a/src/variety/hashikake.js b/src/variety/hashikake.js index 3a513b7fc..07c56f774 100644 --- a/src/variety/hashikake.js +++ b/src/variety/hashikake.js @@ -342,9 +342,6 @@ decodeKanpen: function() { this.fio.decodeCellQnum_kanpen(); - }, - encodeKanpen: function() { - this.fio.encodeCellQnum_kanpen(); } }, //--------------------------------------------------------- @@ -372,29 +369,11 @@ } }); }, - kanpenSave: function() { - this.encodeCell(function(cell) { - if (cell.qnum > 0) { - return cell.qnum + " "; - } else if (cell.qnum === -2) { - return "9 "; - } else { - return ". "; - } - }); - this.encodeCell(function(cell) { - return "" + cell.getState() + " "; - }); - }, kanpenOpenXML: function() { this.decodeCellQnum_XMLBoard(); this.decodeBorderLine_hashikake_XMLAnswer(); }, - kanpenSaveXML: function() { - this.encodeCellQnum_XMLBoard(); - this.encodeBorderLine_hashikake_XMLAnswer(); - }, UNDECIDED_NUM_XML: 9, diff --git a/src/variety/heyawake.js b/src/variety/heyawake.js index b84c9cc84..841964f06 100644 --- a/src/variety/heyawake.js +++ b/src/variety/heyawake.js @@ -201,9 +201,6 @@ decodeKanpen: function() { this.fio.decodeSquareRoom(); }, - encodeKanpen: function() { - this.fio.encodeSquareRoom(); - }, decodeConfig: function() {}, encodeConfig: function() {}, @@ -242,17 +239,6 @@ i++; } fileio.rdata2Border(true, rdata); - }, - encodeHeyaApp: function() { - var barray = [], - bd = this.board, - rooms = bd.roommgr.components; - for (var r = 0; r < rooms.length; r++) { - var d = rooms[r].clist.getRectSize(); - var ul = bd.getc(d.x1, d.y1).qnum; - barray.push((ul >= 0 ? "" + ul + "in" : "") + d.cols + "x" + d.rows); - } - this.outbstr = barray.join("/"); } }, "Encode@akichi": { @@ -285,10 +271,6 @@ this.decodeSquareRoom(); this.decodeCellAns(); }, - kanpenSave: function() { - this.encodeSquareRoom(); - this.encodeCellAns(); - }, decodeSquareRoom: function() { var bd = this.board, @@ -338,10 +320,6 @@ this.decodeSquareRoom_XMLBoard(); this.decodeCellAns_XMLAnswer(); }, - kanpenSaveXML: function() { - this.encodeSquareRoom_XMLBoard(); - this.encodeCellAns_XMLAnswer(); - }, decodeSquareRoom_XMLBoard: function() { var nodes = this.xmldoc.querySelectorAll("board area"); diff --git a/src/variety/hitori.js b/src/variety/hitori.js index 90862923f..cde58f6c7 100644 --- a/src/variety/hitori.js +++ b/src/variety/hitori.js @@ -194,9 +194,6 @@ decodeKanpen: function() { this.fio.decodeCellQnum_kanpen_hitori(); - }, - encodeKanpen: function() { - this.fio.encodeCellQnum_kanpen_hitori(); } }, //--------------------------------------------------------- @@ -214,10 +211,6 @@ this.decodeCellQnum_kanpen_hitori(); this.decodeCellAns(); }, - kanpenSave: function() { - this.encodeCellQnum_kanpen_hitori(); - this.encodeCellAns(); - }, decodeCellQnum_kanpen_hitori: function() { this.decodeCell(function(cell, ca) { @@ -235,10 +228,6 @@ kanpenOpenXML: function() { this.decodeCellQnum_XMLBoard_Brow(); this.decodeCellAns_XMLAnswer(); - }, - kanpenSaveXML: function() { - this.encodeCellQnum_XMLBoard_Brow(); - this.encodeCellAns_XMLAnswer(); } }, diff --git a/src/variety/kakuro.js b/src/variety/kakuro.js index 4d150586f..9b0656c22 100644 --- a/src/variety/kakuro.js +++ b/src/variety/kakuro.js @@ -200,9 +200,6 @@ decodeKanpen: function() { this.fio.decodeCellQnum51_kanpen(); }, - encodeKanpen: function() { - this.fio.encodeCellQnum51_kanpen(); - }, decodeKakuro: function() { // 盤面内数字のデコード @@ -327,10 +324,6 @@ this.decodeCellQnum51_kanpen(); this.decodeQans_kanpen(); }, - kanpenSave: function() { - this.encodeCellQnum51_kanpen(); - this.encodeQans_kanpen(); - }, decodeCellQnum51_kanpen: function() { var bd = this.board; @@ -407,10 +400,6 @@ this.decodeCellQnum51_XMLBoard(); this.decodeCellAnum_kakuro_XMLAnswer(); }, - kanpenSaveXML: function() { - this.encodeCellQnum51_XMLBoard(); - this.encodeCellAnum_kakuro_XMLAnswer(); - }, decodeCellQnum51_XMLBoard: function() { var nodes = this.xmldoc.querySelectorAll("board wall"); diff --git a/src/variety/kurochute.js b/src/variety/kurochute.js index d06cd781a..9f99b7f90 100644 --- a/src/variety/kurochute.js +++ b/src/variety/kurochute.js @@ -124,9 +124,6 @@ decodeKanpen: function() { this.fio.decodeCellQnum_kanpen(); - }, - encodeKanpen: function() { - this.fio.encodeCellQnum_kanpen(); } }, //--------------------------------------------------------- diff --git a/src/variety/kurodoko.js b/src/variety/kurodoko.js index c791d876a..e2854fd45 100644 --- a/src/variety/kurodoko.js +++ b/src/variety/kurodoko.js @@ -324,9 +324,6 @@ decodeKanpen: function() { this.fio.decodeCellQnum_kanpen(); - }, - encodeKanpen: function() { - this.fio.encodeCellQnum_kanpen(); } }, //--------------------------------------------------------- @@ -354,18 +351,11 @@ kanpenOpen: function() { this.decodeCellQnumAns_kanpen(); }, - kanpenSave: function() { - this.encodeCellQnumAns_kanpen(); - }, kanpenOpenXML: function() { this.decodeCellQnum_XMLBoard(); this.decodeCellAns_XMLAnswer(); }, - kanpenSaveXML: function() { - this.encodeCellQnum_XMLBoard(); - this.encodeCellAns_kurodoko_XMLAnswer(); - }, UNDECIDED_NUM_XML: -4, diff --git a/src/variety/lightup.js b/src/variety/lightup.js index 819cf8cff..e382ceaa4 100644 --- a/src/variety/lightup.js +++ b/src/variety/lightup.js @@ -313,9 +313,6 @@ decodeKanpen: function() { this.fio.decodeCellQnumb(); - }, - encodeKanpen: function() { - this.fio.encodeCellQnumb(); } }, //--------------------------------------------------------- @@ -366,30 +363,11 @@ } }); }, - kanpenSave: function() { - this.encodeCell(function(cell) { - if (cell.qans === 1) { - return "+ "; - } else if (cell.qsub === 1) { - return "* "; - } else if (cell.qnum >= 0) { - return cell.qnum + " "; - } else if (cell.qnum === -2) { - return "5 "; - } else { - return ". "; - } - }); - }, kanpenOpenXML: function() { this.decodeCellQnum_XMLBoard(); this.decodeCellAns_XMLAnswer(); }, - kanpenSaveXML: function() { - this.encodeCellQnum_XMLBoard(); - this.encodeCellAns_XMLAnswer(); - }, UNDECIDED_NUM_XML: 5 }, diff --git a/src/variety/lits.js b/src/variety/lits.js index 065e3fb87..faa837b1e 100644 --- a/src/variety/lits.js +++ b/src/variety/lits.js @@ -200,9 +200,6 @@ decodeKanpen: function() { this.fio.decodeAreaRoom(); }, - encodeKanpen: function() { - this.fio.encodeAreaRoom(); - }, decodeLITS_old: function() { var bstr = this.outbstr, @@ -237,18 +234,10 @@ this.decodeAreaRoom(); this.decodeCellAns(); }, - kanpenSave: function() { - this.encodeAreaRoom(); - this.encodeCellAns(); - }, kanpenOpenXML: function() { this.decodeAreaRoom_XMLBoard(); this.decodeCellAns_XMLAnswer(); - }, - kanpenSaveXML: function() { - this.encodeAreaRoom_XMLBoard(); - this.encodeCellAns_XMLAnswer(); } }, diff --git a/src/variety/mashu.js b/src/variety/mashu.js index a6ce8a5dd..1a6498a89 100644 --- a/src/variety/mashu.js +++ b/src/variety/mashu.js @@ -140,11 +140,6 @@ decodeKanpen: function() { this.fio.decodeCellQnum_kanpen(); this.board.revCircle(); - }, - encodeKanpen: function() { - this.board.revCircle(); - this.fio.encodeCellQnum_kanpen(); - this.board.revCircle(); } }, //--------------------------------------------------------- @@ -166,24 +161,12 @@ this.decodeBorderLine(); this.board.revCircle(); }, - kanpenSave: function() { - this.board.revCircle(); - this.encodeCellQnum_kanpen(); - this.encodeBorderLine(); - this.board.revCircle(); - }, kanpenOpenXML: function() { this.decodeCellQnum_XMLBoard(); this.decodeBorderLine_XMLAnswer(); this.board.revCircle(); }, - kanpenSaveXML: function() { - this.board.revCircle(); - this.encodeCellQnum_XMLBoard(); - this.encodeBorderLine_XMLAnswer(); - this.board.revCircle(); - }, UNDECIDED_NUM_XML: 3 }, diff --git a/src/variety/nanro.js b/src/variety/nanro.js index 7f0f79064..b2e43d11a 100644 --- a/src/variety/nanro.js +++ b/src/variety/nanro.js @@ -210,10 +210,6 @@ decodeKanpen: function() { this.fio.decodeAreaRoom(); this.fio.decodeCellQnum_kanpen(); - }, - encodeKanpen: function() { - this.fio.encodeAreaRoom(); - this.fio.encodeCellQnum_kanpen(); } }, //--------------------------------------------------------- diff --git a/src/variety/numlin.js b/src/variety/numlin.js index 524b980d0..63af6ed08 100644 --- a/src/variety/numlin.js +++ b/src/variety/numlin.js @@ -217,9 +217,6 @@ decodeKanpen: function() { this.fio.decodeCellQnum_kanpen(); - }, - encodeKanpen: function() { - this.fio.encodeCellQnum_kanpen(); } }, "Encode@arukone": { @@ -249,19 +246,11 @@ this.decodeCellQnum_kanpen(); this.decodeBorderLine(); }, - kanpenSave: function() { - this.encodeCellQnum_kanpen(); - this.encodeBorderLine(); - }, kanpenOpenXML: function() { this.decodeCellQnum_XMLBoard(); this.decodeBorderLine_XMLAnswer(); }, - kanpenSaveXML: function() { - this.encodeCellQnum_XMLBoard(); - this.encodeBorderLine_XMLAnswer(); - }, UNDECIDED_NUM_XML: -1 }, diff --git a/src/variety/nurikabe.js b/src/variety/nurikabe.js index 7a6029852..7331f8aeb 100644 --- a/src/variety/nurikabe.js +++ b/src/variety/nurikabe.js @@ -258,9 +258,6 @@ "Encode@nurikabe": { decodeKanpen: function() { this.fio.decodeCellQnum_kanpen(); - }, - encodeKanpen: function() { - this.fio.encodeCellQnum_kanpen(); } }, //--------------------------------------------------------- @@ -285,17 +282,10 @@ kanpenOpen: function() { this.decodeCellQnumAns_kanpen(); }, - kanpenSave: function() { - this.encodeCellQnumAns_kanpen(); - }, kanpenOpenXML: function() { this.decodeCellQnumAns_XMLBoard(); }, - kanpenSaveXML: function() { - this.encodeCellQnumAns_XMLBoard(); - this.encodeCellAns_XMLAnswer(); - }, decodeCellQnumAns_XMLBoard: function() { this.decodeCellXMLBoard(function(cell, val) { diff --git a/src/variety/ripple.js b/src/variety/ripple.js index c9fa8bf5b..856c6d7e7 100644 --- a/src/variety/ripple.js +++ b/src/variety/ripple.js @@ -171,10 +171,6 @@ decodeKanpen: function() { this.fio.decodeAreaRoom(); this.fio.decodeCellQnum_kanpen(); - }, - encodeKanpen: function() { - this.fio.encodeAreaRoom(); - this.fio.encodeCellQnum_kanpen(); } }, //--------------------------------------------------------- @@ -195,22 +191,12 @@ this.decodeCellQnum_kanpen(); this.decodeCellAnum_kanpen(); }, - kanpenSave: function() { - this.encodeAreaRoom(); - this.encodeCellQnum_kanpen(); - this.encodeCellAnum_kanpen(); - }, kanpenOpenXML: function() { this.decodeAreaRoom_XMLBoard(); this.decodeCellQnum_XMLBoard(); this.decodeCellAnum_XMLAnswer(); }, - kanpenSaveXML: function() { - this.encodeAreaRoom_XMLBoard(); - this.encodeCellQnum_XMLBoard(); - this.encodeCellAnum_XMLAnswer(); - }, UNDECIDED_NUM_XML: 0 }, diff --git a/src/variety/shakashaka.js b/src/variety/shakashaka.js index acbe1ae28..5ac8557e5 100644 --- a/src/variety/shakashaka.js +++ b/src/variety/shakashaka.js @@ -509,9 +509,6 @@ decodeKanpen: function() { this.fio.decodeCellQnumb(); - }, - encodeKanpen: function() { - this.fio.encodeCellQnumb(); } }, //--------------------------------------------------------- @@ -566,35 +563,10 @@ } }); }, - kanpenSave: function() { - this.encodeCell(function(cell) { - if (cell.qnum >= 0) { - return cell.qnum + " "; - } else if (cell.qnum === -2) { - return "5 "; - } else { - return ". "; - } - }); - this.encodeCell(function(cell) { - if (cell.qsub === 1) { - return "+ "; - } else if (cell.qans >= 2) { - return cell.qans + " "; - } else { - return ". "; - } - }); - }, - kanpenOpenXML: function() { this.decodeCellQnum_XMLBoard(); this.decodeCellShakashaka_XMLAnswer(); }, - kanpenSaveXML: function() { - this.encodeCellQnum_XMLBoard(); - this.encodeCellShakashaka_XMLAnswer(); - }, UNDECIDED_NUM_XML: -2, diff --git a/src/variety/shikaku.js b/src/variety/shikaku.js index 06803827f..79fb54e39 100644 --- a/src/variety/shikaku.js +++ b/src/variety/shikaku.js @@ -81,9 +81,6 @@ decodeKanpen: function() { this.fio.decodeCellQnum_kanpen(); - }, - encodeKanpen: function() { - this.fio.encodeCellQnum_kanpen(); } }, //--------------------------------------------------------- @@ -101,10 +98,6 @@ this.decodeCellQnum_kanpen(); this.decodeAnsSquareRoom(); }, - kanpenSave: function() { - this.encodeCellQnum_kanpen(); - this.encodeAnsSquareRoom(); - }, decodeAnsSquareRoom: function() { var bd = this.board, @@ -144,10 +137,6 @@ this.decodeCellQnum_shikaku_XMLBoard(); this.decodeAnsSquareRoom_XMLAnswer(); }, - kanpenSaveXML: function() { - this.encodeCellQnum_shikaku_XMLBoard(); - this.encodeAnsSquareRoom_XMLAnswer(); - }, decodeCellQnum_shikaku_XMLBoard: function() { this.decodeCellXMLBoard(function(cell, val) { diff --git a/src/variety/slalom.js b/src/variety/slalom.js index a5efcc7fa..23815e658 100644 --- a/src/variety/slalom.js +++ b/src/variety/slalom.js @@ -804,9 +804,6 @@ decodeKanpen: function() { this.fio.decodeBoard_kanpen(); }, - encodeKanpen: function() { - this.fio.encodeBoard_kanpen(); - }, decodeSlalom: function(ver) { var bstr = this.outbstr; @@ -1034,10 +1031,6 @@ this.decodeBoard_kanpen(); this.decodeBorderLine(); }, - kanpenSave: function() { - this.encodeBoard_kanpen(); - this.encodeBorderLine(); - }, decodeBoard_pzpr1: function() { var bd = this.board; @@ -1137,10 +1130,6 @@ this.decodeCellSlalom_XMLBoard(); this.decodeBorderLine_XMLAnswer(); }, - kanpenSaveXML: function() { - this.encodeCellSlalom_XMLBoard(); - this.encodeBorderLine_XMLAnswer(); - }, UNDECIDED_NUM_XML: -3, decodeCellSlalom_XMLBoard: function() { diff --git a/src/variety/slither.js b/src/variety/slither.js index 1d13f004b..e2b328002 100644 --- a/src/variety/slither.js +++ b/src/variety/slither.js @@ -268,9 +268,6 @@ decodeKanpen: function() { this.fio.decodeCellQnum_kanpen(); - }, - encodeKanpen: function() { - this.fio.encodeCellQnum_kanpen(); } }, "Encode@swslither": { @@ -303,10 +300,6 @@ this.decodeCellQnum_kanpen(); this.decodeBorderLine(); }, - kanpenSave: function() { - this.encodeCellQnum_kanpen(); - this.encodeBorderLine(); - }, kanpenOpenXML: function() { this.PBOX_ADJUST = 0; @@ -314,12 +307,6 @@ this.PBOX_ADJUST = 1; this.decodeBorderLine_slither_XMLAnswer(); }, - kanpenSaveXML: function() { - this.PBOX_ADJUST = 0; - this.encodeCellQnum_XMLBoard_Brow(); - this.PBOX_ADJUST = 1; - this.encodeBorderLine_slither_XMLAnswer(); - }, UNDECIDED_NUM_XML: 5, PBOX_ADJUST: 1, diff --git a/src/variety/sudoku.js b/src/variety/sudoku.js index 7b4a094f0..bce170f60 100644 --- a/src/variety/sudoku.js +++ b/src/variety/sudoku.js @@ -91,9 +91,6 @@ decodeKanpen: function() { this.fio.decodeCellQnum_kanpen(); - }, - encodeKanpen: function() { - this.fio.encodeCellQnum_kanpen(); } }, //--------------------------------------------------------- @@ -111,19 +108,11 @@ this.decodeCellQnum_kanpen(); this.decodeCellAnum_kanpen(); }, - kanpenSave: function() { - this.encodeCellQnum_kanpen(); - this.encodeCellAnum_kanpen(); - }, kanpenOpenXML: function() { this.decodeCellQnum_XMLBoard(); this.decodeCellAnum_XMLAnswer(); }, - kanpenSaveXML: function() { - this.encodeCellQnum_XMLBoard(); - this.encodeCellAnum_XMLAnswer(); - }, UNDECIDED_NUM_XML: 0 }, diff --git a/src/variety/yajilin.js b/src/variety/yajilin.js index 640f035d8..b86b76a7f 100644 --- a/src/variety/yajilin.js +++ b/src/variety/yajilin.js @@ -558,9 +558,6 @@ decodeKanpen: function() { this.fio.decodeCellDirecQnum_kanpen(true); - }, - encodeKanpen: function() { - this.fio.encodeCellDirecQnum_kanpen(true); } }, "Encode@yajilin-regions": { @@ -610,10 +607,6 @@ this.decodeCellDirecQnum_kanpen(false); this.decodeBorderLine(); }, - kanpenSave: function() { - this.encodeCellDirecQnum_kanpen(false); - this.encodeBorderLine(); - }, decodeCellDirecQnum_kanpen: function(isurl) { this.decodeCell(function(cell, ca) { @@ -671,10 +664,6 @@ this.decodeCellDirecQnum_XMLBoard(); this.decodeBorderLine_XMLAnswer(); }, - kanpenSaveXML: function() { - this.encodeCellDirecQnum_XMLBoard(); - this.encodeBorderLine_XMLAnswer(); - }, decodeCellDirecQnum_XMLBoard: function() { this.decodeCellXMLBoard(function(cell, val) { diff --git a/test/puzzle/encode_test.js b/test/puzzle/encode_test.js index f94692325..527978c97 100644 --- a/test/puzzle/encode_test.js +++ b/test/puzzle/encode_test.js @@ -6,16 +6,6 @@ var pzpr = require("../../dist/js/pzpr.js"); var testdata = require("../load_testdata.js"); -function assert_equal_board(bd1, bd2) { - bd1.compareData(bd2, function(group, c, a) { - assert.equal( - bd2[group][c][a], - bd1[group][c][a], - group + "[" + c + "]." + a - ); - }); -} - pzpr.variety.each(function(pid) { describe(pid + " encode test", function() { describe("URL", function() { @@ -34,34 +24,6 @@ pzpr.variety.each(function(pid) { testdata[pid].url; assert.equal(urlstr, expurl); }); - if (!pzpr.variety(pid).exists.kanpen) { - return; - } - it("kanpen URL", function() { - puzzle.open(pid + "/" + testdata[pid].url); - var kanpen_url = puzzle.getURL(pzpr.parser.URL_KANPEN); - assert.equal(pzpr.parser(kanpen_url).pid, pid); - - var bd = puzzle.board, - bd2 = bd.freezecopy(); - puzzle.open(kanpen_url, function() { - assert_equal_board(bd, bd2); - }); - }); - if (pid !== "heyawake") { - return; - } - it("Heyawake-Applet URL", function() { - puzzle.open(pid + "/" + testdata[pid].url); - var heywakeapp_url = puzzle.getURL(pzpr.parser.URL_HEYAAPP); - assert.equal(pzpr.parser(heywakeapp_url).pid, pid); - - var bd = puzzle.board, - bd2 = bd.freezecopy(); - puzzle.open(heywakeapp_url, function() { - assert_equal_board(bd, bd2); - }); - }); })(pid); }); }); diff --git a/test/puzzle/filedata_test.js b/test/puzzle/filedata_test.js index ea8b9d919..41a0f59cd 100644 --- a/test/puzzle/filedata_test.js +++ b/test/puzzle/filedata_test.js @@ -41,27 +41,6 @@ pzpr.variety.each(function(pid) { assert_equal_board(bd, bd2, false); }); }); - if (!pzpr.variety(pid).exists.pencilbox) { - return; - } - it("Kanpen file", function() { - var bd = puzzle.board, - bd2 = bd.freezecopy(); - var outputstr = puzzle.getFileData(pzpr.parser.FILE_PBOX); - - puzzle.open(outputstr, function() { - assert_equal_board(bd, bd2, true); - }); - }); - it("Kanpen XML file", function() { - var bd = puzzle.board, - bd2 = bd.freezecopy(); - var outputstr = puzzle.getFileData(pzpr.parser.FILE_PBOX_XML); - - puzzle.open(outputstr, function() { - assert_equal_board(bd, bd2, true); - }); - }); }); }); });