danno_scrabble 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/bin/scrabble +4 -0
- data/lib/scrabble.rb +18 -0
- metadata +46 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: a977d1c3be79bfd76a20c3c1eb67cd26cffb6298
|
4
|
+
data.tar.gz: 3cc2674fa6281b70fa241ea92c8d388bc6d98af6
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 21a67dec5227d9e187495a9dda9bb8da8987a73c87b3feb8d2a42b2e0a9c5c025cd3b1c7f9e56a8360db4ba12fb906caadc4f74bf342ebe0ac56f689865a97c1
|
7
|
+
data.tar.gz: 60708fa90a391a410b38717a44fafe2d0bdb71903a786f60159dab108438c0e0bf7f7d2c39a9864e5a47fd7506f87280a2ffdf15c9c863288b048b32110370c6
|
data/bin/scrabble
ADDED
data/lib/scrabble.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
###
|
3
|
+
# @author Dan Oberg <dan@cs1.com>
|
4
|
+
# @licence MIT
|
5
|
+
# @class Scrabble
|
6
|
+
# Useage: `ruby -Ilib ./bin/scrabble {'asdfjkl'}` or `ruby -Ilib ./bin/scrabble {'peodfor'}`
|
7
|
+
###
|
8
|
+
class Scrabble
|
9
|
+
###
|
10
|
+
# @param [String] run a list of letters against a text dictionary file for valid scrabble answers.
|
11
|
+
# @return [Array] return possible valid results.
|
12
|
+
###
|
13
|
+
def self.run_scrabble(letters)
|
14
|
+
dictionary = File.readlines('word_list.txt').map(&:chomp)
|
15
|
+
possible = (2..letters.length).map{|n| letters.chars.to_a.permutation(n).to_a.map(&:join)}.flatten
|
16
|
+
dictionary & possible
|
17
|
+
end
|
18
|
+
end
|
metadata
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: danno_scrabble
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Danial Oberg
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-04-05 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: A simple scrabble answer checker. Provides a list of valid scrabble answers.
|
14
|
+
email: dan@cs1.com
|
15
|
+
executables:
|
16
|
+
- scrabble
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- bin/scrabble
|
21
|
+
- lib/scrabble.rb
|
22
|
+
homepage: http://rubygems.org/gems/danno_scrabble
|
23
|
+
licenses:
|
24
|
+
- MIT
|
25
|
+
metadata: {}
|
26
|
+
post_install_message:
|
27
|
+
rdoc_options: []
|
28
|
+
require_paths:
|
29
|
+
- lib
|
30
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '0'
|
35
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ">="
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0'
|
40
|
+
requirements: []
|
41
|
+
rubyforge_project:
|
42
|
+
rubygems_version: 2.4.5.1
|
43
|
+
signing_key:
|
44
|
+
specification_version: 4
|
45
|
+
summary: Scrabble
|
46
|
+
test_files: []
|