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..fd12cab49 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() 仮置きデータを復旧する @@ -447,10 +424,6 @@ // fio.decodeCellXMLBoard() 配列で、個別文字列から個別セルの設定を行う (XML board用) // fio.decodeCellXMLBrow() 配列で、個別文字列から個別セルの設定を行う (XML board用) // fio.decodeCellXMLArow() 配列で、個別文字列から個別セルの設定を行う (XML answer用) - // fio.encodeCellXMLBoard() 個別セルデータから個別文字列の設定を行う (XML board用) - // fio.encodeCellXMLBrow() 個別セルデータから個別文字列の設定を行う (XML board用) - // fio.encodeCellXMLArow() 個別セルデータから個別文字列の設定を行う (XML answer用) - // fio.createXMLNode() 指定されたattributeを持つXMLのノードを作成する //--------------------------------------------------------------------------- decodeCellXMLBoard: function(func) { var nodes = this.xmldoc.querySelectorAll("board number"); @@ -465,37 +438,14 @@ } } }, - encodeCellXMLBoard: function(func) { - var boardnode = this.xmldoc.querySelector("board"); - var bd = this.board; - for (var i = 0; i < bd.cell.length; i++) { - var cell = bd.cell[i], - val = func(cell); - if (val !== null) { - boardnode.appendChild( - this.createXMLNode("number", { - r: ((cell.by / 2) | 0) + 1, - c: ((cell.bx / 2) | 0) + 1, - n: val - }) - ); - } - } - }, PBOX_ADJUST: 0, decodeCellXMLBrow: function(func) { this.decodeCellXMLrow_com(func, "board", "brow"); }, - encodeCellXMLBrow: function(func) { - this.encodeCellXMLrow_com(func, "board", "brow"); - }, decodeCellXMLArow: function(func) { this.decodeCellXMLrow_com(func, "answer", "arow"); }, - encodeCellXMLArow: function(func) { - this.encodeCellXMLrow_com(func, "answer", "arow"); - }, decodeCellXMLrow_com: function(func, parentnodename, targetnodename) { var rownodes = this.xmldoc.querySelectorAll( parentnodename + " " + targetnodename @@ -522,40 +472,6 @@ } } } - }, - encodeCellXMLrow_com: function(func, parentnodename, targetnodename) { - var boardnode = this.xmldoc.querySelector(parentnodename); - var ADJ = this.PBOX_ADJUST; - var bd = this.board; - for (var by = 1 - ADJ; by <= bd.maxby; by += 2) { - var rownode = this.createXMLNode(targetnodename, { - row: (((by + ADJ) / 2) | 0) + 1 - }); - for (var bx = 1 - ADJ; bx <= bd.maxbx; bx += 2) { - var piece = bd.getobj(bx, by), - nodename = func(piece), - node; - if (nodename.match(/n(\d\d+)/) || nodename.match(/n(\-\d+)/)) { - node = this.createXMLNode("n", { v: RegExp.$1 }); - } else if (nodename === "n0") { - node = this.createXMLNode("z"); - } else { - node = this.createXMLNode(nodename); - } - rownode.appendChild(node); - } - boardnode.appendChild(rownode); - } - }, - - createXMLNode: function(name, attrs) { - var node = this.xmldoc.createElement(name); - if (!!attrs) { - for (var i in attrs) { - node.setAttribute(i, attrs[i]); - } - } - return node; } } }); diff --git a/src/pzpr/parser.js b/src/pzpr/parser.js index ac2ab4ba1..1e1e94964 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); } @@ -661,26 +636,9 @@ col = pzl.cols, row = pzl.rows, out = []; - var puzzlenode = - this.type === FILE_PBOX_XML ? this.body.querySelector("puzzle") : null; /* サイズを表す文字列 */ - if (pzl.type === FILE_PBOX_XML) { - var sizenode = puzzlenode.querySelector("size"); - if (sizenode) { - puzzlenode.removeChild(sizenode); - } - if (pzl.pid === "slither" || pzl.pid === "kakuro") { - row++; - col++; - } - puzzlenode.appendChild( - this.createXMLNode("size", { row: row, col: col }) - ); - } else if (pzl.type === FILE_PBOX && pzl.pid === "kakuro") { - out.push(row + 1); - out.push(col + 1); - } else if (pzl.pid === "sudoku") { + if (pzl.pid === "sudoku") { out.push(col); } else { out.push(row); @@ -688,9 +646,7 @@ } /* サイズ以降のデータを設定 */ - if (pzl.type !== FILE_PBOX_XML) { - out.push(pzl.body); - } + out.push(pzl.body); /* 履歴・メタデータ出力がある形式ならば出力する */ if (pzl.type === FILE_PZPR && !!JSON) { @@ -703,54 +659,9 @@ } else if (pzl.history) { out.push("history:" + JSON.stringify(pzl.history, null, 1)); } - } else if (pzl.type === FILE_PBOX_XML) { - var propnode = puzzlenode.querySelector("property"); - if (propnode) { - puzzlenode.removeChild(propnode); - } - propnode = this.createXMLNode("property"); - var meta = pzl.metadata; - propnode.appendChild( - this.createXMLNode("author", { value: meta.author }) - ); - propnode.appendChild( - this.createXMLNode("source", { value: meta.source }) - ); - propnode.appendChild( - this.createXMLNode("difficulty", { value: meta.hard }) - ); - if (!!meta.comment) { - var commentnode = this.createXMLNode("comment"); - commentnode.appendChild(this.body.createTextNode(meta.comment)); - propnode.appendChild(commentnode); - } - puzzlenode.appendChild(propnode); - - // 順番を入れ替え - puzzlenode.appendChild(puzzlenode.querySelector("board")); - 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; - }, - - createXMLNode: function(name, attrs) { - var node = this.body.createElement(name); - if (!!attrs) { - for (var i in attrs) { - node.setAttribute(i, attrs[i]); - } - } - return node; + return out.join("\n"); }, //--------------------------------------------------------------------------- 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..e4f3e688a 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, @@ -866,11 +852,6 @@ this.decodeCellXMLArow(function(cell, name) { cell.setState(+name.substr(1)); }); - }, - encodeBorderLine_satogaeri_XMLAnswer: function() { - this.encodeCellXMLArow(function(cell) { - return "n" + cell.getState(); - }); } }, 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..4bc431394 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) { @@ -330,16 +323,6 @@ } }); }, - encodeGoishi_kanpen: function() { - var bd = this.board; - for (var by = bd.minby + 1; by < bd.maxby; by += 2) { - var data = ""; - for (var bx = bd.minbx + 1; bx < bd.maxbx; bx += 2) { - data += bd.getc(bx, by).isStone() ? "1 " : ". "; - } - this.writeLine(data); - } - }, decodeQansPos_kanpen: function() { for (;;) { @@ -357,34 +340,11 @@ } } }, - encodeQansPos_kanpen: function() { - var stones = [], - bd = this.board; - for (var by = bd.minby + 1; by < bd.maxby; by += 2) { - for (var bx = bd.minbx + 1; bx < bd.maxbx; bx += 2) { - var cell = bd.getc(bx, by); - if (cell.ques !== 0 || cell.anum === -1) { - continue; - } - - var pos = [bx >> 1, by >> 1]; - stones[cell.anum - 1] = pos; - } - } - for (var i = 0, len = stones.length; i < len; i++) { - var item = [i + 1, stones[i][1], stones[i][0]]; - this.writeLine(item.join(" ")); - } - }, kanpenOpenXML: function() { 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) { @@ -393,11 +353,6 @@ } }); }, - encodeCellQnum_goishi_XMLBoard: function() { - this.encodeCellXMLBoard(function(cell) { - return cell.ques === 0 ? "1" : null; - }); - }, decodeQansPos_XMLAnswer: function() { var nodes = this.xmldoc.querySelectorAll("answer picked"); @@ -407,29 +362,6 @@ var by = 2 * +node.getAttribute("r") - 1; this.board.getc(bx, by).anum = +node.getAttribute("n"); } - }, - encodeQansPos_XMLAnswer: function() { - var boardnode = this.xmldoc.querySelector("answer"); - var bd = this.board; - for (var ans = 1; ; ans++) { - var cell = null; - for (var c = 0; c < bd.cell.length; c++) { - if (bd.cell[c].anum === ans) { - cell = bd.cell[c]; - break; - } - } - if (!cell) { - break; - } - boardnode.appendChild( - this.createXMLNode("picked", { - n: ans, - r: (cell.by >> 1) + 1, - c: (cell.bx >> 1) + 1 - }) - ); - } } }, diff --git a/src/variety/hashikake.js b/src/variety/hashikake.js index 3a513b7fc..71810503f 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, @@ -402,11 +381,6 @@ this.decodeCellXMLArow(function(cell, name) { cell.setState(+name.substr(1)); }); - }, - encodeBorderLine_hashikake_XMLAnswer: function() { - this.encodeCellXMLArow(function(cell) { - return "n" + cell.getState(); - }); } }, diff --git a/src/variety/heyawake.js b/src/variety/heyawake.js index b84c9cc84..31edb3a5c 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"); @@ -365,25 +343,6 @@ } this.rdata2Border(true, rdata); bd.roommgr.rebuild(); - }, - encodeSquareRoom_XMLBoard: function() { - var boardnode = this.xmldoc.querySelector("board"); - var bd = this.board; - bd.roommgr.rebuild(); - var rooms = bd.roommgr.components; - for (var r = 0; r < rooms.length; r++) { - var d = rooms[r].clist.getRectSize(), - num = rooms[r].top.qnum; - boardnode.appendChild( - this.createXMLNode("area", { - r0: (d.y1 >> 1) + 1, - c0: (d.x1 >> 1) + 1, - r1: (d.y2 >> 1) + 1, - c1: (d.x2 >> 1) + 1, - n: num - }) - ); - } } }, "FileIO@akichi": { 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..b817941db 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; @@ -358,34 +351,6 @@ } } }, - encodeCellQnum51_kanpen: function() { - var bd = this.board; - for (var by = bd.minby + 1; by < bd.maxby; by += 2) { - for (var bx = bd.minbx + 1; bx < bd.maxbx; bx += 2) { - var item = [(by + 1) >> 1, (bx + 1) >> 1, 0, 0]; - - if (bx === -1 && by === -1) { - } else if (bx === -1 || by === -1) { - var excell = bd.getex(bx, by); - if (bx === -1) { - item[2] = excell.qnum; - } - if (by === -1) { - item[3] = excell.qnum2; - } - } else { - var cell = bd.getc(bx, by); - if (cell.ques !== 51) { - continue; - } - item[2] = cell.qnum; - item[3] = cell.qnum2; - } - this.writeLine(item.join(" ")); - } - } - this.writeLine(""); // 空行を出力 - }, decodeQans_kanpen: function() { this.decodeCellExCell(function(obj, ca) { @@ -394,23 +359,11 @@ } }); }, - encodeQans_kanpen: function() { - this.encodeCellExCell(function(obj) { - if (obj.ques !== 51) { - return (obj.anum > 0 ? obj.anum : "0") + " "; - } - return ". "; - }); - }, kanpenOpenXML: function() { 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"); @@ -427,27 +380,6 @@ piece.qnum2 = b; } }, - encodeCellQnum51_XMLBoard: function() { - var boardnode = this.xmldoc.querySelector("board"); - var bd = this.board; - for (var by = -1; by < bd.maxby; by += 2) { - for (var bx = -1; bx < bd.maxbx; bx += 2) { - var piece = bd.getobj(bx, by); /* cell or excell */ - if (piece.ques === 51) { - var a = piece.qnum; - var b = piece.qnum2; - boardnode.appendChild( - this.createXMLNode("wall", { - r: (by + 3) >> 1, - c: (bx + 3) >> 1, - a: a, - b: b - }) - ); - } - } - } - }, PBOX_ADJUST: 2, decodeCellAnum_kakuro_XMLAnswer: function() { @@ -456,14 +388,6 @@ cell.anum = +name.substr(1); } }); - }, - encodeCellAnum_kakuro_XMLAnswer: function() { - this.encodeCellXMLArow(function(cell) { - if (cell.ques === 0 && cell.anum === -1) { - return "n0"; - } - return "n" + cell.anum; - }); } }, 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..6a6f86c0f 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,33 +351,13 @@ 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, - encodeCellAns_kurodoko_XMLAnswer: function() { - this.encodeCellXMLArow(function(cell) { - if (cell.qnum === -1) { - if (cell.qans === 1) { - return "w"; - } else if (cell.qsub === 1) { - return "s"; - } - } - return "u"; - }); - } + 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..4ff41141d 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) { @@ -309,21 +299,6 @@ cell.qnum = -2; } }); - }, - encodeCellQnumAns_XMLBoard: function() { - this.encodeCellXMLBoard(function(cell) { - var val = 0; - if (cell.qnum > 0) { - val = cell.qnum; - } else if (cell.qnum === -2) { - val = -3; - } else if (cell.qans === 1) { - val = -2; - } else if (cell.qsub === 1) { - val = -1; - } - return val; - }); } }, "FileIO@canal": { 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..2798a74ce 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, @@ -606,16 +578,6 @@ cell.qsub = 1; } }); - }, - encodeCellShakashaka_XMLAnswer: function() { - this.encodeCellXMLArow(function(cell) { - if (cell.qans > 0) { - return "n" + (((cell.qans - 1) & 3) + 4); - } else if (cell.qsub === 1) { - return "s"; - } - return "u"; - }); } }, diff --git a/src/variety/shikaku.js b/src/variety/shikaku.js index 06803827f..89b77df9b 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) { @@ -158,17 +147,6 @@ } }); }, - encodeCellQnum_shikaku_XMLBoard: function() { - this.encodeCellXMLBoard(function(cell) { - var val = 0; - if (cell.qnum >= 1) { - val = cell.qnum; - } else if (cell.qnum === -2) { - val = -1; - } - return val; - }); - }, decodeAnsSquareRoom_XMLAnswer: function() { var nodes = this.xmldoc.querySelectorAll("answer area"); @@ -188,23 +166,6 @@ } this.rdata2Border(false, rdata); bd.roommgr.rebuild(); - }, - encodeAnsSquareRoom_XMLAnswer: function() { - var boardnode = this.xmldoc.querySelector("answer"); - var bd = this.board; - bd.roommgr.rebuild(); - var rooms = bd.roommgr.components; - for (var id = 0; id < rooms.length; id++) { - var d = rooms[id].clist.getRectSize(); - boardnode.appendChild( - this.createXMLNode("area", { - r0: (d.y1 >> 1) + 1, - c0: (d.x1 >> 1) + 1, - r1: (d.y2 >> 1) + 1, - c1: (d.x2 >> 1) + 1 - }) - ); - } } }, //--------------------------------------------------------- diff --git a/src/variety/slalom.js b/src/variety/slalom.js index a5efcc7fa..0b03debcb 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; @@ -1116,31 +1109,11 @@ }); bd.gatemgr.rebuild(); }, - encodeBoard_kanpen: function() { - var bd = this.board; - this.encodeCell(function(cell) { - if (bd.startpos.equals(cell)) { - return "+ "; - } else if (cell.ques === 21) { - return "| "; - } else if (cell.ques === 22) { - return "- "; - } else if (cell.ques === 1) { - return cell.qnum > 0 ? cell.qnum + " " : "0 "; - } else { - return ". "; - } - }); - }, kanpenOpenXML: function() { this.decodeCellSlalom_XMLBoard(); this.decodeBorderLine_XMLAnswer(); }, - kanpenSaveXML: function() { - this.encodeCellSlalom_XMLBoard(); - this.encodeBorderLine_XMLAnswer(); - }, UNDECIDED_NUM_XML: -3, decodeCellSlalom_XMLBoard: function() { @@ -1161,22 +1134,6 @@ }); bd.gatemgr.rebuild(); }, - encodeCellSlalom_XMLBoard: function() { - var bd = this.board; - this.encodeCellXMLBoard(function(cell) { - var val = -3; - if (cell.ques === 1) { - val = cell.qnum > 0 ? cell.qnum : 0; - } else if (cell.ques === 21) { - val = -5; - } else if (cell.ques === 22) { - val = -4; - } else if (bd.startpos.equals(cell)) { - val = -1; - } - return val; - }); - }, decodeBoard_old: function() { var sv_num = [], diff --git a/src/variety/slither.js b/src/variety/slither.js index 1d13f004b..691835712 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, @@ -351,39 +338,6 @@ bdv.qsub = 2; } }); - }, - encodeBorderLine_slither_XMLAnswer: function() { - this.encodeCellXMLArow(function(cross) { - var val = 0, - nodename = ""; - var bdh = cross.relbd(0, 1), - bdv = cross.relbd(1, 0); - 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/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..ebe662488 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) { @@ -639,42 +632,11 @@ } }); }, - encodeCellDirecQnum_kanpen: function(isurl) { - this.encodeCell(function(cell) { - var num = cell.qnum >= 0 && cell.qnum < 16 ? cell.qnum : -1, - dir; - if (num !== -1 && cell.qdir !== cell.NDIR) { - if (cell.qdir === cell.UP) { - dir = 0; - } else if (cell.qdir === cell.LT) { - dir = 1; - } else if (cell.qdir === cell.DN) { - dir = 2; - } else if (cell.qdir === cell.RT) { - dir = 3; - } - return "" + ((dir << 4) + (num & 0x0f)) + " "; - } else if (cell.qnum === -2) { - return "-4 "; - } else if (!isurl) { - if (cell.qans === 1) { - return "# "; - } else if (cell.qsub === 1) { - return "+ "; - } - } - return ". "; - }); - }, kanpenOpenXML: function() { this.decodeCellDirecQnum_XMLBoard(); this.decodeBorderLine_XMLAnswer(); }, - kanpenSaveXML: function() { - this.encodeCellDirecQnum_XMLBoard(); - this.encodeBorderLine_XMLAnswer(); - }, decodeCellDirecQnum_XMLBoard: function() { this.decodeCellXMLBoard(function(cell, val) { @@ -698,31 +660,6 @@ cell.qnum = -2; } }); - }, - encodeCellDirecQnum_XMLBoard: function() { - this.encodeCellXMLBoard(function(cell) { - var val = -3, - dir = 0; - if (cell.qnum !== -1 && cell.qdir !== cell.NDIR) { - if (cell.qdir === cell.UP) { - dir = 0; - } else if (cell.qdir === cell.LT) { - dir = 1; - } else if (cell.qdir === cell.DN) { - dir = 2; - } else if (cell.qdir === cell.RT) { - dir = 3; - } - val = (dir << 4) + (cell.qnum & 0x0f); - } else if (cell.qnum === -2) { - val = -4; - } else if (cell.qans === 1) { - val = -2; - } else if (cell.qsub === 1) { - val = -1; - } - return val; - }); } }, "FileIO@yajilin-regions": { 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); - }); - }); }); }); });