rockbox/apps/plugins/puzzles/webpage.pl
Franklin Wei 1a6a8b52f7 Port of Simon Tatham's Puzzle Collection
Original revision: 5123b1bf68777ffa86e651f178046b26a87cf2d9

MIT Licensed. Some games still crash and others are unplayable due to
issues with controls. Still need a "real" polygon filling algorithm.

Currently builds one plugin per puzzle (about 40 in total, around 100K
each on ARM), but can easily be made to build a single monolithic
overlay (800K or so on ARM).

The following games are at least partially broken for various reasons,
and have been disabled on this commit:

Cube:     failed assertion with "Icosahedron" setting
Keen:     input issues
Mines:    weird stuff happens on target
Palisade: input issues
Solo:     input issues, occasional crash on target
Towers:   input issues
Undead:   input issues
Unequal:  input and drawing issues (concave polys)
Untangle: input issues

Features left to do:
 - In-game help system
 - Figure out the weird bugs

Change-Id: I7c69b6860ab115f973c8d76799502e9bb3d52368
2016-12-18 18:13:22 +01:00

69 lines
1.9 KiB
Perl
Executable file

#!/usr/bin/perl
# Construct the two pieces of my main puzzle collection web page that
# need to vary with the set of puzzles: the big list of <span>s with
# puzzle pictures and links etc, and the list of Windows executable
# files down in the downloads section.
use strict;
use warnings;
use HTML::Entities;
open my $desc, "<", "gamedesc.txt"
or die "gamedesc.txt: open: $!\n";
open my $spans, ">", "wwwspans.html"
or die "wwwspans.html: open: $!\n";
open my $links, ">", "wwwlinks.html"
or die "wwwspans.html: open: $!\n";
my $n = 0;
while (<$desc>) {
chomp;
my ($id, $win, $displayname, $description, $summary) = split /:/, $_;
printf $spans
'<span class="puzzle"><table>'.
'<tr><th align="center">%s</th></tr>'.
'<tr><td align="center">'.
'<img style="margin: 0.5em" alt="" title="%s" width=150 height=150 border=0 src="%s-web.png" />'.
'</td></tr>'.
'<tr><td align="center" style="font-size: 70%%"><code>[</code>'.
' <a href="java/%s.html">java</a> '.
'|'.
' <a href="js/%s.html">js</a> '.
'|'.
' <a href="doc/%s.html#%s">manual</a> '.
'<code>]</code><br><code>[</code>'.
' <a href="%s"><code>%s</code></a> '.
'<code>]</code></td></tr>'.
'<tr><td align="center">%s</td></tr></table></span>'.
"\n",
encode_entities($displayname),
encode_entities($description),
encode_entities($id),
encode_entities($id),
encode_entities($id),
encode_entities($id),
encode_entities($id),
encode_entities($win),
encode_entities($win),
encode_entities($summary);
if ($n > 0) {
if ($n % 5 == 0) {
print $links "<br />";
} else {
print $links " | ";
}
}
printf $links '<a href="%s">%s</a>',
encode_entities($win), encode_entities($win);
$n++;
}
close $desc;
close $spans;
close $links;