Socket
Book a DemoInstallSign in
Socket

codewords_solver

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

codewords_solver

0.0.3
bundlerRubygems
Version published
Maintainers
1
Created
Source

Codewords solver

A simple ruby-based allgorithm for solving codewords (AKA Cypher crosswords) - popular in many newspapers.

Usage

require "codewords_solver"

CodewordsSolver.solve! coded_words: grid, starting_letters: { 5 => "F", 7 => "L" }

or

require "codewords_solver"

solver = CodewordsSolver.new grid, { 5 => "F", 7 => "L" }
solver.solve!

where

grid = [
  [1, 13, 7, 11],
  [22, 5, 5, 13, 10, 17, 4, 15],
  [4, 13, 18, 3, 23],
  [16, 13, 7, 7, 13, 22, 26],
  [15, 10, 4, 12, 24, 25, 7, 17],
  [25, 13, 4, 22],
  [12, 24, 22, 9, 26, 23],
  [5, 13, 12, 26, 10, 17],
  [17, 26, 21, 14],
  [24, 12, 4, 23, 13, 12, 26, 15],
  [19, 4, 22, 8, 17, 10, 23],
  [4, 12, 13, 15, 17],
  [11, 13, 15, 10, 22, 9, 26, 23],
  [2, 9, 13, 19],
  [1, 22, 4, 20, 15, 19, 12, 10, 17],
  [19, 22, 11],
  [7, 12, 18, 17, 4],
  [22, 25, 21, 13, 22, 9, 15],
  [15, 23, 12, 24, 13, 26, 12],
  [7, 17, 18, 22],
  [5, 13, 16, 16, 7, 17],
  [23, 12, 4, 23, 12, 26],
  [13, 11, 7, 17],
  [24, 13, 6, 23, 9, 4, 17],
  [17, 11, 13, 23, 13, 22, 26],
  [12, 11, 13, 17, 9],
  [15, 22, 26],
  [22, 21, 17, 4, 15, 7, 17, 17, 19],
]

which is a machine-representation of a real-world grid that looks like this:

IMG_2891

Note that while a codewords puzzle is typically formed into a grid with intersecting words, you do not need to mark such intersections here. A simple array of each of the numbered words will suffice!

Please note

A good codewords solver requires a good word list, and this one is far from perfect. If it isn't solving a puzzle or it's making a mistake, it's quite likely that it's because there are words missing from the list!

FAQs

Package last updated on 13 Feb 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.