|
| 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 | +})(["bwloop"], { |
| 8 | + //--------------------------------------------------------- |
| 9 | + // マウス入力系 |
| 10 | + MouseEvent: { |
| 11 | + inputModes: { |
| 12 | + edit: ["circle-shade", "circle-unshade", "undef", "clear", "info-line"], |
| 13 | + play: ["line", "peke", "info-line"] |
| 14 | + }, |
| 15 | + |
| 16 | + autoedit_func: "qnum", |
| 17 | + autoplay_func: "line" |
| 18 | + }, |
| 19 | + |
| 20 | + //--------------------------------------------------------- |
| 21 | + // キーボード入力系 |
| 22 | + KeyEvent: { |
| 23 | + enablemake: true |
| 24 | + }, |
| 25 | + |
| 26 | + //--------------------------------------------------------- |
| 27 | + // 盤面管理系 |
| 28 | + Cell: { |
| 29 | + numberAsObject: true, |
| 30 | + maxnum: 2 |
| 31 | + }, |
| 32 | + |
| 33 | + Board: { |
| 34 | + hasborder: 1 |
| 35 | + }, |
| 36 | + |
| 37 | + LineGraph: { |
| 38 | + enabled: true |
| 39 | + }, |
| 40 | + |
| 41 | + //--------------------------------------------------------- |
| 42 | + // 画像表示系 |
| 43 | + Graphic: { |
| 44 | + irowake: true, |
| 45 | + |
| 46 | + gridcolor_type: "LIGHT", |
| 47 | + |
| 48 | + circlefillcolor_func: "qnum2", |
| 49 | + circlestrokecolor_func: "qnum2", |
| 50 | + |
| 51 | + paint: function() { |
| 52 | + this.drawBGCells(); |
| 53 | + this.drawDashedGrid(); |
| 54 | + |
| 55 | + this.drawCircles(); |
| 56 | + this.drawHatenas(); |
| 57 | + |
| 58 | + this.drawPekes(); |
| 59 | + this.drawLines(); |
| 60 | + |
| 61 | + this.drawChassis(); |
| 62 | + |
| 63 | + this.drawTarget(); |
| 64 | + } |
| 65 | + }, |
| 66 | + |
| 67 | + //--------------------------------------------------------- |
| 68 | + // URLエンコード/デコード処理 |
| 69 | + Encode: { |
| 70 | + decodePzpr: function(type) { |
| 71 | + this.decodeCircle(); |
| 72 | + this.puzzle.setConfig("loop_full", this.checkpflag("f")); |
| 73 | + }, |
| 74 | + encodePzpr: function(type) { |
| 75 | + this.outpflag = this.puzzle.getConfig("loop_full") ? "f" : null; |
| 76 | + this.encodeCircle(); |
| 77 | + } |
| 78 | + }, |
| 79 | + //--------------------------------------------------------- |
| 80 | + FileIO: { |
| 81 | + decodeData: function() { |
| 82 | + this.decodeConfigFlag("f", "loop_full"); |
| 83 | + this.decodeCellQnum(); |
| 84 | + this.decodeBorderLine(); |
| 85 | + }, |
| 86 | + encodeData: function() { |
| 87 | + this.encodeConfigFlag("f", "loop_full"); |
| 88 | + this.encodeCellQnum(); |
| 89 | + this.encodeBorderLine(); |
| 90 | + } |
| 91 | + }, |
| 92 | + |
| 93 | + AnsCheck: { |
| 94 | + checklist: [ |
| 95 | + "checkLineExist+", |
| 96 | + "checkBranchLine", |
| 97 | + "checkCrossLine", |
| 98 | + |
| 99 | + "checkEqualCircles", |
| 100 | + "checkDiffCircles", |
| 101 | + "checkTwoCorners", |
| 102 | + |
| 103 | + "checkNoLinePearl", |
| 104 | + "checkDeadendLine+", |
| 105 | + "checkNoLineIfVariant", |
| 106 | + "checkOneLoop" |
| 107 | + ], |
| 108 | + |
| 109 | + checkNoLinePearl: function() { |
| 110 | + this.checkAllCell(function(cell) { |
| 111 | + return cell.isNum() && cell.lcnt === 0; |
| 112 | + }, "mashuOnLine"); |
| 113 | + }, |
| 114 | + |
| 115 | + checkEqualCircles: function() { |
| 116 | + this.checkLineShape(function(path) { |
| 117 | + var cell1 = path.cells[0], |
| 118 | + cell2 = path.cells[1]; |
| 119 | + |
| 120 | + if ( |
| 121 | + cell1.qnum !== cell2.qnum || |
| 122 | + !cell1.isValidNum() || |
| 123 | + !cell2.isValidNum() |
| 124 | + ) { |
| 125 | + return false; |
| 126 | + } |
| 127 | + return path.ccnt === 1; |
| 128 | + }, "lcCurveNe0"); |
| 129 | + }, |
| 130 | + checkDiffCircles: function() { |
| 131 | + this.checkLineShape(function(path) { |
| 132 | + var cell1 = path.cells[0], |
| 133 | + cell2 = path.cells[1]; |
| 134 | + |
| 135 | + if ( |
| 136 | + cell1.qnum === cell2.qnum || |
| 137 | + !cell1.isValidNum() || |
| 138 | + !cell2.isValidNum() |
| 139 | + ) { |
| 140 | + return false; |
| 141 | + } |
| 142 | + return path.ccnt === 0; |
| 143 | + }, "lcCurveNe1"); |
| 144 | + }, |
| 145 | + checkTwoCorners: function() { |
| 146 | + this.checkLineShape(function(path) { |
| 147 | + return path.ccnt > 1; |
| 148 | + }, "lcCurveGt1"); |
| 149 | + } |
| 150 | + } |
| 151 | +}); |
0 commit comments