0.0
No commit activity in last 3 years
No release in over 3 years
pressletter is a tool for solving Letterpress puzzles. Using the `pressletter` binary like this: $ pressletter eiptctbntymeiphoxvitkmzib The argument is a list of all the letters on a pressletter board and will yield an ordered list (from longest to shorted) of all legal words that can be made with the provided letters.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 0.3.4
~> 2.12.0
~> 2.2.0
 Project Readme

Pressletter

Build Status

Letterpress is a fantastic game for iOS written by Loren Brichter. Pressletter is a gem that solves Letterpress boards using an included plaintext dictionary of words.

Installation

global install

To install pressletter to your system, run:

$ gem install pressletter

bundler

If you're using Bundler, add the pressletter gem to your Gemfile:

source 'https://rubygems.org'

gem 'pressletter'

and then run:

$ bundle install

Inside your Bundler project, the binary can then be accessed with bundle exec pressletter.

Example

Here's what a board looked like in a game I played with @steveklabnik:

pressletter Screen

Using the pressletter gem, you can search for playable words by providing the 25 letters on the game board (even any repeats, since the game rules stipulate that each letter can only be used as many times as it appears on the board).

For instance, the letters in the provided screenshot are: E I P T C T B N T Y M E I P H O X V I T K M Z I B.

command-line

The simplest way to invoke the gem is using the pressletter binary from the command line.

You can pass the candidate letters as a contiguous string argument:

$ pressletter eiptctbntymeiphoxvitkmzib

Pressletter is also friendly to piped (and whitespace and uppercase) input:

$ echo "E I P T C T B N T Y M E I P H O X V I T K M Z I B" | pressletter

Finally, if an argument isn't passed in, pressletter will wait for you to interactively type in the letters:

$ pressletter
Please enter candidate Letterpress letters, then press <return>:
E I P T C T B N T Y M E I P H O X V I T K M Z I B

In each case, the results will print in order of largest-to-smallest length (with secondary alphabetical order for words of the same length). The output looks like:

$ pressletter eiptctbntymeiphoxvitkmzib
COMPETITIVITE
BIOETHICIEN
...
XI

Ruby

You can, of course, also look for solutions using pure ruby. The public API is exceedingly simple:

Pressletter.solve(letters[, config])

For input, all that's needed is a string or array of candidate letters. A config object that responds to dictionary_location with a path of a dictionary file can also be optionally provided. An array (sorted largest-to-smallest) of valid words is returned.

Here's an interactive session that uses the gem programmatically:

$ irb
irb(main):001:0> require 'pressletter'
=> true
irb(main):002:0> letters = ["e", "i", "p", "t", "c", "t", "b", "n", "t", "y", "m", "e", "i", "p", "h", "o", "x", "v", "i", "t", "k", "m", "z", "i", "b"]
=> ["e", "i", "p", "t", "c", "t", "b", "n", "t", "y", "m", "e", "i", "p", "h", "o", "x", "v", "i", "t", "k", "m", "z", "i", "b"]
irb(main):003:0> Pressletter.solve(letters)
=> ["COMPETITIVITE", "...", "XI"]