in reply to Inputing vectors into a scrabble-esque game

For input, how about just entering a string consisting of

a row digit of starting position of word
a column digit ditto
either a 'h' or a 'v' for whether the word is horizontal or vertical
the word

Example program:

#!/usr/bin/perl use strict; use warnings; my $board = ('.' x 10 . "\n") x 10; print "$board\n"; my $input = '23hacross'; # simulated read from STDIN place($input); print "$board\n"; $input = '16vdown'; # simulated read from STDIN place($input); print "$board\n"; sub place { my $input = shift; my ($row, $column, $direction, $word) = $input =~ /^(\d)(\d)(v|h)(.* +)/; my $position = 11 * $row + $column; for ( split //, $word ) { substr $board, $position, 1, $_; if( $direction eq 'h' ) { $position++; } else { $position += 11; } } }

Outputs:

.......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... ...across. .......... .......... .......... .......... .......... .......... .......... .......... ......d... ...across. ......w... ......n... .......... .......... .......... .......... ..........