Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Crossword Table Maker

by Adam (Vicar)
on Aug 24, 2000 at 23:58 UTC ( #29533=sourcecode: print w/replies, xml ) Need Help??
Author/Contact Info Adam
Description: I wrote this script to generate an html table of a crossword puzzle for KM. I figure that someone else might need to make a crossword puzzle into a table, so here it is.
#!perl -w
use strict;
# I wrote this to generate a file, not be a cgi script, but you could.
# use; 

open GRID, '>grid.html' or die $!;
select GRID;

print "<HTML><BODY>\n"; 

my $cellwidth = '20';  # pixel or percent
my $cellheight = '4'; # pixels only
my $counter = 0;

sub Solid 
    return "<TD WIDTH='$cellwidth' HEIGHT='$cellheight' ".

sub Open
    return "<TD WIDTH='$cellwidth' HEIGHT='$cellheight' ".

sub Numbered
    return "<TD WIDTH='$cellwidth' HEIGHT='$cellheight' BGCOLOR='WHITE
           "ALIGN='LEFT' VALIGN='TOP'><FONT SIZE=-2>$counter</FONT></T

# These two arrays are used to generate the grid.
# numbers in @line correspond to the functions in @type.
# 0 black box, 1, white box, 2, numbered box.
my @type = ( \&Solid, \&Open, \&Numbered );
my @line = ( 

print "<TABLE BORDER=1 SHADE=0>\n";
foreach ( @line )
    print "<TR>\n";
    print map { &{$type[$_]} } split //;
    print "</TR>";
print "\n</TABLE>\n\n";
Replies are listed 'Best First'.
RE: Crossword Table Maker
by vroom (Pope) on Aug 25, 2000 at 00:27 UTC
      Pretty cool. I'd be willing to take a crack at merging the two if I hade nate's source.
Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: sourcecode [id://29533]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (8)
As of 2016-10-22 03:49 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (292 votes). Check out past polls.