-
Notifications
You must be signed in to change notification settings - Fork 56
Expand file tree
/
Copy pathfillmat.js
More file actions
200 lines (180 loc) · 4.15 KB
/
Copy pathfillmat.js
File metadata and controls
200 lines (180 loc) · 4.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
//
// パズル固有スクリプト部 フィルマット・ウソタタミ版 fillmat.js
//
(function(pidlist, classbase) {
if (typeof module === "object" && module.exports) {
module.exports = [pidlist, classbase];
} else {
pzpr.classmgr.makeCustom(pidlist, classbase);
}
})(["fillmat", "usotatami"], {
//---------------------------------------------------------
// マウス入力系
MouseEvent: {
inputModes: { edit: ["number", "clear"], play: ["border", "subline"] },
mouseinput_auto: function() {
if (this.puzzle.playmode) {
if (this.mousestart || this.mousemove) {
if (this.btn === "left" && this.isBorderMode()) {
this.inputborder();
} else {
this.inputQsubLine();
}
}
} else if (this.puzzle.editmode) {
if (this.mousestart) {
this.inputqnum();
}
}
}
},
//---------------------------------------------------------
// キーボード入力系
KeyEvent: {
enablemake: true
},
//---------------------------------------------------------
// 盤面管理系
"Cell@fillmat": {
maxnum: 4
},
Board: {
hasborder: 1
},
"Board@usotatami": {
cols: 8,
rows: 8
},
AreaRoomGraph: {
enabled: true
},
//---------------------------------------------------------
// 画像表示系
Graphic: {
gridcolor_type: "DLIGHT",
bordercolor_func: "qans",
numbercolor_func: "qnum",
paint: function() {
this.drawBGCells();
this.drawDashedGrid();
this.drawBorders();
this.drawQuesNumbers();
this.drawBorderQsubs();
this.drawChassis();
this.drawTarget();
}
},
//---------------------------------------------------------
// URLエンコード/デコード処理
"Encode@fillmat": {
decodePzpr: function(type) {
this.decodeNumber10();
},
encodePzpr: function(type) {
this.encodeNumber10();
}
},
"Encode@usotatami": {
decodePzpr: function(type) {
this.decodeNumber10or16();
},
encodePzpr: function(type) {
this.encodeNumber10or16();
}
},
//---------------------------------------------------------
FileIO: {
decodeData: function() {
this.decodeCellQnum();
this.decodeBorderAns();
},
encodeData: function() {
this.encodeCellQnum();
this.encodeBorderAns();
}
},
//---------------------------------------------------------
// 正解判定処理実行部
"AnsCheck@fillmat": {
checklist: [
"checkBorderCross",
"checkSideAreaRoomSize",
"checkTatamiMaxSize",
"checkDoubleNumber",
"checkNumberAndSize",
"checkBorderDeadend+"
],
checkTatamiMaxSize: function() {
this.checkAllArea(
this.board.roommgr,
function(w, h, a, n) {
return (w === 1 || h === 1) && a <= 4;
},
"bkLenGt4"
);
},
checkSideAreaRoomSize: function() {
this.checkSideAreaSize(
this.board.roommgr,
function(area) {
return area.clist.length;
},
"bsSizeEq"
);
}
},
"AnsCheck@usotatami": {
checklist: [
"checkBorderCross",
"checkNoNumber",
"checkDoubleNumber",
"checkTatamiDiffSize",
"checkBorderDeadend+",
"checkTatamiBreadth"
],
checkTatamiDiffSize: function() {
this.checkAllArea(
this.board.roommgr,
function(w, h, a, n) {
return n < 0 || n !== a;
},
"bkSizeEq"
);
},
checkTatamiBreadth: function() {
this.checkAllArea(
this.board.roommgr,
function(w, h, a, n) {
return w === 1 || h === 1;
},
"bkWidthGt1"
);
}
},
FailCode: {
bkNoNum: [
"数字の入っていないタタミがあります。",
"A tatami has no numbers."
],
bkNumGe2: [
"1つのタタミに2つ以上の数字が入っています。",
"A tatami has more than one number."
],
bkSizeNe: [
"数字とタタミの大きさが違います。",
"The number is different from the size of the tatami."
],
bkSizeEq: [
"数字とタタミの大きさが同じです。",
"The number is equal to the size of the tatami."
],
bkLenGt4: [
"「幅1マス、長さ1~4マス」ではないタタミがあります。",
"The width of the tatami is more than one, or the length is more than four."
],
bsSizeEq: [
"隣り合うタタミの大きさが同じです。",
"Tatamis of the same size are adjacent."
]
}
});