frequency_enumerator 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +22 -14
- metadata +3 -3
data/README.md
CHANGED
@@ -8,11 +8,11 @@ If you're using brute-force search to solve some problem, it makes sense to carr
|
|
8
8
|
|
9
9
|
Consider a simple example of trying to figure out which combinations of items cost a known total:
|
10
10
|
|
11
|
-
```
|
12
11
|
Total: £2.00
|
13
12
|
|
14
|
-
|
15
|
-
|
13
|
+
* Tea: £0.20
|
14
|
+
* Coffee: £0.30
|
15
|
+
* Biscuit: £0.15
|
16
16
|
|
17
17
|
We could use *maths* to solve this problem. Or we could brute-force it.
|
18
18
|
|
@@ -50,21 +50,21 @@ end
|
|
50
50
|
The first 10 attempts yielded to the block are:
|
51
51
|
|
52
52
|
```ruby
|
53
|
-
{ :tea=>
|
54
|
-
{ :tea=>0, :coffee=>0, :biscuit=>1 }
|
55
|
-
{ :tea=>0, :coffee=>0, :biscuit=>2 }
|
56
|
-
{ :tea=>0, :coffee=>0, :biscuit=>3 }
|
57
|
-
{ :tea=>0, :coffee=>1, :biscuit=>0 }
|
58
|
-
{ :tea=>0, :coffee=>1, :biscuit=>1 }
|
59
|
-
{ :tea=>0, :coffee=>1, :biscuit=>2 }
|
60
|
-
{ :tea=>0, :coffee=>1, :biscuit=>3 }
|
61
|
-
{ :tea=>0, :coffee=>0, :biscuit=>4 }
|
62
|
-
{ :tea=>0, :coffee=>0, :biscuit=>5 }
|
53
|
+
{ :tea => 1, :coffee => 1, :biscuit => 1 }
|
54
|
+
{ :tea => 0, :coffee => 0, :biscuit => 1 }
|
55
|
+
{ :tea => 0, :coffee => 0, :biscuit => 2 }
|
56
|
+
{ :tea => 0, :coffee => 0, :biscuit => 3 }
|
57
|
+
{ :tea => 0, :coffee => 1, :biscuit => 0 }
|
58
|
+
{ :tea => 0, :coffee => 1, :biscuit => 1 }
|
59
|
+
{ :tea => 0, :coffee => 1, :biscuit => 2 }
|
60
|
+
{ :tea => 0, :coffee => 1, :biscuit => 3 }
|
61
|
+
{ :tea => 0, :coffee => 0, :biscuit => 4 }
|
62
|
+
{ :tea => 0, :coffee => 0, :biscuit => 5 }
|
63
63
|
```
|
64
64
|
|
65
65
|
As you can see, most of attempts change the number of biscuits, whilst we haven't even explored the possibility that tea might be in the solution yet.
|
66
66
|
|
67
|
-
|
67
|
+
## Limit
|
68
68
|
|
69
69
|
All attempts are guaranteed to be unique and appear in a deterministic order. The 'limit' method calculates the number of unique enumerations for the search space (zero-offset).
|
70
70
|
|
@@ -91,6 +91,14 @@ My motivation for building this gem is to more intelligently brute-force the pro
|
|
91
91
|
|
92
92
|
In theory, mutating the E's, T's, A's, O's and I's first should result in attempts that correlate with English text and therefore are more likely to be solutions.
|
93
93
|
|
94
|
+
## Improvements
|
95
|
+
|
96
|
+
There's plenty of scope for improvement:
|
97
|
+
|
98
|
+
* It'd be nice if you could specify offsets for each variate, or ranges.
|
99
|
+
* Specifying a bit count is a bit rubbish and depends on the implementation too much.
|
100
|
+
* Optimisations. Currently ticking over at about 8,000 attempts/s.
|
101
|
+
|
94
102
|
## Contribution
|
95
103
|
|
96
104
|
Feel free to contribute. No commit is too small.
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: frequency_enumerator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.0.
|
9
|
+
- 1
|
10
|
+
version: 1.0.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Christopher Patuzzo
|