Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Scrabble Game

by particle (Vicar)
on Jul 26, 2002 at 01:46 UTC ( [id://185399]=note: print w/replies, xml ) Need Help??


in reply to Scrabble Game

you can make the head of Scrabble.pm portion a bit shorter...

#our letter values my %letter_values; @letter_values{qw/A E I L N O R S T U/} = 1; @letter_values{qw/D G/} = 2; @letter_values{qw/B C M P/} = 3; @letter_values{qw/F H V W Y/} = 4; @letter_values{qw/J K Q X Z/} = qw/8 5 10 8 10/; # Initialize Squares my @premium_squares = map { [(' ') x (15) ] } 1..15; # Triple Word @$_[0,7,14] = '3W' for @premium_squares[0,7,14]; # Double Word $premium_squares[$_][$_] = '2W' for 1..4,7,10..13; # Triple Letter @$_[5,9] = ('3L') x (2) for @premium_squares[5,9]; @$_[1,5,9,13] = ('3L') x (4) for @premium_squares[1,13]; # Double Letter @$_[3,11] = ('2L') x (2) for @premium_squares[0,7,14]; @$_[6,8] = ('2L') x (2) for @premium_squares[2,6,8,12]; @$_[2,6,8,12] = ('2L') x (4) for @premium_squares[6,8]; ## ...
there's more, but i thought this would get you started. i haven't had a chance to run it yet, but it looks like it could be fun.

~Particle *accelerates*

Replies are listed 'Best First'.
Re: Re: Scrabble Game
by Fideist11 (Sexton) on Jul 26, 2002 at 14:26 UTC
    Yeah you do shorten up the syntax by typing it like that but i thought mine was more readable. The real fun was just trying to come up with *any* solid algorithm to fill in the premium squares instead of just listing each coordinate and it's value one by one. Your changes really use the same formulas for filling in the squares it just spells it out differently...can you come up with an algorithmically better (or just different) approach to labeling all the premiums?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://185399]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2024-04-24 22:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found