Skip to content

Commit 6849e0d

Browse files
committed
Add Seiza
1 parent 317bee7 commit 6849e0d

7 files changed

Lines changed: 356 additions & 3 deletions

File tree

src-ui/js/ui/KeyPopup.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,8 @@ ui.keypopup = {
265265
landmeasure: [10, 0],
266266
elasticlink: [10, 0],
267267
slovak: [136, 10],
268-
gravel: [120, 0]
268+
gravel: [120, 0],
269+
seiza: [4, 0]
269270
},
270271

271272
//---------------------------------------------------------------------------

src-ui/list.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ <h2 id="title"><span lang="ja">パズルの種類のリスト</span><span lang="
262262
<li data-pid="energywalk"></li>
263263
<li data-pid="keywest"></li>
264264
<li data-pid="ubahn"></li>
265+
<li data-pid="seiza"></li>
265266
</ul>
266267
</div>
267268
<div class="lists lines">

src/pzpr/variety.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,7 @@
418418
],
419419
scrabble: [0, 0, "Scrabble", "Scrabble"],
420420
scrin: [0, 0, "スクリン", "Scrin"],
421+
seiza: [0, 0, "星座になれたら", "Seiza"],
421422
sendai: [0, 0, "宮城県仙台市", "Sendai-Miyagi"],
422423
shakashaka: [0, 1, "シャカシャカ", "Shakashaka"],
423424
shikaku: [0, 1, "四角に切れ", "Shikaku", "shikaku"],

src/res/failcode.en.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,8 @@
335335
"bkSizeNe": "The size of the block is not equal to the number.",
336336
"bkSizeNe5.hebi": "The size of a snake is not five.",
337337
"bkSmallOnBig.ripple": "There is a smaller number on top of a bigger number in a room.",
338+
"bkStarGt.seiza": "A region has more than one star.",
339+
"bkStarLt.seiza": "A region does not have a star.",
338340
"bkStarGt.starbattle": "The number of stars in an area is too large.",
339341
"bkStarLt.starbattle": "The number of stars in an area is too small.",
340342
"bkSubdivided.oneroom": "A room is divided internally by shaded cells.",
@@ -563,6 +565,7 @@
563565
"kitamakura.shugaku": "There is a futon that faces down.",
564566
"laCurve.herugolf": "A ball curves halfway.",
565567
"laCurve.kaidan": "Two rectangles overlap.",
568+
"laCurve.seiza": "A line turns outside of a star.",
566569
"laCurve": "A line has curve.",
567570
"laIsolate.bonsan": "A line doesn't connect any circle.",
568571
"laIsolate.herugolf": "A line doesn't connect any ball.",
@@ -606,6 +609,7 @@
606609
"lcCurveNe0.bwloop": "Two equal pearls aren't connected by a straight line.",
607610
"lcCurveNe1.bwloop": "Two different pearls don't have exactly one turn between them.",
608611
"lcDeadEnd": "There is a dead-end line.",
612+
"lcDivided.seiza": "Not all stars are connected.",
609613
"lcDivided.tjunction": "Not all T-junctions are connected.",
610614
"lcDivided": "All lines and numbers are not connected to each other.",
611615
"lcGrayGt.coffeemilk": "A group has more than one gray circle.",
@@ -642,6 +646,7 @@
642646
"lnAdjacent.tontti": "Identical line shapes are connected.",
643647
"lnBranch.energywalk": "There is a branch line outside of an energy cell.",
644648
"lnBranch.forestwalk": "There is a branch line outside of a forest cell.",
649+
"lnBranch.seiza": "There is a branch line outside of a star.",
645650
"lnBranch": "There is a branch line.",
646651
"lnConsecutive.kaidan": "Two adjacent rectangles don't have a size difference of 1.",
647652
"lnCross": "There is a crossing line.",
@@ -834,6 +839,7 @@
834839
"nmLineLt2.kouchoku": "A clue doesn't have two segments.",
835840
"nmLineNe.ichimaga": "The number is not equal to the number of lines out of the circle.",
836841
"nmLineNe.lither": "The number is not equal to the number of lines around it.",
842+
"nmLineNe.seiza": "A number is not equal to the amount of lines connected to its star.",
837843
"nmLineNe.slither": "The number is not equal to the number of lines around it.",
838844
"nmLoop.snakepit": "A snake has no head or tail.",
839845
"nmLt1.lapaz": "A number is not contained in a 1x2 region.",
@@ -853,6 +859,7 @@
853859
"nmNoLine.firefly": "There is a lonely firefly.",
854860
"nmNoLine.ichimaga": "A circle doesn't start any line.",
855861
"nmNoLine.kusabi": "A circle is not connected to another object.",
862+
"nmNoLine.seiza": "A star is not connected to another star.",
856863
"nmNoLine.wblink": "A circle doesn't start any line.",
857864
"nmNoLine": "A number is not connected to another number.",
858865
"nmNoMove.bonsan": "A circle doesn't move.",
@@ -997,7 +1004,7 @@
9971004
"slLoopGiri.gokigen": "There is a loop that consists '切'.",
9981005
"slNotLoopWa.gokigen": "There is not a loop that consists '輪'.",
9991006
"snakeAttack.hebi": "A snake can see another snake.",
1000-
"starAround.starbattle": "Some stars touch.",
1007+
"starAround": "Some stars touch.",
10011008
"stInvalid.icebarn": "System can't detect start position.",
10021009
"stLineNe2.slalom": "Start/goal circle doesn't have two lines.",
10031010
"stNoLine.icebarn": "The line doesn't go through the 'IN' arrow.",

src/res/failcode.ja.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,7 @@
624624
"slLoopGiri.gokigen": "'切'が含まれた線が輪っかになっています。",
625625
"slNotLoopWa.gokigen": "'輪'が含まれた線が輪っかになっていません。",
626626
"snakeAttack.hebi": "蛇の視線の先に別の蛇がいます。",
627-
"starAround.starbattle": "星がタテヨコナナメに隣接しています。",
627+
"starAround": "星がタテヨコナナメに隣接しています。",
628628
"stInvalid.icebarn": "スタート位置を特定できませんでした。",
629629
"stLineNe2.slalom": "○から線が2本出ていません。",
630630
"stNoLine.icebarn": "INに線が通っていません。",

src/variety/seiza.js

Lines changed: 296 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,296 @@
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+
})(["seiza"], {
8+
MouseEvent: {
9+
inputModes: {
10+
edit: ["empty", "border", "number"],
11+
play: ["star", "unshade", "peke", "line"]
12+
},
13+
mouseinputAutoPlay: function() {
14+
if (this.mousestart || this.mousemove) {
15+
if (this.btn === "left") {
16+
this.inputLine();
17+
} else if (this.btn === "right") {
18+
if (this.mousestart && this.inputpeke_ifborder()) {
19+
return;
20+
}
21+
if (!this.firstCell.isnull || this.notInputted()) {
22+
this.inputcell();
23+
}
24+
}
25+
} else if (this.mouseend && this.notInputted()) {
26+
var cell = this.getcell();
27+
if (!this.firstCell.isnull && cell !== this.firstCell) {
28+
return;
29+
}
30+
this.inputcell();
31+
}
32+
},
33+
mouseinputAutoEdit: function() {
34+
if (this.mousestart || this.mousemove) {
35+
this.inputborder();
36+
} else if (this.mouseend && this.notInputted()) {
37+
this.inputqnum();
38+
}
39+
}
40+
},
41+
KeyEvent: {
42+
enablemake: true,
43+
keyinput: function(ca) {
44+
if (ca === "q") {
45+
var cell = this.cursor.getc();
46+
if (!cell.isnull) {
47+
cell.setValid(cell.ques !== 7 ? 7 : 0);
48+
cell.draw();
49+
}
50+
} else {
51+
this.key_inputqnum(ca);
52+
}
53+
}
54+
},
55+
56+
Cell: {
57+
maxnum: 4,
58+
isLineShapeEndpoint: function() {
59+
return this.qans === 1;
60+
},
61+
noLP: function(dir) {
62+
return this.isEmpty();
63+
},
64+
prehook: {
65+
qans: function(num) {
66+
return num && this.isEmpty();
67+
},
68+
qsub: function(num) {
69+
return num && this.isEmpty();
70+
}
71+
},
72+
posthook: {
73+
ques: function() {
74+
if (!this.ques) {
75+
return;
76+
}
77+
this.setQans(0);
78+
this.setQsub(0);
79+
for (var dir in this.adjborder) {
80+
this.adjborder[dir].removeLine();
81+
}
82+
}
83+
}
84+
},
85+
Border: {
86+
enableLineNG: true,
87+
isBorder: function() {
88+
return (
89+
this.isnull ||
90+
this.ques ||
91+
this.sidecell[0].isEmpty() ||
92+
this.sidecell[1].isEmpty()
93+
);
94+
}
95+
},
96+
Board: {
97+
hasborder: 1
98+
},
99+
LineGraph: {
100+
enabled: true,
101+
makeClist: true
102+
},
103+
AreaRoomGraph: {
104+
enabled: true,
105+
hastop: true
106+
},
107+
108+
//---------------------------------------------------------
109+
// 画像表示系
110+
Graphic: {
111+
irowake: true,
112+
gridcolor_type: "LIGHT",
113+
textoption: { ratio: 0.45, position: 5 } /* TOPLEFT */,
114+
numbercolor_func: "fixed",
115+
116+
paint: function() {
117+
this.drawBGCells();
118+
this.drawGrid();
119+
this.drawQuesCells();
120+
this.drawQuesNumbers();
121+
122+
this.drawDotCells();
123+
this.drawLines();
124+
this.drawStars();
125+
this.drawPekes();
126+
127+
this.drawBorders();
128+
129+
this.drawChassis();
130+
this.drawTarget();
131+
},
132+
getQuesCellColor: function(cell) {
133+
return cell.isEmpty() ? "black" : null;
134+
},
135+
136+
drawStars: function() {
137+
var g = this.vinc("cell_star", "auto", true);
138+
var clist = this.range.cells;
139+
for (var i = 0; i < clist.length; i++) {
140+
var cell = clist[i];
141+
g.vid = "c_star_" + cell.id;
142+
if (cell.qans === 1) {
143+
g.fillStyle = !cell.trial ? this.qanscolor : this.trialcolor;
144+
this.fillStar(
145+
g,
146+
cell.bx * this.bw,
147+
cell.by * this.bh,
148+
this.bw * 0.8,
149+
this.bh * 0.8
150+
);
151+
} else {
152+
g.vhide();
153+
}
154+
}
155+
}
156+
},
157+
158+
//---------------------------------------------------------
159+
// URLエンコード/デコード処理
160+
Encode: {
161+
decodePzpr: function(type) {
162+
this.decodeBorder();
163+
this.decodeEmpty();
164+
this.decodeRoomNumber16();
165+
},
166+
encodePzpr: function(type) {
167+
this.encodeBorder();
168+
this.encodeEmpty();
169+
this.encodeRoomNumber16();
170+
},
171+
encodeBorder_makaro: function() {
172+
/* 同じ見た目のパズルにおけるURLを同じにするため、 */
173+
/* 一時的にborder.ques=1にしてURLを出力してから元に戻します */
174+
var bd = this.board,
175+
sv_ques = [];
176+
for (var id = 0; id < bd.border.length; id++) {
177+
sv_ques[id] = bd.border[id].ques;
178+
bd.border[id].ques = bd.border[id].isBorder() ? 1 : 0;
179+
}
180+
181+
this.encodeBorder();
182+
183+
for (var id = 0; id < bd.border.length; id++) {
184+
bd.border[id].ques = sv_ques[id];
185+
}
186+
}
187+
},
188+
FileIO: {
189+
decodeData: function() {
190+
this.decodeCell(function(cell, ca) {
191+
if (ca === "*") {
192+
cell.ques = 7;
193+
} else if (ca === "-") {
194+
cell.qnum = -2;
195+
} else if (ca !== ".") {
196+
cell.qnum = +ca;
197+
}
198+
});
199+
this.decodeBorderQues();
200+
this.decodeBorderLine();
201+
this.decodeCellAns();
202+
},
203+
encodeData: function() {
204+
this.encodeCell(function(cell) {
205+
if (cell.ques) {
206+
return "* ";
207+
} else if (cell.qnum === -2) {
208+
return "- ";
209+
} else if (cell.qnum > 0) {
210+
return cell.qnum + " ";
211+
} else {
212+
return ". ";
213+
}
214+
});
215+
this.encodeBorderQues();
216+
this.encodeBorderLine();
217+
this.encodeCellAns();
218+
}
219+
},
220+
AnsCheck: {
221+
checklist: [
222+
"checkAroundStars",
223+
"checkCrossLine",
224+
"checkCurveLine",
225+
"checkOverSaturatedStars",
226+
"checkOutgoingLine",
227+
"checkLineShapeDeadend",
228+
"checkNoLineObject",
229+
"checkInsufficientStars",
230+
"checkConnectAllNumber"
231+
],
232+
checkLineShapeDeadend: function() {
233+
this.checkAllCell(function(cell) {
234+
return !cell.qans && cell.lcnt === 1;
235+
}, "lcDeadEnd");
236+
},
237+
checkCrossLine: function() {
238+
this.checkAllCell(function(cell) {
239+
return !cell.qans && cell.lcnt > 2;
240+
}, "lnBranch");
241+
},
242+
checkCurveLine: function() {
243+
this.checkAllCell(function(cell) {
244+
return !cell.qans && cell.isLineCurve();
245+
}, "laCurve");
246+
},
247+
checkAroundStars: function() {
248+
this.checkAroundCell(function(cell1, cell2) {
249+
return cell1.qans === 1 && cell2.qans === 1;
250+
}, "starAround");
251+
},
252+
checkOverSaturatedStars: function() {
253+
var bd = this.board;
254+
this.checkAllBlock(
255+
bd.roommgr,
256+
function(cell) {
257+
return cell.qans === 1;
258+
},
259+
function(w, h, a, n) {
260+
return a <= 1;
261+
},
262+
"bkStarGt"
263+
);
264+
},
265+
checkInsufficientStars: function() {
266+
var bd = this.board;
267+
this.checkAllBlock(
268+
bd.roommgr,
269+
function(cell) {
270+
return cell.qans === 1;
271+
},
272+
function(w, h, a, n) {
273+
return a >= 1;
274+
},
275+
"bkStarLt"
276+
);
277+
},
278+
checkNoLineObject: function() {
279+
this.checkAllCell(function(cell) {
280+
return cell.lcnt === 0 && cell.qans;
281+
}, "nmNoLine");
282+
},
283+
checkOutgoingLine: function() {
284+
this.checkAllCell(function(cell) {
285+
if (!cell.qans || !cell.room) {
286+
return false;
287+
}
288+
if (cell.room.top.isValidNum() && cell.room.top.qnum !== cell.lcnt) {
289+
cell.room.clist.seterr(1);
290+
return true;
291+
}
292+
return false;
293+
}, "nmLineNe");
294+
}
295+
}
296+
});

0 commit comments

Comments
 (0)