Skip to content

Commit

Permalink
zabajaba: Fix saving qsub=2
Browse files Browse the repository at this point in the history
  • Loading branch information
x-sheep committed Jul 15, 2024
1 parent 4091761 commit e63b88a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
10 changes: 6 additions & 4 deletions src/variety/kaidan.js
Original file line number Diff line number Diff line change
Expand Up @@ -743,14 +743,15 @@
},
FileIO: {
decodeData: function() {
var hasQans = this.pid !== "wittgen" && this.pid !== "zabajaba";
this.decodeCellQnum();
this.decodeCell(function(cell, ca) {
var val = +ca;
if (val & 1) {
if (this.pid === "wittgen") {
cell.qsub = 2;
} else {
if (hasQans) {
cell.qans = 1;
} else {
cell.qsub = 2;
}
}
if (val & 2) {
Expand All @@ -766,9 +767,10 @@
this.decodeBorderLine();
},
encodeData: function() {
var hasQans = this.pid !== "wittgen" && this.pid !== "zabajaba";
this.encodeCellQnum();
this.encodeCell(function(cell) {
var ans = this.pid === "wittgen" ? cell.qsub === 2 : cell.qans === 1;
var ans = hasQans ? cell.qans === 1 : cell.qsub === 2;
var sub = cell.qsub === 1;

return (+ans | (cell.line << 1) | (+sub << 2) | (cell.qcmp << 3)) + " ";
Expand Down
8 changes: 4 additions & 4 deletions test/script/zabajaba.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,25 +55,25 @@ ui.debug.addDebugData("zabajaba", {
label: "Aux marks",
input: ["mouse,left,1,3", "mouse,left,1,5", "mouse,right,3,5,5,5"],
result:
"pzprv3/zabajaba/4/4/- . . . /. . . . /. . . . /. . . . /0 0 0 2 /4 0 0 0 /4 0 0 2 /0 2 0 2 /0 1 0 /0 1 0 /0 0 0 /0 1 1 /0 1 1 1 /0 0 0 1 /0 0 0 0 /"
"pzprv3/zabajaba/4/4/- . . . /. . . . /. . . . /. . . . /0 0 0 2 /4 0 0 0 /4 1 1 2 /0 2 0 2 /0 1 0 /0 1 0 /0 0 0 /0 1 1 /0 1 1 1 /0 0 0 1 /0 0 0 0 /"
},
{
label: "Collapse 2x2 block",
input: ["mouse,left,3,1,3,3", "playmode,info-room", "mouse,left,7,1"],
result:
"pzprv3/zabajaba/4/4/- . . . /. . . . /. . . . /. . . . /0 0 0 2 /4 0 0 0 /4 0 0 2 /0 2 0 2 /0 0 0 /0 1 0 /0 0 0 /0 1 1 /0 0 0 1 /0 0 0 1 /0 0 0 0 /"
"pzprv3/zabajaba/4/4/- . . . /. . . . /. . . . /. . . . /0 0 0 2 /4 0 0 0 /4 1 1 2 /0 2 0 2 /0 0 0 /0 1 0 /0 0 0 /0 1 1 /0 0 0 1 /0 0 0 1 /0 0 0 0 /"
},
{
label: "Block 2x2 input when other paths are present",
input: ["playmode,auto", "mouse,left,1,3,1,5,3,5"],
result:
"pzprv3/zabajaba/4/4/- . . . /. . . . /. . . . /. . . . /0 0 0 2 /0 0 0 0 /0 0 0 2 /0 2 0 2 /0 0 0 /0 1 0 /0 0 0 /0 1 1 /0 0 0 1 /1 0 0 1 /0 0 0 0 /"
"pzprv3/zabajaba/4/4/- . . . /. . . . /. . . . /. . . . /0 0 0 2 /0 0 0 0 /0 1 1 2 /0 2 0 2 /0 0 0 /0 1 0 /0 0 0 /0 1 1 /0 0 0 1 /1 0 0 1 /0 0 0 0 /"
},
{
label: "Can join two lines",
input: ["mouse,left,3,1,5,1,5,3"],
result:
"pzprv3/zabajaba/4/4/- . . . /. . . . /. . . . /. . . . /0 0 0 2 /0 0 0 0 /0 0 0 2 /0 2 0 2 /0 1 0 /0 1 0 /0 0 0 /0 1 1 /0 1 1 1 /1 0 0 1 /0 0 0 0 /"
"pzprv3/zabajaba/4/4/- . . . /. . . . /. . . . /. . . . /0 0 0 2 /0 0 0 0 /0 1 1 2 /0 2 0 2 /0 1 0 /0 1 0 /0 0 0 /0 1 1 /0 1 1 1 /1 0 0 1 /0 0 0 0 /"
}
]
});

0 comments on commit e63b88a

Please sign in to comment.