|
13 | 13 | "pentatouch", |
14 | 14 | "kissing", |
15 | 15 | "retroships", |
16 | | - "regional-poly" |
| 16 | + "regional-poly", |
| 17 | + "distopia" |
17 | 18 | ]; |
18 | 19 | if (typeof module === "object" && module.exports) { |
19 | 20 | module.exports = [pidlist, classbase]; |
|
154 | 155 | cell.setNum(newdir); |
155 | 156 | } |
156 | 157 | }, |
| 158 | + "MouseEvent@distopia#1": { |
| 159 | + inputModes: { |
| 160 | + edit: ["number", "clear", "completion"], |
| 161 | + play: ["shade", "unshade", "clear", "completion"] |
| 162 | + } |
| 163 | + }, |
157 | 164 |
|
158 | 165 | "MouseEvent@battleship#1": { |
159 | 166 | inputModes: { |
|
880 | 887 | } |
881 | 888 | }, |
882 | 889 |
|
| 890 | + "Cell@distopia": { |
| 891 | + minnum: 0, |
| 892 | + maxnum: function() { |
| 893 | + var a = this.board.rows - 1, |
| 894 | + b = this.board.cols - 1; |
| 895 | + return Math.max(a, b, 2 * Math.min(a, b)); |
| 896 | + }, |
| 897 | + allowShade: function() { |
| 898 | + return this.puzzle.getConfig("pentopia_transparent") || this.qnum === -1; |
| 899 | + } |
| 900 | + }, |
| 901 | + |
883 | 902 | "Cell@pentopia": { |
884 | 903 | numberAsObject: true, |
885 | 904 | maxnum: 15, |
|
1167 | 1186 | this.drawCrossMarks(); |
1168 | 1187 | } else if (this.pid === "statuepark") { |
1169 | 1188 | this.drawCircles(); |
| 1189 | + } else if (this.pid === "distopia") { |
| 1190 | + this.drawQuesNumbers(); |
1170 | 1191 | } else if (this.pid === "pentopia") { |
1171 | 1192 | this.drawArrowCombinations(); |
1172 | 1193 | this.drawHatenas(); |
|
1206 | 1227 | } |
1207 | 1228 | }, |
1208 | 1229 |
|
1209 | | - "Graphic@pentopia": { |
| 1230 | + "Graphic@pentopia,distopia#1": { |
1210 | 1231 | enablebcolor: true, |
1211 | 1232 |
|
1212 | 1233 | shadecolor: "rgb(80, 80, 80)", |
|
1217 | 1238 | return cell.isShade() ? this.errbcolor1 : this.errcolor1; |
1218 | 1239 | } |
1219 | 1240 | return cell.isShade() ? "white" : this.quescolor; |
1220 | | - }, |
1221 | | - |
| 1241 | + } |
| 1242 | + }, |
| 1243 | + "Graphic@pentopia": { |
1222 | 1244 | drawArrowCombinations: function() { |
1223 | 1245 | var g = this.vinc("cell_arrow"); |
1224 | 1246 |
|
|
1749 | 1771 | this.encodePieceBank(); |
1750 | 1772 | } |
1751 | 1773 | }, |
1752 | | - "Encode@pentopia,retroships": { |
| 1774 | + "Encode@pentopia,distopia,retroships": { |
1753 | 1775 | decodePzpr: function(type) { |
1754 | 1776 | this.puzzle.setConfig("pentopia_transparent", this.checkpflag("t")); |
1755 | 1777 | if (this.outbstr[0] !== "/") { |
|
1873 | 1895 | encodeConfig: function() {} |
1874 | 1896 | }, |
1875 | 1897 |
|
1876 | | - "FileIO@pentopia": { |
| 1898 | + "FileIO@pentopia,distopia": { |
1877 | 1899 | decodeConfig: function() { |
1878 | 1900 | this.decodeConfigFlag("t", "pentopia_transparent"); |
1879 | 1901 | }, |
|
2052 | 2074 | } |
2053 | 2075 | }, |
2054 | 2076 |
|
2055 | | - "AnsCheck@pentopia,battleship,retroships,pentatouch,regional-poly#1": { |
| 2077 | + "AnsCheck@pentopia,distopia,battleship,retroships,pentatouch,regional-poly#1": { |
2056 | 2078 | checkShadeDiagonal: function() { |
2057 | 2079 | var bd = this.board; |
2058 | 2080 | for (var c = 0; c < bd.cell.length; c++) { |
|
2092 | 2114 | } |
2093 | 2115 | }, |
2094 | 2116 |
|
2095 | | - "AnsCheck@pentopia": { |
| 2117 | + "AnsCheck@pentopia,distopia#1": { |
2096 | 2118 | checklist: [ |
2097 | 2119 | "checkShadeOnArrow", |
2098 | 2120 | "checkBankPiecesAvailable", |
2099 | 2121 | "checkShadeDiagonal", |
2100 | | - "checkShadeDirCloser", |
2101 | | - "checkShadeDirUnequal", |
2102 | | - "checkShadeDirExist", |
| 2122 | + "checkShadeDirCloser@pentopia", |
| 2123 | + "checkShadeDirUnequal@pentopia", |
| 2124 | + "checkShadeDirExist@pentopia", |
| 2125 | + "checkNumberEqual@distopia", |
| 2126 | + "checkNumberExist@distopia", |
2103 | 2127 | "checkBankPiecesInvalid+" |
2104 | 2128 | ], |
2105 | 2129 |
|
|
2121 | 2145 |
|
2122 | 2146 | for (var c = 0; c < bd.cell.length; c++) { |
2123 | 2147 | var cell0 = bd.cell[c]; |
2124 | | - if (cell0.qnum <= 0) { |
| 2148 | + if (this.pid === "pentopia" && cell0.qnum <= 0) { |
| 2149 | + continue; |
| 2150 | + } |
| 2151 | + if (this.pid === "distopia" && !cell0.isValidNum()) { |
2125 | 2152 | continue; |
2126 | 2153 | } |
2127 | 2154 | var row = [cell0, -1, -1, -1, -1]; |
|
2143 | 2170 | } |
2144 | 2171 |
|
2145 | 2172 | return (this._info.shadeDirs = ret); |
2146 | | - }, |
| 2173 | + } |
| 2174 | + }, |
| 2175 | + "AnsCheck@pentopia": { |
2147 | 2176 | checkShadeDirExist: function() { |
2148 | 2177 | var clues = this.getShadeDirs(); |
2149 | 2178 | for (var i in clues) { |
|
2236 | 2265 | } |
2237 | 2266 | } |
2238 | 2267 | }, |
| 2268 | + "AnsCheck@distopia": { |
| 2269 | + checkNumberEqual: function() { |
| 2270 | + var clues = this.getShadeDirs(); |
| 2271 | + for (var i in clues) { |
| 2272 | + var dist = this.board.cols * this.board.rows; |
| 2273 | + var count = 0; |
| 2274 | + |
| 2275 | + for (var dir = 1; dir <= 4; dir++) { |
| 2276 | + var d = clues[i][dir]; |
| 2277 | + if (d !== -1 && d < dist) { |
| 2278 | + count = 1; |
| 2279 | + dist = d; |
| 2280 | + } else if (d === dist) { |
| 2281 | + count++; |
| 2282 | + } |
| 2283 | + } |
| 2284 | + |
| 2285 | + if (count > 0 && clues[i][0].qnum !== dist * count) { |
| 2286 | + this.failcode.add("arDistance"); |
| 2287 | + if (this.checkOnly) { |
| 2288 | + return; |
| 2289 | + } |
| 2290 | + clues[i][0].seterr(1); |
| 2291 | + } |
| 2292 | + } |
| 2293 | + }, |
| 2294 | + |
| 2295 | + checkNumberExist: function() { |
| 2296 | + var clues = this.getShadeDirs(); |
| 2297 | + for (var i in clues) { |
| 2298 | + if (clues[i][0].qnum <= 0) { |
| 2299 | + continue; |
| 2300 | + } |
| 2301 | + |
| 2302 | + var found = false; |
| 2303 | + for (var dir = 1; dir <= 4 && !found; dir++) { |
| 2304 | + if (clues[i][dir] !== -1) { |
| 2305 | + found = true; |
| 2306 | + } |
| 2307 | + } |
| 2308 | + |
| 2309 | + if (!found) { |
| 2310 | + this.failcode.add("arNoShade"); |
| 2311 | + if (this.checkOnly) { |
| 2312 | + return; |
| 2313 | + } |
| 2314 | + clues[i][0].seterr(1); |
| 2315 | + } |
| 2316 | + } |
| 2317 | + } |
| 2318 | + }, |
2239 | 2319 |
|
2240 | 2320 | "AnsCheck@battleship,retroships": { |
2241 | 2321 | checklist: [ |
|
0 commit comments