|
| 1 | +(function(pidlist, classbase) { |
| 2 | + if (typeof module === "object" && module.exports) { |
| 3 | + module.exports = [pidlist, classbase]; |
| 4 | + } else { |
| 5 | + pzpr.classmgr.makeCustom(pidlist, classbase); |
| 6 | + } |
| 7 | +})(["nuriloop"], { |
| 8 | + MouseEvent: { |
| 9 | + use: true, |
| 10 | + inputModes: { |
| 11 | + edit: ["number", "clear", "info-line"], |
| 12 | + play: ["line", "peke", "subcircle", "subcross", "info-line"] |
| 13 | + }, |
| 14 | + autoedit_func: "qnum", |
| 15 | + autoplay_func: "lineMB" |
| 16 | + }, |
| 17 | + |
| 18 | + KeyEvent: { |
| 19 | + enablemake: true |
| 20 | + }, |
| 21 | + |
| 22 | + Board: { |
| 23 | + hasborder: 1 |
| 24 | + }, |
| 25 | + Border: { |
| 26 | + enableLineNG: true |
| 27 | + }, |
| 28 | + Cell: { |
| 29 | + maxnum: function() { |
| 30 | + return this.board.cols * this.board.rows; |
| 31 | + }, |
| 32 | + noLP: function() { |
| 33 | + return this.isNum(); |
| 34 | + }, |
| 35 | + isUnshade: function() { |
| 36 | + return this.lcnt === 0; |
| 37 | + } |
| 38 | + }, |
| 39 | + LineGraph: { |
| 40 | + enabled: true |
| 41 | + }, |
| 42 | + AreaUnshadeGraph: { |
| 43 | + enabled: true, |
| 44 | + relation: { "border.line": "block" }, |
| 45 | + modifyOtherInfo: function(border, relation) { |
| 46 | + this.setEdgeByNodeObj(border.sidecell[0]); |
| 47 | + this.setEdgeByNodeObj(border.sidecell[1]); |
| 48 | + } |
| 49 | + }, |
| 50 | + |
| 51 | + Graphic: { |
| 52 | + irowake: true, |
| 53 | + gridcolor_type: "LIGHT", |
| 54 | + numbercolor_func: "qnum", |
| 55 | + qanscolor: "black", |
| 56 | + |
| 57 | + paint: function() { |
| 58 | + this.drawBGCells(); |
| 59 | + this.drawGrid(); |
| 60 | + |
| 61 | + this.drawQuesNumbers(); |
| 62 | + |
| 63 | + this.drawMBs(); |
| 64 | + this.drawLines(); |
| 65 | + this.drawPekes(); |
| 66 | + |
| 67 | + this.drawChassis(); |
| 68 | + |
| 69 | + this.drawTarget(); |
| 70 | + } |
| 71 | + }, |
| 72 | + |
| 73 | + Encode: { |
| 74 | + decodePzpr: function(type) { |
| 75 | + this.decodeNumber16(); |
| 76 | + }, |
| 77 | + encodePzpr: function(type) { |
| 78 | + this.encodeNumber16(); |
| 79 | + } |
| 80 | + }, |
| 81 | + FileIO: { |
| 82 | + decodeData: function() { |
| 83 | + this.decodeCellQnum(); |
| 84 | + this.decodeCellQsub(); |
| 85 | + this.decodeBorderLine(); |
| 86 | + }, |
| 87 | + encodeData: function() { |
| 88 | + this.encodeCellQnum(); |
| 89 | + this.encodeCellQsub(); |
| 90 | + this.encodeBorderLine(); |
| 91 | + } |
| 92 | + }, |
| 93 | + |
| 94 | + AnsCheck: { |
| 95 | + checklist: [ |
| 96 | + "checkLineExist+", |
| 97 | + "checkBranchLine", |
| 98 | + "checkCrossLine", |
| 99 | + "checkLineOverlap", |
| 100 | + |
| 101 | + "checkNoNumberInUnshade", |
| 102 | + "checkDoubleNumberInUnshade", |
| 103 | + "checkNumberAndUnshadeSize", |
| 104 | + |
| 105 | + "checkDeadendLine+", |
| 106 | + "checkOneLoop" |
| 107 | + ], |
| 108 | + |
| 109 | + checkLineOverlap: function() { |
| 110 | + this.checkAllCell(function(cell) { |
| 111 | + return cell.lcnt > 0 && cell.qnum !== -1; |
| 112 | + }, "lnOverlap"); |
| 113 | + }, |
| 114 | + |
| 115 | + checkDoubleNumberInUnshade: function() { |
| 116 | + this.checkAllBlock( |
| 117 | + this.board.ublkmgr, |
| 118 | + function(cell) { |
| 119 | + return cell.isNum(); |
| 120 | + }, |
| 121 | + function(w, h, a, n) { |
| 122 | + return a < 2; |
| 123 | + }, |
| 124 | + "bkNumGe2" |
| 125 | + ); |
| 126 | + }, |
| 127 | + checkNumberAndUnshadeSize: function() { |
| 128 | + this.checkAllCell(function(cell) { |
| 129 | + if (!cell.isValidNum()) { |
| 130 | + return false; |
| 131 | + } |
| 132 | + if (!cell.ublk) { |
| 133 | + return true; |
| 134 | + } |
| 135 | + |
| 136 | + if (cell.ublk.clist.length !== cell.getNum()) { |
| 137 | + cell.ublk.clist.seterr(1); |
| 138 | + return true; |
| 139 | + } |
| 140 | + return false; |
| 141 | + }, "bkSizeNe"); |
| 142 | + }, |
| 143 | + |
| 144 | + checkNoNumberInUnshade: function() { |
| 145 | + this.checkAllBlock( |
| 146 | + this.board.ublkmgr, |
| 147 | + function(cell) { |
| 148 | + return cell.isNum(); |
| 149 | + }, |
| 150 | + function(w, h, a, n) { |
| 151 | + return a !== 0; |
| 152 | + }, |
| 153 | + "bkNoNum" |
| 154 | + ); |
| 155 | + } |
| 156 | + }, |
| 157 | + FailCode: { |
| 158 | + lnOverlap: "lnOverlap.tontti" |
| 159 | + } |
| 160 | +}); |
0 commit comments