Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Retrograde Battleships #492

Merged
merged 24 commits into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src-ui/changes.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@
<main>
<div style="margin-bottom: 5px;"><b>Latest types</b> (<em><a href="/list.html" target="_parent">all types</a></em>)</div>
<ul>
<li><a href="/p?retroships" target="_parent">Retrograde Battleships</a></li>
<li><a href="/p?pmemory" target="_parent">Persistence of Memory</a></li>
<li><a href="/p?mrtile" target="_parent">Mirroring Tile ミラーリングタイル</a></li>
<li><a href="/p?kissing" target="_parent">Kissing Polyominoes</a></li>
<li><a href="/p?lineofsight" target="_parent">Line of Sight サイトライン</a></li>
<li><a href="/p?tetrominous" target="_parent">Tetrominous</a></li>
<li><a href="/p?mannequin" target="_parent">Mannequin Gate マネキンゲート</a></li>
<li><a href="/p?nothing" target="_parent">All or Nothing オールorナッシング</a></li>
</ul>
</main>
</body>
Binary file added src-ui/img/retroships.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 32 additions & 0 deletions src-ui/js/ui/KeyPopup.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ ui.keypopup = {
haisu: [10, 0],
wittgen: [4, 0],
aquapelago: [10, 0],
retroships: [129, 0],
compass: [10, 0],
mukkonn: [10, 0],
tachibk: [10, 0],
Expand Down Expand Up @@ -331,6 +332,8 @@ ui.keypopup = {
this.generate_brownies(mode);
} else if (type === 128) {
this.generate_tetrominous(mode);
} else if (type === 129) {
this.generate_retroships(mode);
}
},
gentable4: function(mode) {
Expand Down Expand Up @@ -912,6 +915,31 @@ ui.keypopup = {
);
},

generate_retroships: function(mode) {
this.imgCR = [10, 1];
this.generate_main(
[
["7", { image: 6 }],
["8", { image: 7 }],
["1", { image: 4 }],
" ",
["9", { image: 8 }],
["a", { image: 9 }],
["2", { image: 5 }],
" ",
["3", { image: 2 }],
["5", { image: 0 }],
["4", { image: 3 }],
" ",
["6", { image: 1 }],
["0", { text: "~", color: "blue" }],
["-", "?"],
" "
],
4
);
},

generate_brownies: function(mode) {
this.generate_main(
[
Expand Down Expand Up @@ -1002,6 +1030,10 @@ ui.keypopup = {
_child = createEL("img");
_child.className = "kpimg";
var pid = ui.puzzle.pid;
if (pid === "retroships") {
pid = "battleship";
}

_child.src =
"data:image/gif;base64," +
this.dataurl[!!this.dataurl[pid] ? pid : "shitappa"];
Expand Down
1 change: 1 addition & 0 deletions src-ui/js/ui/Misc.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ function toBGimage(pid) {
"ququ",
"rassi",
"remlen",
"retroships",
"roundtrip",
"sashikazune",
"satogaeri",
Expand Down
1 change: 1 addition & 0 deletions src-ui/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,7 @@ <h2 id="title"><span lang="ja">パズルの種類のリスト</span><span lang="
<li data-pid="pentatouch"></li>
<li data-pid="alter"></li>
<li data-pid="kissing"></li>
<li data-pid="retroships"></li>
</ul>
</div>
</div>
Expand Down
6 changes: 6 additions & 0 deletions src/puzzle/PieceList.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// PieceList.js v3.4.1

/* global Set:false */

pzpr.classmgr.makeCommon({
//----------------------------------------------------------------------------
// ★PieceListクラス オブジェクトの配列を扱う
Expand All @@ -21,6 +23,10 @@ pzpr.classmgr.makeCommon({
//--------------------------------------------------------------------------------
add: Array.prototype.push,
extend: function(list) {
if (list instanceof Set) {
list = Array.from(list);
}

var len = list.length,
n = this.length;
this.length += len;
Expand Down
7 changes: 7 additions & 0 deletions src/pzpr/variety.js
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,13 @@
reflect: [1, 0, "リフレクトリンク", "Reflect Link"],
remlen: [0, 0, "Remembered Length", "Remembered Length", "country"],
renban: [0, 0, "連番窓口", "Renban-Madoguchi"],
retroships: [
0,
0,
"Retrograde Battleships",
"Retrograde Battleships",
"statuepark"
],
ringring: [0, 0, "リングリング", "Ring-ring", "nagenawa"],
ripple: [
0,
Expand Down
3 changes: 3 additions & 0 deletions src/res/failcode.en.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"bankGt.battleship": "A ship appears too many times on the board.",
"bankGt": "A piece appears too many times on the board.",
"bankInvalid": "The board contains an invalid piece.",
"bankInvalid.battleship": "The board contains an invalid ship.",
"bankLt.battleship": "Some ships are not used on the board.",
"bankLt": "Some pieces are not used on the board.",
"bankNe.tachibk": "The left and right grids contain different pieces.",
Expand Down Expand Up @@ -397,6 +398,7 @@
"csLt2": "There is a single shaded cell.",
"csLt4": "The size of a mass of shaded cells is less than four.",
"csMismatch": "A given piece has missing cells.",
"csMismatch.retroships": "A shaded piece has missing cells.",
"csNoLevel.aquarium": "A body of water has different surface levels.",
"csNoSupport.aquarium": "A water cell is next to or above an empty cell.",
"csNotBottom.dosufuwa": "An iron ball is not on the bottom of the row or on another iron ball.",
Expand All @@ -405,6 +407,7 @@
"csNotSquare": "A group of shaded cells is not a square.",
"csOnArrow": "A cell with a clue is shaded.",
"csPieceExtra": "A given piece has incorrect cells around it.",
"csPieceExtra.retroships": "A shaded piece has incorrect cells around it.",
"csRect.mochikoro": "There is a block of shaded cells that is a rectangle.",
"csUpper.stostone": "Shaded cells remain in the upper half of the board after the blocks have fallen.",
"csWidthGt1.nuribou": "There is a mass of shaded cells whose width is more than one.",
Expand Down
4 changes: 2 additions & 2 deletions src/variety/nanameguri.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,8 @@
room["form" + form].add(cell);
}

room.edges = new this.klass.BorderList(Array.from(edges));
room.inner = new this.klass.BorderList(Array.from(innerbds));
room.edges = new this.klass.BorderList(edges);
room.inner = new this.klass.BorderList(innerbds);

ret.push(room);
}
Expand Down
Loading
Loading