Utilities and classes for generating optimal moves in Scrabble and Scrabble-like games.
Ruby
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
bin
examples
lib
spec
.gitignore
.rspec
.rvmrc
Gemfile
LICENSE
README.rdoc
Rakefile
scrabble_rouser.gemspec

README.rdoc

ScrabbleRouser

ScrabbleRouser is a Ruby gem and command-line tool for generating optimal moves in Scrabble and Scrabble-like games. It largely exists as a personal amusement and self-improvement project: I have been coding in Ruby for a bit over three months but haven't got a feel for setting up a project on my own. Additionally, this gives me a chance to test out various AI strategies in Scrabble.

I hope to eventually package Tesseract OCR as a native gem and add support to scrabble_rouser, so keep an eye out for future developments in that space.

Basic Usage

Install the scrabble_rouser gem to get started:

gem install scrabble_rouser

This will install the libraries and documentation for the gem as well as a scrabble_rouser binary. Until I get around to writing some examples, you're own your own when it comes to the libraries. Use something like YARD to browse my documentation. As far as the binary tool goes, the following command will generate optimal moves using the specified dictionary, rack letters, and board:

scrabble_rouser --dictionary path/to/words.txt 'RCKLTRS' path/to/board.txt

You can type scrabble_rouser --help for additional details.

Board Files

ScrabbleRouser expects board files to end in '.scrab'. The file format is pretty simple:

  • The first line should start and end with + or D, separated by hyphens. If a D is present, double-spacing is allowed in the board, otherwise this feature is disabled.

  • Subsequent rows should start and end with | and must be the same length as the first row. Every character in the row is interpreted as part of the board state, unless double-spacing is enabled, in which case board tiles may be separated by single spaces.

  • Letter multipliers are as follows:

    • The numeral 2 denotes a double-letter space

    • The numeral 3 denotes a triple-letter space

  • Word multipliers are as follows:

    • The character @ (shift-2) denotes a double-word space

    • The character # (shift-3) denotes a triple-word space

  • An asterisk (*) denotes the starting space

  • Uppercase letters AZ represent placed tiles

  • Lowercase letters az represent placed–and–locked-in blank tiles. For instance, if another player had played a blank tile and decided it was going to be an A, this would be denoted with an a. This is necessary because blank tiles have no value in subsequent plays.

There are some sample board files in the examples directory.

Configuration

Everything is configured via command-line flags. Caching and configuration files are planned for a future release.

Examples

For sample board files, check out the examples directory. Everything is pretty straightforward.

Additional Reading

Copyright

Copyright © 2011 Jason Petersen. See LICENSE for details.